changeset 2680:f44a23fb05c5

Merge with gussoundtest
author Stefan Stammberger <fusion44>
date Thu, 20 Mar 2014 19:04:28 +0100
parents e1aa8012e3ab (current diff) b973e8c7cf83 (diff)
children 0a63884e536c
files CMakeModules/CheckOGREPlugins.cmake share/resources/emotionsets/emo_councilMage.imageset share/resources/emotionsets/emo_councilMageCrystal.imageset share/resources/emotionsets/emo_derred.imageset share/resources/emotionsets/emo_farmer.imageset share/resources/emotionsets/emo_general.imageset share/resources/emotionsets/emo_gertlinde.imageset share/resources/emotionsets/emo_ireana.imageset share/resources/emotionsets/emo_rogue.imageset share/resources/emotionsets/emo_tolec.imageset share/resources/emotionsets/emo_warrior.imageset share/resources/gui/imagesets/CharacterScreen.png share/resources/gui/imagesets/ControlPanel.png share/resources/gui/imagesets/Inventory.png share/resources/gui/imagesets/OptionsWindow.png share/resources/gui/imagesets/Resummoned.png share/resources/gui/imagesets/ResummonedCursors.png share/resources/gui/imagesets/SWB.png share/resources/gui/imagesets/SWBCursors.png share/resources/gui/imagesets/SkillTree.png share/resources/gui/imagesets/SumWarsExtras.png share/resources/gui/imagesets/SumWarsLogo.png share/resources/gui/imagesets/TaharezLook.tga share/resources/gui/imagesets/TradeWindow.png share/resources/gui/imagesets/main_menu.png share/resources/gui/imagesets/misc.png share/resources/gui/imagesets/portrait.png share/resources/gui/imagesets/skills.png share/resources/gui/imagesets/worldMap.png share/resources/gui/layouts/saveitem.layout src/gui/music.cpp src/gui/music.h src/gui/ogg.cpp src/gui/ogg.h src/gui/sound.cpp src/gui/sound.h
diffstat 409 files changed, 46164 insertions(+), 19370 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeLists.txt	Thu Mar 20 19:04:28 2014 +0100
@@ -147,6 +147,8 @@
 
 IF("${OGRE_VERSION_NAME}" STREQUAL "Cthugha")
   set(SUMWARS_OGRE_SINGLETON "ms_Singleton")
+ELSEIF("${OGRE_VERSION_NAME}" STREQUAL "Ghadamon")
+  set(SUMWARS_OGRE_SINGLETON "msSingleton")
 ELSE()
   set(SUMWARS_OGRE_SINGLETON "msSingleton")
 ENDIF()
@@ -154,6 +156,10 @@
 SET(SUMWARS_OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_REL}) 
 SET(SUMWARS_OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_DBG}) 
 
+IF("${OGRE_PLUGIN_DIR_REL}" STREQUAL "")
+  MESSAGE(WARNING "Ogre plugin dir not found! plugins.cfg may have to be adjusted manually!")
+ENDIF()
+
 IF( WIN32 )# On Windows the plugins are distributed with the executable.
   IF( SUMWARS_PORTABLE_MODE OR SUMWARS_STANDALONE_MODE)
     SET(SUMWARS_OGRE_PLUGIN_DIR_REL "./") 
@@ -175,6 +181,13 @@
 FIND_PACKAGE(OIS REQUIRED)
 FIND_PACKAGE(Lua REQUIRED)
 FIND_PACKAGE(CEGUI REQUIRED)
+
+IF(CEGUI_VERSION VERSION_LESS "0.8.0")
+	SET(CEGUI_VERSION_RESOURCES "gui")
+ELSE()
+	SET(CEGUI_VERSION_RESOURCES "gui_0.8")
+ENDIF()
+
 FIND_PACKAGE(CEGUIOGRE REQUIRED)
 FIND_PACKAGE(OpenAL REQUIRED)
 FIND_PACKAGE(ALUT REQUIRED)
@@ -208,6 +221,8 @@
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/core)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/gui)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/gui/contenteditor)
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/gussound)
+ADD_DEFINITIONS(-DGUSSOUND_STANDALONE)
 INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${OGRE_RTShaderSystem_INCLUDE_DIR})
 IF (WIN32)
@@ -284,8 +299,10 @@
 ELSE()
   SET(SRCS_TINYXML
     ./src/tinyxml/tinystr.cpp
+    ./src/tinyxml/tinystr.h
     ./src/tinyxml/tinyxmlerror.cpp
     ./src/tinyxml/tinyxml.cpp
+    ./src/tinyxml/tinyxml.h
     ./src/tinyxml/tinyxmlparser.cpp)
 ENDIF()
 
@@ -302,79 +319,97 @@
     ./src/enet/protocol.c
     ./src/enet/unix.c
     ./src/enet/win32.c
+    ./src/enet/include/enet/callbacks.h
+    ./src/enet/include/enet/enet.h
+    ./src/enet/include/enet/list.h
+    ./src/enet/include/enet/protocol.h
+    ./src/enet/include/enet/time.h
+    ./src/enet/include/enet/types.h
+    ./src/enet/include/enet/unix.h
+    ./src/enet/include/enet/utility.h
+    ./src/enet/include/enet/win32.h
     )
 ENDIF()
 
-SET(SRCS
-  ${SRCS_TINYXML}
-  ${SRCS_ENET}
-  ${HEADER_FILES}
-  ./src/core/nlfg.cpp
-  ./src/core/worldobject.cpp
-  ./src/core/itemloader.cpp
-  ./src/core/itemlist.cpp
-  ./src/core/region.cpp
-  ./src/core/objectloader.cpp
-  ./src/core/player.cpp
-  ./src/core/monsterbase.cpp
-  ./src/core/monster.cpp
-  ./src/core/itemfactory.cpp
-  ./src/core/translatablestring.cpp
-  ./src/core/event.cpp
-  ./src/core/charconv.cpp
-  ./src/core/stdstreamconv.cpp
-  ./src/core/gameobject.cpp
-  ./src/core/projectile.cpp
-  ./src/core/treasure.cpp
-  ./src/core/dialogue.cpp
-  ./src/core/playerbase.cpp
-  ./src/core/objectfactory.cpp
-  ./src/core/gettext.cpp
-  ./src/core/dropitem.cpp
-  ./src/core/party.cpp
-  ./src/core/minimap.cpp
-  ./src/core/logger.cpp
-  ./src/core/item.cpp
-  ./src/core/networkstruct.cpp
-  ./src/core/gridunit.cpp
-  ./src/core/quest.cpp
-  ./src/core/eventsystem.cpp
-  ./src/core/creature.cpp
-  ./src/core/random.cpp
-  ./src/core/action.cpp
-  ./src/core/creaturestruct.cpp
-  ./src/core/servernetwork.cpp
-  ./src/core/nlfgservernetwork.cpp
-  ./src/core/nlfgclientnetwork.cpp
-  ./src/core/nlfgnetworkpacket.cpp
-  ./src/core/pathfind.cpp
-  ./src/core/damage.cpp
-  ./src/core/waypoint.cpp
-  ./src/core/document.cpp
-  ./src/core/debug.cpp
-  ./src/core/unionfindtree.cpp
-  ./src/core/world.cpp
-  ./src/core/fixedbase.cpp
-  ./src/core/fixedobject.cpp
-  ./src/core/templateloader.cpp
-  ./src/core/elementattrib.cpp
-  ./src/core/worldloader.cpp
-  ./src/core/geometry.cpp
-  ./src/core/scriptobject.cpp
-  ./src/core/spawnpoint.cpp
-  ./src/core/fraction.cpp
-  ./src/core/command.cpp
-  ./src/core/mapgenerator.cpp
-  ./src/core/options.cpp
-  ./src/core/sumwarshelper.cpp
+SET(SRCS_GUSSOUND
+    ./src/gussound/goggstreamedsound.cpp
+    ./src/gussound/goggstreamedsound.h
+    ./src/gussound/gopenal.cpp
+    ./src/gussound/gopenal.h
+    ./src/gussound/gussound.cpp
+    ./src/gussound/gussound.h
+    ./src/gussound/gussoundutil/stringutil.cpp
+    ./src/gussound/gussoundutil/timer.cpp
+    )
+
+SET(SRCS_CORE
+    ./src/core/nlfg.cpp
+    ./src/core/worldobject.cpp
+    ./src/core/itemloader.cpp
+    ./src/core/itemlist.cpp
+    ./src/core/region.cpp
+    ./src/core/objectloader.cpp
+    ./src/core/player.cpp
+    ./src/core/monsterbase.cpp
+    ./src/core/monster.cpp
+    ./src/core/itemfactory.cpp
+    ./src/core/translatablestring.cpp
+    ./src/core/event.cpp
+    ./src/core/charconv.cpp
+    ./src/core/stdstreamconv.cpp
+    ./src/core/gameobject.cpp
+    ./src/core/projectile.cpp
+    ./src/core/treasure.cpp
+    ./src/core/dialogue.cpp
+    ./src/core/playerbase.cpp
+    ./src/core/objectfactory.cpp
+    ./src/core/gettext.cpp
+    ./src/core/dropitem.cpp
+    ./src/core/party.cpp
+    ./src/core/minimap.cpp
+    ./src/core/logger.cpp
+    ./src/core/item.cpp
+    ./src/core/networkstruct.cpp
+    ./src/core/gridunit.cpp
+    ./src/core/quest.cpp
+    ./src/core/eventsystem.cpp
+    ./src/core/creature.cpp
+    ./src/core/random.cpp
+    ./src/core/action.cpp
+    ./src/core/creaturestruct.cpp
+    ./src/core/servernetwork.cpp
+    ./src/core/nlfgservernetwork.cpp
+    ./src/core/nlfgclientnetwork.cpp
+    ./src/core/nlfgnetworkpacket.cpp
+    ./src/core/pathfind.cpp
+    ./src/core/damage.cpp
+    ./src/core/waypoint.cpp
+    ./src/core/document.cpp
+    ./src/core/debug.cpp
+    ./src/core/unionfindtree.cpp
+    ./src/core/world.cpp
+    ./src/core/fixedbase.cpp
+    ./src/core/fixedobject.cpp
+    ./src/core/templateloader.cpp
+    ./src/core/elementattrib.cpp
+    ./src/core/worldloader.cpp
+    ./src/core/geometry.cpp
+    ./src/core/scriptobject.cpp
+    ./src/core/spawnpoint.cpp
+    ./src/core/fraction.cpp
+    ./src/core/command.cpp
+    ./src/core/mapgenerator.cpp
+    ./src/core/options.cpp
+    ./src/core/sumwarshelper.cpp
+    )
+
+SET(SRCS_GUI
   ./src/gui/minimapwindow.cpp
   ./src/gui/worldmap.cpp
   ./src/gui/mainmenu.cpp
-  ./src/gui/ogg.cpp
   ./src/gui/charcreate.cpp
   ./src/gui/ceguiutility.cpp
   ./src/gui/tooltipmanager.cpp
-  ./src/gui/music.cpp
   ./src/gui/controlpanel.cpp
   ./src/gui/inventory.cpp
   ./src/gui/tradewindow.cpp
@@ -396,18 +431,34 @@
   ./src/gui/graphicobjectrenderinfo.cpp
   ./src/gui/graphicobject.cpp
   ./src/gui/questinfo.cpp
-  ./src/gui/sound.cpp
+  ./src/gui/soundhelper.cpp
+  ./src/gui/soundobject.cpp
   ./src/gui/tooltip.cpp
   ./src/gui/optionswindow.cpp
   ./src/gui/clipboard.cpp
 #   ./src/gui/ShaderManager.cpp
 #   ./src/gui/ShadowCameraSetup.cpp
+    )    
+
+IF (WIN32)
+  SOURCE_GROUP ("tinyxml" FILES ${SRCS_TINYXML})
+  SOURCE_GROUP ("enet" FILES ${SRCS_ENET})
+  SOURCE_GROUP ("gussound" FILES ${SRCS_GUSSOUND})
+  SOURCE_GROUP ("core" FILES ${SRCS_CORE})
+  SOURCE_GROUP ("gui" FILES ${SRCS_GUI})
+ENDIF ()
+
+SET(SRCS
+  ${SRCS_TINYXML}
+  ${SRCS_ENET}
+  ${SRCS_GUSSOUND}
+  ${HEADER_FILES}
+  ${SRCS_CORE}
+  ${SRCS_GUI}
 )
  
 IF(SUMWARS_BUILD_TOOLS)
-  SET(SRCS
-    ${SRCS}
-    ${HEADER_FILES}
+  SET(SRCS_BUILD_TOOLS
     ./src/gui/debugpanel/benchmarktab.cpp
     ./src/gui/debugpanel/debugpanel.cpp
     ./src/gui/debugpanel/debugcameratab.cpp
@@ -416,7 +467,6 @@
     ./src/gui/debugpanel/luascripttab.cpp
     ./src/gui/debugpanel/textfileeditwindow.cpp
     ./src/gui/debugpanel/filebrowser/filebrowser.cpp
-    #./src/gui/debugpanel/reloadtab.cpp
     ./src/gui/contenteditor/contenteditor.cpp
     ./src/gui/contenteditor/contenteditortab.cpp
     ./src/gui/contenteditor/fixedobjecteditor.cpp
@@ -425,6 +475,11 @@
     ./src/gui/contenteditor/monstereditor.cpp
     ./src/gui/contenteditor/gameinfotab.cpp
     )
+  SOURCE_GROUP ("tools" FILES ${SRCS_BUILD_TOOLS})
+  SET(SRCS
+    ${SRCS}
+    ${SRCS_BUILD_TOOLS}
+    )
 ENDIF()
 
 IF(SUMWARS_BUILD_WITH_ONLINE_SERVICE)
--- a/CMakeModules/CheckOGREPlugins.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
- #
- #             ORXONOX - the hottest 3D action shooter ever to exist
- #                             > www.orxonox.net <
- #
- #        This program is free software; you can redistribute it and/or
- #         modify it under the terms of the GNU General Public License
- #        as published by the Free Software Foundation; either version 2
- #            of the License, or (at your option) any later version.
- #
- #       This program is distributed in the hope that it will be useful,
- #        but WITHOUT ANY WARRANTY; without even the implied warranty of
- #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- #                 GNU General Public License for more details.
- #
- #   You should have received a copy of the GNU General Public License along
- #      with this program; if not, write to the Free Software Foundation,
- #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- #
- #
- #  Author:
- #    Reto Grieder
- #  Description:
- #    Function that checks each OGRE plugin for existance. Also looks for debug
- #    versions and sets them accordingly.
- #    All the plugins specified as function arguments have to be found or the
- #    script will issue a fatal error. Additionally, all release plugins have
- #    to be found in the same folder. Analogously for debug plugins.
- #    Output:
- #    OGRE_PLUGINS_FOLDER_DEBUG   Folder with the debug plugins
- #    OGRE_PLUGINS_FOLDER_RELEASE Folder with the release plugins
- #    OGRE_PLUGINS_DEBUG          Names of the debug plugins without extension
- #    OGRE_PLUGINS_RELEASE        Names of the release plugins without ext.
- #  Note:
- #    You must not specify render systems as input. That will be taken care of
- #    automatically.
- #
-
-FUNCTION(CHECK_OGRE_PLUGINS)
-
-  SET(OGRE_PLUGINS ${ARGN})
-
-  IF(WIN32)
-    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
-    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
-  ENDIF(WIN32)
-  # Do not prefix "lib" on any platform
-  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
-
-  SET(OGRE_RENDER_SYSTEMS RenderSystem_GL RenderSystem_Direct3D9)
-  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
-  FOREACH(_plugin ${OGRE_PLUGINS} ${OGRE_RENDER_SYSTEMS})
-    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
-      NAMES ${_plugin}
-      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
-      PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin
-    )
-    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
-      NAMES ${_plugin}d ${_plugin}_d ${_plugin}
-      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
-      PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin
-    )
-    # We only need at least one render system. Check at the end.
-    IF(NOT ${_plugin} MATCHES "RenderSystem")
-      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
-      ENDIF()
-    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
-    ENDIF()
-
-    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-      # If debug version is not available, release will do as well
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG STREQUAL OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-        # In this case the library finder didn't find real debug versions
-        SET(OGRE_PLUGIN_${_plugin}_DEBUG "OGRE_PLUGIN_${_plugin}_DEBUG-NOTFOUND" CACHE STRING "" FORCE)
-      ENDIF()
-      MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
-
-      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
-      # Check and set the folders
-      GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
-      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _plugins_folder)
-        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
-      ENDIF()
-      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_plugins_folder})
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
-        GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
-      ENDIF()
-      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _plugins_folder)
-        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
-      ENDIF()
-      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_plugins_folder})
-
-      # Create a list with the plugins for release and debug configurations
-      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
-      # Determine debug postfix ("d" or "_d" or none)
-      IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
-      ELSEIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "d\\.|d$")
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
-      ELSE()
-        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}")
-      ENDIF()
-    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
-  ENDFOREACH(_plugin)
-  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
-      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
-  ENDIF()
-
-  # List has to be comma separated for orxonox.ini
-  STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
-  STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
-
-  # Set variables outside function scope
-  SET(OGRE_PLUGINS_FOLDER_DEBUG ${OGRE_PLUGINS_FOLDER_DEBUG} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_FOLDER_RELEASE ${OGRE_PLUGINS_FOLDER_RELEASE} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_RELEASE ${OGRE_PLUGINS_RELEASE} PARENT_SCOPE)
-  SET(OGRE_PLUGINS_DEBUG ${OGRE_PLUGINS_DEBUG} PARENT_SCOPE)
-
-ENDFUNCTION(CHECK_OGRE_PLUGINS)
--- a/CMakeModules/FindALUT.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindALUT.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -23,15 +23,32 @@
 INCLUDE(FindPackageHandleStandardArgs)
 INCLUDE(HandleLibraryTypes)
 
+SET (ALUT_SEARCH_PATH ${PROJECT_SOURCE_DIR}/dependencies/freealut ${PROJECT_SOURCE_DIR}/dependencies/alut 
+        ${PROJECT_SOURCE_DIR}/../dependencies/freealut ${PROJECT_SOURCE_DIR}/../dependencies/alut
+        $ENV{ALUTDIR})
 FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
-  PATHS
-  $ENV{ALUTDIR}
+  PATHS  ${ALUT_SEARCH_PATH}
   ~/Library/Frameworks/OpenAL.framework
   /Library/Frameworks/OpenAL.framework
   /System/Library/Frameworks/OpenAL.framework # Tiger
   PATH_SUFFIXES include include/OpenAL include/AL Headers
 )
 
+IF (NOT ALUT_STATIC)
+  FIND_FILE (ALUT_BINARY_REL 
+      NAMES "alut.dll" "freealut.dll" 
+      HINTS ${ALUT_SEARCH_PATH}
+      PATH_SUFFIXES "" Release relwithdebinfo minsizerel
+  )
+        
+  FIND_FILE (ALUT_BINARY_DBG 
+      NAMES "alut.dll" "freealut.dll" "alutd.dll" "freealutd.dll" 
+      HINTS ${ALUT_SEARCH_PATH}
+      PATH_SUFFIXES "" debug
+  )
+ENDIF ()
+
+
 # I'm not sure if I should do a special casing for Apple. It is
 # unlikely that other Unix systems will find the framework path.
 # But if they do ([Next|Open|GNU]Step?),
@@ -54,12 +71,12 @@
 ELSE()
   FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
     NAMES alut
-    PATHS $ENV{ALUTDIR}
+    PATHS ${ALUT_SEARCH_PATH}
     PATH_SUFFIXES lib libs
   )
   FIND_LIBRARY(ALUT_LIBRARY_DEBUG
     NAMES alutd alut_d alutD alut_D
-    PATHS $ENV{ALUTDIR}
+    PATHS ${ALUT_SEARCH_PATH}
     PATH_SUFFIXES lib libs
   )
 ENDIF()
--- a/CMakeModules/FindCEGUI.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindCEGUI.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -32,27 +32,47 @@
 INCLUDE(FindPackageHandleAdvancedArgs)
 INCLUDE(HandleLibraryTypes)
 
-FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES /include /cegui/include /include/CEGUI CEGUI.framework/Headers
+FIND_PATH(CEGUI_INCLUDE_DIR
+  NAMES CEGUI/CEGUI.h
+  PATHS $ENV{CEGUIDIR} /usr /usr/local 
+  PATH_SUFFIXES cegui-0 cegui-99 /include /cegui/include /cegui/include/cegui /include/CEGUI CEGUI.framework/Headers 
 )
 
+MESSAGE (STATUS "*** CEGUI_INCLUDE_DIR is: ${CEGUI_INCLUDE_DIR}")
+
 FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
-  NAMES CEGUIBase CEGUI
+  NAMES CEGUIBase CEGUI CEGUIBase-0
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES lib bin
 )
 FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
   NAMES
     CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
-    CEGUId CEGUI_d CEGUID CEGUI_D
+    CEGUId CEGUI_d CEGUID CEGUI_D CEGUIBase-0_d
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES lib bin
 )
 
+FIND_FILE(CEGUI_BINARY_REL
+  NAMES "CEGUIBase.dll" "CEGUI.dll" "CEGUIBase-0.dll"
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES bin
+)
+FIND_FILE(CEGUI_BINARY_DBG
+  NAMES
+    "CEGUIBased.dll" "CEGUIBase_d.dll" "CEGUIBaseD.dll" "CEGUIBase_D.dll"
+    "CEGUId.dll" "CEGUI_d.dll" "CEGUID.dll" "CEGUI_D.dll" "CEGUIBase-0_d.dll"
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES bin
+)
+
+
+
+SET (CEGUI_VERSION_GENERATED_FILE ${CEGUI_INCLUDE_DIR}/CEGUI/Version.h)
+MESSAGE (STATUS "Determinating CEGUI version (based on file ${CEGUI_VERSION_GENERATED_FILE})")
 
 # Inspect CEGUIVersion.h for the version number
-DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
+DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_GENERATED_FILE})
 
 # Handle the REQUIRED argument and set CEGUI_FOUND
 # Also checks the version requirements if given
@@ -61,6 +81,8 @@
   CEGUI_INCLUDE_DIR
 )
 
+MESSAGE (STATUS "*** CEGUI_VERSION is: ${CEGUI_VERSION}")
+
 # Collect optimized and debug libraries
 HANDLE_LIBRARY_TYPES(CEGUI)
 
--- a/CMakeModules/FindCEGUIOGRE.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindCEGUIOGRE.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -27,18 +27,24 @@
 INCLUDE(FindPackageHandleAdvancedArgs)
 INCLUDE(HandleLibraryTypes)
 
-FIND_PATH(CEGUIOGRE_INCLUDE_DIRS CEGUIOgreRenderer.h
-  PATHS $ENV{CEGUIDIR}
-  PATH_SUFFIXES include/RendererModules/Ogre cegui/include/RendererModules/Ogre include/CEGUI/RendererModules/Ogre CEGUI.framework/Headers
+FIND_PATH(CEGUIOGRE_INCLUDE_DIRS
+  NAMES CEGUIOgreRenderer.h Renderer.h
+  PATHS $ENV{CEGUIDIR} /usr /usr/local 
+  PATH_SUFFIXES include/RendererModules/Ogre 
+    cegui-0/CEGUI/RendererModules/Ogre 
+    cegui/include/RendererModules/Ogre 
+    include/CEGUI/RendererModules/Ogre 
+    CEGUI.framework/Headers 
+    cegui/include/cegui/RendererModules/Ogre 
 )
 FIND_LIBRARY(CEGUIOGRE_LIBRARY_OPTIMIZED
-  NAMES CEGUIOgreRenderer CEGUI
+  NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0 CEGUI
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES lib bin
 )
 FIND_LIBRARY(CEGUIOGRE_LIBRARY_DEBUG
   NAMES
-  CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRendererD CEGUIOgreRenderer_D
+  CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRendererD CEGUIOgreRenderer_D CEGUIOgreRenderer-0_d
   PATHS $ENV{CEGUIDIR}
   PATH_SUFFIXES lib bin
 )
--- a/CMakeModules/FindOGRE.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindOGRE.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -28,8 +28,10 @@
 #  Plugin_BSPSceneManager, Plugin_CgProgramManager,
 #  Plugin_OctreeSceneManager, Plugin_OctreeZone,
 #  Plugin_ParticleFX, Plugin_PCZSceneManager,
-#  RenderSystem_GL, RenderSystem_Direct3D9,
-#  Paging, Terrain
+#  RenderSystem_GL, RenderSystem_GL3Plus,
+#  RenderSystem_GLES, RenderSystem_GLES2,
+#  RenderSystem_Direct3D9, RenderSystem_Direct3D11
+#  Paging, Terrain, Volume, Overlay
 #
 # For each of these components, the following variables are defined:
 #
@@ -68,14 +70,13 @@
   set(OGRE_LIB_SUFFIX "")
 endif ()
 
-
-if(APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
+if(APPLE AND NOT OGRE_STATIC)
 	set(OGRE_LIBRARY_NAMES "Ogre${OGRE_LIB_SUFFIX}")
 else()
     set(OGRE_LIBRARY_NAMES "OgreMain${OGRE_LIB_SUFFIX}")
 endif()
 get_debug_names(OGRE_LIBRARY_NAMES)
-
+          
 # construct search paths from environmental hints and
 # OS specific guesses
 if (WIN32)
@@ -94,6 +95,12 @@
     $ENV{HOME}/ogre
     $ENV{HOME}/OGRE
   )
+  if (APPLE)
+    set(OGRE_PREFIX_GUESSES 
+      ${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx
+      ${OGRE_PREFIX_GUESSES}
+    )
+  endif ()
 endif ()
 set(OGRE_PREFIX_PATH
   ${OGRE_HOME} ${OGRE_SDK} ${ENV_OGRE_HOME} ${ENV_OGRE_SDK}
@@ -106,15 +113,28 @@
 set(OGRE_PREFIX_DEPENDENCIES_DIR ${OGRE_DEPENDENCIES_DIR} ${ENV_OGRE_DEPENDENCIES_DIR})
 if (OGRE_PREFIX_SOURCE AND OGRE_PREFIX_BUILD)
   foreach(dir ${OGRE_PREFIX_SOURCE})
-    set(OGRE_INC_SEARCH_PATH ${dir}/OgreMain/include ${dir}/Dependencies/include ${dir}/iOSDependencies/include ${OGRE_INC_SEARCH_PATH})
-    set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${dir}/Dependencies/lib ${dir}/iOSDependencies/lib ${OGRE_LIB_SEARCH_PATH})
+    set(OGRE_INC_SEARCH_PATH ${dir}/OgreMain/include ${dir}/Dependencies/include ${dir}/iOSDependencies/include ${dir}/AndroidDependencies/include ${OGRE_INC_SEARCH_PATH})
+    set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${dir}/Dependencies/lib ${dir}/iOSDependencies/lib ${dir}/AndroidDependencies/lib/${ANDROID_ABI} ${OGRE_LIB_SEARCH_PATH})
     set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
   endforeach(dir)
   foreach(dir ${OGRE_PREFIX_BUILD})
     set(OGRE_INC_SEARCH_PATH ${dir}/include ${OGRE_INC_SEARCH_PATH})
-    set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${OGRE_LIB_SEARCH_PATH})
+    if(APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
+        set(OGRE_LIB_SEARCH_PATH ${dir}/lib/macosx ${OGRE_LIB_SEARCH_PATH})
+    else()
+        set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${OGRE_LIB_SEARCH_PATH})
+    endif()
+
+    if (OGRE_BUILD_PLATFORM_APPLE_IOS)
+        set(OGRE_LIB_SEARCH_PATH ${dir}/lib/iphoneos ${dir}/lib/iphonesimulator ${OGRE_LIB_SEARCH_PATH})
+    endif()
+
     set(OGRE_BIN_SEARCH_PATH ${dir}/bin ${OGRE_BIN_SEARCH_PATH})
-	set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
+    set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
+
+    if(APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
+      set(OGRE_BIN_SEARCH_PATH ${dir}/bin/macosx ${OGRE_BIN_SEARCH_PATH})
+    endif()
   endforeach(dir)
   
   if (OGRE_PREFIX_DEPENDENCIES_DIR)
@@ -128,10 +148,10 @@
 endif ()
 
 # redo search if any of the environmental hints changed
-set(OGRE_COMPONENTS Paging Terrain 
+set(OGRE_COMPONENTS Paging Terrain Volume Overlay RTShaderSystem 
   Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager
   Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX
-  RenderSystem_Direct3D11 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GLES RenderSystem_GLES2)
+  RenderSystem_Direct3D11 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GL3Plus RenderSystem_GLES RenderSystem_GLES2)
 set(OGRE_RESET_VARS 
   OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR 
   OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
@@ -145,18 +165,21 @@
 set(OGRE_PREFIX_WATCH ${OGRE_PREFIX_PATH} ${OGRE_PREFIX_SOURCE} ${OGRE_PREFIX_BUILD})
 clear_if_changed(OGRE_PREFIX_WATCH ${OGRE_RESET_VARS})
 
-if(NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
+if(NOT OGRE_STATIC)
 	# try to locate Ogre via pkg-config
 	use_pkgconfig(OGRE_PKGC "OGRE${OGRE_LIB_SUFFIX}")
 
 	# try to find framework on OSX
-	findpkg_framework(OGRE)
+	findpkg_framework(Ogre)
 else()
 	set(OGRE_LIBRARY_FWK "")
 endif()
 
 # locate Ogre include files
 find_path(OGRE_CONFIG_INCLUDE_DIR NAMES OgreBuildSettings.h HINTS ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
+# Augustin Preda, 2014.03.16: Somehow, the latest change breaks the detection of the header files on Windows 
+# (if "OgreRoot.h" and "OgreBuildSettings.h" are in different directories)
+Set (OGRE_INC_SEARCH_PATH ${OGRE_INC_SEARCH_PATH} ${ENV_OGRE_HOME}/OgreMain/include)
 find_path(OGRE_INCLUDE_DIR NAMES OgreRoot.h HINTS ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
 set(OGRE_INCOMPATIBLE FALSE)
 
@@ -203,13 +226,19 @@
   set(OGRE_INCOMPATIBLE FALSE)
 endif ()
 
-find_library(OGRE_LIBRARY_REL NAMES ${OGRE_LIBRARY_NAMES} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
-find_library(OGRE_LIBRARY_DBG NAMES ${OGRE_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "debug")
+if (NOT OGRE_SOURCE) # If using ogre sources, use the target names instead of library files to link.
+	find_library(OGRE_LIBRARY_REL NAMES ${OGRE_LIBRARY_NAMES} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel")
+	find_library(OGRE_LIBRARY_DBG NAMES ${OGRE_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "Debug")
+else()
+	if( NOT OGRE_LIBRARIES OR OGRE_LIBRARIES STREQUAL "" )
+		message( FATAL_ERROR "When using Ogre from sources, please specify target names in OGRE_LIBRARIES!" )
+	else()
+		message( "Using Ogre source instead of binary libraries - skipping library files search." )
+	endif()
+endif()
+
 make_library_set(OGRE_LIBRARY)
 
-if(APPLE)
-  set(OGRE_LIBRARY_DBG ${OGRE_LIB_SEARCH_PATH})
-endif()
 if (OGRE_INCOMPATIBLE)
   set(OGRE_LIBRARY "NOTFOUND")
 endif ()
@@ -242,25 +271,17 @@
   find_package(OpenGLES2 QUIET)
   find_package(ZLIB QUIET)
   find_package(ZZip QUIET)
-  if (UNIX AND NOT APPLE)
+  if (UNIX AND NOT APPLE AND NOT ANDROID)
     find_package(X11 QUIET)
     find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
     if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
       set(X11_FOUND FALSE)
     endif ()
   endif ()
-  if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
-    find_package(Cocoa QUIET)
-    find_package(Carbon QUIET)
-    find_package(CoreVideo QUIET)
-    if (NOT Cocoa_FOUND OR NOT Carbon_FOUND OR NOT CoreVideo_FOUND)
-      set(OGRE_DEPS_FOUND FALSE)
-    endif ()
-  endif ()
 
-  set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES} ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES} )
+  set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES} ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES})
 
-  if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
+  if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS AND NOT ANDROID)
     set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} ${Carbon_LIBRARIES} ${Cocoa_LIBRARIES})
   endif()
   
@@ -273,15 +294,32 @@
   if (NOT FREETYPE_FOUND)
     set(OGRE_DEPS_FOUND FALSE)
   endif ()
-  if (UNIX AND NOT APPLE)
+  if (UNIX AND NOT APPLE AND NOT ANDROID)
 	if (NOT X11_FOUND)
       set(OGRE_DEPS_FOUND FALSE)
 	endif ()
   endif ()
-
+endif()
   if (OGRE_CONFIG_THREADS)
     if (OGRE_CONFIG_THREAD_PROVIDER EQUAL 1)
-      find_package(Boost COMPONENTS thread QUIET)
+      if (OGRE_STATIC)
+    	set(Boost_USE_STATIC_LIBS TRUE)
+    	if(OGRE_BUILD_PLATFORM_APPLE_IOS)
+          set(Boost_USE_MULTITHREADED OFF)
+        endif()
+      endif()
+      
+      set(OGRE_BOOST_COMPONENTS thread date_time)
+      find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
+      if(Boost_FOUND AND Boost_VERSION GREATER 104900)
+        if(Boost_VERSION GREATER 105300)
+            set(OGRE_BOOST_COMPONENTS thread date_time system atomic chrono)
+        else()
+            set(OGRE_BOOST_COMPONENTS thread date_time system chrono)
+        endif()
+      endif()
+
+      find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
       if (NOT Boost_THREAD_FOUND)
         set(OGRE_DEPS_FOUND FALSE)
       else ()
@@ -306,7 +344,7 @@
       endif ()
     endif ()
   endif ()
-  
+if (OGRE_STATIC)
   if (NOT OGRE_DEPS_FOUND)
     pkg_message(OGRE "Could not find all required dependencies for the Ogre package.")
     set(OGRE_FOUND FALSE)
@@ -326,9 +364,9 @@
 if (NOT OGRE_STATIC)
 	if (WIN32)
 		find_file(OGRE_BINARY_REL NAMES "OgreMain.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
-          PATH_SUFFIXES "" release relwithdebinfo minsizerel)
+          PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
 		find_file(OGRE_BINARY_DBG NAMES "OgreMain_d.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
-          PATH_SUFFIXES "" debug )
+          PATH_SUFFIXES "" Debug )
 	endif()
 	mark_as_advanced(OGRE_BINARY_REL OGRE_BINARY_DBG)
 endif()
@@ -354,16 +392,16 @@
   find_path(OGRE_${COMPONENT}_INCLUDE_DIR NAMES ${HEADER} HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES ${COMPONENT} OGRE/${COMPONENT} Components/${COMPONENT}/include)
   set(OGRE_${COMPONENT}_LIBRARY_NAMES "Ogre${COMPONENT}${OGRE_LIB_SUFFIX}")
   get_debug_names(OGRE_${COMPONENT}_LIBRARY_NAMES)
-  find_library(OGRE_${COMPONENT}_LIBRARY_REL NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
-  find_library(OGRE_${COMPONENT}_LIBRARY_DBG NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
+  find_library(OGRE_${COMPONENT}_LIBRARY_REL NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel")
+  find_library(OGRE_${COMPONENT}_LIBRARY_DBG NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "Debug")
   make_library_set(OGRE_${COMPONENT}_LIBRARY)
   findpkg_finish(OGRE_${COMPONENT})
   if (OGRE_${COMPONENT}_FOUND)
     # find binaries
     if (NOT OGRE_STATIC)
 	  if (WIN32)
-	    find_file(OGRE_${COMPONENT}_BINARY_REL NAMES "Ogre${COMPONENT}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/release bin/relwithdebinfo bin/minsizerel release)
-	    find_file(OGRE_${COMPONENT}_BINARY_DBG NAMES "Ogre${COMPONENT}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/debug debug)
+	    find_file(OGRE_${COMPONENT}_BINARY_REL NAMES "Ogre${COMPONENT}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/Release bin/RelWithDebInfo bin/MinSizeRel Release)
+	    find_file(OGRE_${COMPONENT}_BINARY_DBG NAMES "Ogre${COMPONENT}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/Debug Debug)
 	  endif()
 	  mark_as_advanced(OGRE_${COMPONENT}_BINARY_REL OGRE_${COMPONENT}_BINARY_DBG)
     endif()
@@ -378,12 +416,14 @@
 ogre_find_component(Property OgreProperty.h)
 # look for RTShaderSystem component
 ogre_find_component(RTShaderSystem OgreRTShaderSystem.h)
-
+# look for Volume component
+ogre_find_component(Volume OgreVolumePrerequisites.h)
+# look for Overlay component
+ogre_find_component(Overlay OgreOverlaySystem.h)
 
 #########################################################
 # Find Ogre plugins
-#########################################################
-
+#########################################################        
 macro(ogre_find_plugin PLUGIN HEADER)
   # On Unix, the plugins might have no prefix
   if (CMAKE_FIND_LIBRARY_PREFIXES)
@@ -407,9 +447,9 @@
   get_debug_names(OGRE_${PLUGIN}_LIBRARY_NAMES)
   set(OGRE_${PLUGIN}_LIBRARY_FWK ${OGRE_LIBRARY_FWK})
   find_library(OGRE_${PLUGIN}_LIBRARY_REL NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES}
-    HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt release release/opt relwithdebinfo relwithdebinfo/opt minsizerel minsizerel/opt)
+    HINTS "${OGRE_BUILD}/lib" ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt Release Release/opt RelWithDebInfo RelWithDebInfo/opt MinSizeRel MinSizeRel/opt OGRE-${OGRE_VERSION})
   find_library(OGRE_${PLUGIN}_LIBRARY_DBG NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES_DBG}
-    HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt debug debug/opt)
+    HINTS "${OGRE_BUILD}/lib" ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt Debug Debug/opt OGRE-${OGRE_VERSION})
   make_library_set(OGRE_${PLUGIN}_LIBRARY)
 
   if (OGRE_${PLUGIN}_LIBRARY OR OGRE_${PLUGIN}_INCLUDE_DIR)
@@ -437,14 +477,14 @@
 		  ${OGRE_BIN_SEARCH_PATH}
         )
         find_path(OGRE_PLUGIN_DIR_REL NAMES "${PLUGIN}.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_REL}
-          PATH_SUFFIXES "" bin bin/release bin/relwithdebinfo bin/minsizerel release)
+          PATH_SUFFIXES "" bin bin/Release bin/RelWithDebInfo bin/MinSizeRel Release)
         find_path(OGRE_PLUGIN_DIR_DBG NAMES "${PLUGIN}_d.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_DBG}
-          PATH_SUFFIXES "" bin bin/debug debug)
+          PATH_SUFFIXES "" bin bin/Debug Debug)
       elseif (UNIX)
         get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_REL} PATH)
-        set(OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (release)")
-        get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_DBG} PATH)
-        set(OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (debug)")
+        set(OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (release)" FORCE)
+	    get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_DBG} PATH)
+        set(OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (debug)" FORCE)  
       endif ()
     endif ()
 	
@@ -471,11 +511,12 @@
 ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h PlugIns/OctreeSceneManager/include)
 ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
 ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
+ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus/include)
 ogre_find_plugin(RenderSystem_GLES OgreGLESRenderSystem.h RenderSystems/GLES/include)
 ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
 ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9/include)
 ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
-
+        
 if (OGRE_STATIC)
   # check if dependencies for plugins are met
   if (NOT DirectX_FOUND)
@@ -487,6 +528,9 @@
   if (NOT OPENGL_FOUND)
     set(OGRE_RenderSystem_GL_FOUND FALSE)
   endif ()
+  if (NOT OPENGL_FOUND)
+    set(OGRE_RenderSystem_GL3Plus_FOUND FALSE)
+  endif ()
   if (NOT OPENGLES_FOUND)
     set(OGRE_RenderSystem_GLES_FOUND FALSE)
   endif ()
@@ -507,6 +551,9 @@
   set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES}
     ${OPENGL_LIBRARIES}
   )
+  set(OGRE_RenderSystem_GL3Plus_LIBRARIES ${OGRE_RenderSystem_GL3Plus_LIBRARIES}
+    ${OPENGL_LIBRARIES}
+  )
   set(OGRE_RenderSystem_GLES_LIBRARIES ${OGRE_RenderSystem_GLES_LIBRARIES}
     ${OPENGLES_LIBRARIES}
   )
@@ -532,6 +579,7 @@
   Media
   media
   share/OGRE/media
+  share/OGRE/Media
 )
 
 clear_if_changed(OGRE_PREFIX_WATCH OGRE_MEDIA_DIR)
--- a/CMakeModules/FindOIS.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindOIS.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -21,6 +21,7 @@
 getenv_path(OIS_HOME)
 getenv_path(OGRE_BYATIS)
 getenv_path(OGRE_HOME)
+getenv_path(OGRE_DEPENDENCIES_DIR)
 
 # construct search paths
 set(OIS_PREFIX_PATH ${OIS_HOME} ${ENV_OIS_HOME} 
@@ -43,21 +44,44 @@
 
 find_path(OIS_INCLUDE_DIR 
   NAMES OIS.h 
-  HINTS ${OIS_INC_SEARCH_PATH} ${OIS_PKGC_INCLUDE_DIRS} ${ENV_OGRE_HOME}/Dependencies/include 
-  PATH_SUFFIXES OIS
+  HINTS ${OIS_INC_SEARCH_PATH} ${OIS_PREFIX_PATH} ${OIS_PKGC_INCLUDE_DIRS} ${ENV_OGRE_HOME}/Dependencies/include
+  ${ENV_OGRE_DEPENDENCIES_DIR}
+  PATH_SUFFIXES OIS include includes
 )
+
 find_library(OIS_LIBRARY_REL 
   NAMES ${OIS_LIBRARY_NAMES} 
-  HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Release 
-  PATH_SUFFIXES "" release relwithdebinfo minsizerel
+  HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PREFIX_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Release 
+  ${ENV_OGRE_DEPENDENCIES_DIR}
+  PATH_SUFFIXES "" release relwithdebinfo minsizerel lib/release
 )
 find_library(OIS_LIBRARY_DBG 
   NAMES ${OIS_LIBRARY_NAMES_DBG} 
-  HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Release 
-  PATH_SUFFIXES "" debug
+  HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PREFIX_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Debug 
+  ${ENV_OGRE_DEPENDENCIES_DIR}
+  PATH_SUFFIXES "" debug lib/debug
 )
 make_library_set(OIS_LIBRARY)
 
+IF (NOT OIS_STATIC)
+  FIND_FILE (OIS_BINARY_REL 
+      NAMES "ois.dll" 
+      HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PREFIX_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Release
+      ${ENV_OGRE_HOME}/bin/Release
+      ${ENV_OGRE_DEPENDENCIES_DIR}
+      PATH_SUFFIXES "" Release relwithdebinfo minsizerel bin/Release
+  )
+        
+  FIND_FILE (OIS_BINARY_DBG 
+      NAMES "ois.dll" "oisd.dll" 
+      HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PREFIX_PATH} ${OIS_PKGC_LIBRARY_DIRS} ${ENV_OGRE_HOME}/Dependencies/lib/Debug
+      ${ENV_OGRE_HOME}/bin/Debug
+      ${ENV_OGRE_DEPENDENCIES_DIR}
+      PATH_SUFFIXES "" debug bin/debug
+  )
+ENDIF ()
+
+
 findpkg_finish(OIS)
 add_parent_dir(OIS_INCLUDE_DIRS OIS_INCLUDE_DIR)
 
--- a/CMakeModules/FindOgg.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindOgg.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -16,49 +16,75 @@
 INCLUDE(FindPackageHandleStandardArgs)
 INCLUDE(HandleLibraryTypes)
 
+SET (OGG_SEARCH_PATH ${PROJECT_SOURCE_DIR}/dependencies/libogg ${PROJECT_SOURCE_DIR}/../dependencies/libogg $ENV{OGGDIR})
+
 FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
-  PATHS $ENV{OGGDIR}
+  PATHS ${OGG_SEARCH_PATH}
   PATH_SUFFIXES include
 )
 
+MESSAGE (STATUS "Searching OGG_SEARCH_PATH: ${OGG_SEARCH_PATH}")
+
+IF (NOT OGG_STATIC)
+  FIND_FILE (OGG_BINARY_REL 
+      NAMES "ogg.dll" "libogg.dll"
+      HINTS ${OGG_SEARCH_PATH}
+      PATH_SUFFIXES "" Release relwithdebinfo minsizerel
+  )
+        
+  FIND_FILE (OGG_BINARY_DBG 
+      NAMES "oggd.dll" "ogg_d.dll" "liboggd.dll" "libogg_d.dll" 
+      HINTS ${OGG_SEARCH_PATH}
+      PATH_SUFFIXES "" debug
+  )
+ENDIF ()
+
 
 IF (WIN32)
-#Make a special selection for the scenario of using visual studio 2010, since this will
-#be the most frequent at this stage.
-SET (TMP_SUFF Win32/Release)
-IF (MSVC10)
-SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Release Win32/VS2010/Win32/Release )
-ENDIF (MSVC10)
-FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
-  NAMES libogg libogg_static libogg-static-mt
-  PATHS $ENV{OGGDIR}
-  PATH_SUFFIXES Release ${TMP_SUFF}
-)
-ELSE()
-FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
-  NAMES ogg
-  PATH_SUFFIXES lib
-)
+  #Make a special selection for the scenario of using visual studio 2010, since this will
+  #be the most frequent at this stage.
+  SET (TMP_SUFF Win32/Release)
+  IF (MSVC10)
+    SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Release Win32/VS2010/Win32/Release )
+  ENDIF (MSVC10)
+  IF (MSVC11)
+    SET (TMP_SUFF ${TMP_SUFF} VS2012/Win32/Release Win32/VS2012/Win32/Release )
+  ENDIF (MSVC11)
+  
+  FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
+      NAMES libogg libogg_static libogg-static-mt
+      PATHS ${OGG_SEARCH_PATH}
+      PATH_SUFFIXES lib lib/Release Release ${TMP_SUFF}
+  )
+ELSE (WIN32)
+  FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
+    NAMES ogg libogg libogg_static libogg-static-mt
+    PATH_SUFFIXES lib lib/Release
+  )
 ENDIF(WIN32)
 
 
 IF(WIN32)
-#Make a special selection for the scenario of using visual studio 2010, since this will
-#be the most frequent at this stage.
-SET (TMP_SUFF Win32/Debug)
-IF (MSVC10)
-SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Debug Win32/VS2010/Win32/Debug )
-ENDIF (MSVC10)
-FIND_LIBRARY(OGG_LIBRARY_DEBUG
-  NAMES liboggd libogg_static libogg_d liboggD libogg_D libogg-static-mt-debug
-  PATHS $ENV{OGGDIR}
-  PATH_SUFFIXES Debug ${TMP_SUFF}
-)
-ELSE()
-FIND_LIBRARY(OGG_LIBRARY_DEBUG
-  NAMES ogg
-  PATH_SUFFIXES lib
-)
+  #Make a special selection for the scenario of using visual studio 2010, since this will
+  #be the most frequent at this stage.
+  SET (TMP_SUFF Win32/Debug)
+  IF (MSVC10)
+    SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Debug Win32/VS2010/Win32/Debug )
+  ENDIF (MSVC10)
+  IF (MSVC11)
+    SET (TMP_SUFF ${TMP_SUFF} VS2012/Win32/Debug Win32/VS2012/Win32/Debug )
+  ENDIF (MSVC11)
+  
+  FIND_LIBRARY(OGG_LIBRARY_DEBUG
+    NAMES liboggd libogg_static libogg_d liboggD libogg_D libogg-static-mt-debug
+    PATHS ${OGG_SEARCH_PATH}
+    PATH_SUFFIXES lib lib/Debug Debug ${TMP_SUFF}
+  )
+ELSE (WIN32)
+  FIND_LIBRARY(OGG_LIBRARY_DEBUG
+    NAMES ogg liboggd
+    PATH_SUFFIXES lib lib/Debug
+  )
 ENDIF(WIN32)
 
 
--- a/CMakeModules/FindOpenAL.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindOpenAL.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -61,11 +61,14 @@
 # OPENAL_LIBRARY to override this selection or set the CMake environment
 # CMAKE_INCLUDE_PATH to modify the search paths.
 
+SET (OPENAL_SEARCH_PATH ${PROJECT_SOURCE_DIR}/dependencies/openal 
+        ${PROJECT_SOURCE_DIR}/../dependencies/openal
+        $ENV{OPENALDIR})
+
 FIND_PATH(OPENAL_INCLUDE_DIR al.h
-  HINTS
-  $ENV{OPENALDIR}
+  HINTS ${OPENAL_SEARCH_PATH}
   PATH_SUFFIXES include/AL include/OpenAL include
-  PATHS
+  PATHS ${OPENAL_SEARCH_PATH}
   ~/Library/Frameworks
   /Library/Frameworks
   /usr/local
@@ -79,10 +82,9 @@
 
 FIND_LIBRARY(OPENAL_LIBRARY 
   NAMES OpenAL al openal OpenAL32
-  HINTS
-  $ENV{OPENALDIR}
+  HINTS ${OPENAL_SEARCH_PATH}
   PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 Release Debug
-  PATHS
+  PATHS ${OPENAL_SEARCH_PATH}
   ~/Library/Frameworks
   /Library/Frameworks
   /usr/local
--- a/CMakeModules/FindPhysFS.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindPhysFS.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -17,6 +17,8 @@
 FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h
   $ENV{PHYSFSDIR}/include
   $ENV{PHYSFSDIR}
+  ../dependencies/PhysicsFS/include
+  dependencies/PhysicsFS/include
   ~/Library/Frameworks/PhysFS.framework/Headers
   /Library/Frameworks/PhysFS.framework/Headers
   /usr/local/include/physfs
@@ -60,6 +62,8 @@
     PATHS
     $ENV{PHYSFSDIR}/Release
     $ENV{PHYSFSDIR}/lib
+    ../dependencies/PhysicsFS/lib
+    dependencies/PhysicsFS/lib
     /usr/local/lib
     /usr/lib
     /sw/lib
--- a/CMakeModules/FindPkgMacros.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindPkgMacros.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -38,16 +38,26 @@
 macro(create_search_paths PREFIX)
   foreach(dir ${${PREFIX}_PREFIX_PATH})
     set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
-      ${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers)
+      ${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers)
     set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
-      ${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs)
+      ${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs)
+    set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
+      ${dir}/bin)
   endforeach(dir)
+  if(ANDROID)
+	set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} ${OGRE_DEPENDENCIES_DIR}/lib/${ANDROID_ABI})
+  endif()
   set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
 endmacro(create_search_paths)
 
 # clear cache variables if a certain variable changed
 macro(clear_if_changed TESTVAR)
   # test against internal check variable
+  # HACK: Apparently, adding a variable to the cache cleans up the list
+  # a bit. We need to also remove any empty strings from the list, but
+  # at the same time ensure that we are actually dealing with a list.
+  list(APPEND ${TESTVAR} "")
+  list(REMOVE_ITEM ${TESTVAR} "")
   if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
     message(STATUS "${TESTVAR} changed.")
     foreach(var ${ARGN})
@@ -117,26 +127,37 @@
 
 
 # Slightly customised framework finder
-MACRO(findpkg_framework fwk)
-  IF(APPLE)
-    SET(${fwk}_FRAMEWORK_PATH
+macro(findpkg_framework fwk)
+  if(APPLE)
+    set(${fwk}_FRAMEWORK_PATH
       ${${fwk}_FRAMEWORK_SEARCH_PATH}
       ${CMAKE_FRAMEWORK_PATH}
       ~/Library/Frameworks
       /Library/Frameworks
       /System/Library/Frameworks
       /Network/Library/Frameworks
-      /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
+      ${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Release
+      ${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Debug
     )
-    FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
-      SET(fwkpath ${dir}/${fwk}.framework)
-      IF(EXISTS ${fwkpath})
-        SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
+    # These could be arrays of paths, add each individually to the search paths
+    foreach(i ${OGRE_PREFIX_PATH})
+      set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/macosx/Release ${i}/lib/macosx/Debug)
+    endforeach(i)
+
+    foreach(i ${OGRE_PREFIX_BUILD})
+      set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/macosx/Release ${i}/lib/macosx/Debug)
+    endforeach(i)
+
+    foreach(dir ${${fwk}_FRAMEWORK_PATH})
+      set(fwkpath ${dir}/${fwk}.framework)
+      if(EXISTS ${fwkpath})
+        set(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
           ${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
+        set(${fwk}_FRAMEWORK_PATH ${dir})
         if (NOT ${fwk}_LIBRARY_FWK)
-          SET(${fwk}_LIBRARY_FWK "-framework ${fwk}")
+          set(${fwk}_LIBRARY_FWK "-framework ${fwk}")
         endif ()
-      ENDIF(EXISTS ${fwkpath})
-    ENDFOREACH(dir)
-  ENDIF(APPLE)
-ENDMACRO(findpkg_framework)
+      endif(EXISTS ${fwkpath})
+    endforeach(dir)
+  endif(APPLE)
+endmacro(findpkg_framework)
--- a/CMakeModules/FindVorbis.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/FindVorbis.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -16,15 +16,19 @@
 INCLUDE(FindPackageHandleStandardArgs)
 INCLUDE(HandleLibraryTypes)
 
+SET (VORBIS_SEARCH_PATH ${PROJECT_SOURCE_DIR}/dependencies/libvorbis ${PROJECT_SOURCE_DIR}/dependencies/vorbis 
+        ${PROJECT_SOURCE_DIR}/../dependencies/libvorbis ${PROJECT_SOURCE_DIR}/../dependencies/vorbis
+        $ENV{VORBISDIR})
+
 FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
-  PATHS $ENV{VORBISDIR}
+  PATHS ${VORBIS_SEARCH_PATH}
   PATH_SUFFIXES include
 )
 
 IF(WIN32)
   #Make a special selection for the scenario of using visual studio 2010, since this will
   #be the most frequent at this stage.
-  SET (TMP_SUFF Win32/Release)
+  SET (TMP_SUFF Release Win32/Release)
   IF (MSVC10)
     SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Release Win32/VS2010/Win32/Release )
   ENDIF (MSVC10)
@@ -32,7 +36,7 @@
   # TODO: add option to allow selecting static or release as pre 
   FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED
     NAMES libvorbis_static libvorbis-static-mt libvorbis
-    PATHS $ENV{VORBISDIR}
+    PATHS ${VORBIS_SEARCH_PATH}
     PATH_SUFFIXES Release ${TMP_SUFF}
   )
 ELSE()
@@ -46,13 +50,13 @@
 IF(WIN32)
 #Make a special selection for the scenario of using visual studio 2010, since this will
 #be the most frequent at this stage.
-SET (TMP_SUFF Win32/Debug)
+SET (TMP_SUFF Debug Win32/Debug)
 IF (MSVC10)
 SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Debug Win32/VS2010/Win32/Debug )
 ENDIF (MSVC10)
 FIND_LIBRARY(VORBIS_LIBRARY_DEBUG
   NAMES libvorbis_static libvorbis vorbis_d vorbisD vorbis_D libvorbis-static-mt-debug
-  PATHS $ENV{VORBISDIR}
+  PATHS ${VORBIS_SEARCH_PATH}
   PATH_SUFFIXES Debug ${TMP_SUFF}
 )
 ELSE()
@@ -65,13 +69,13 @@
 IF(WIN32)
 #Make a special selection for the scenario of using visual studio 2010, since this will
 #be the most frequent at this stage.
-SET (TMP_SUFF Win32/Release)
+SET (TMP_SUFF Release Win32/Release)
 IF (MSVC10)
 SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Release Win32/VS2010/Win32/Release )
 ENDIF (MSVC10)
 FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED
   NAMES libvorbisfile_static libvorbisfile
-  PATHS $ENV{VORBISDIR}
+  PATHS ${VORBIS_SEARCH_PATH}
   PATH_SUFFIXES Release ${TMP_SUFF}
 )
 ELSE()
@@ -84,13 +88,13 @@
 IF(WIN32)
 #Make a special selection for the scenario of using visual studio 2010, since this will
 #be the most frequent at this stage.
-SET (TMP_SUFF Win32/Debug)
+SET (TMP_SUFF Debug Win32/Debug)
 IF (MSVC10)
 SET (TMP_SUFF ${TMP_SUFF} VS2010/Win32/Debug Win32/VS2010/Win32/Debug )
 ENDIF (MSVC10)
 FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG
-  NAMES libvorbisfile vorbisfile_d vorbisfileD vorbisfile_D
-  PATHS $ENV{VORBISDIR}
+  NAMES libvorbisfile_static libvorbisfile vorbisfile_d vorbisfileD vorbisfile_D
+  PATHS ${VORBIS_SEARCH_PATH}
   PATH_SUFFIXES Debug ${TMP_SUFF}
 )
 ELSE()
--- a/CMakeModules/OgreGetVersion.cmake	Sat Jan 25 11:22:23 2014 +0100
+++ b/CMakeModules/OgreGetVersion.cmake	Thu Mar 20 19:04:28 2014 +0100
@@ -16,5 +16,8 @@
   get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_PATCH OGRE_VERSION_PATCH)
   get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_NAME OGRE_VERSION_NAME)
   get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_SUFFIX OGRE_VERSION_SUFFIX)
-  set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}")
+  set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}${OGRE_VERSION_SUFFIX}")
+  set(OGRE_SOVERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}")
+  set(OGRE_VERSION_DASH_SEPARATED "${OGRE_VERSION_MAJOR}-${OGRE_VERSION_MINOR}-${OGRE_VERSION_PATCH}${OGRE_VERSION_SUFFIX}")
+
 endmacro()
--- a/share/data/items/amulet.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/amulet.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Federnamulett -->
 <Item type="amulet" subtype="feath_aml" name="feather amulet" size="small">
-	<Image image="set:feath_aml.png image:full_image" />
+	<Image image="feath_aml.png" />
 	<Mesh file="feath_aml" />
 	<Attribute
 		level_requirement="2"
@@ -31,7 +31,7 @@
 
 <!-- Bernsteinamulett -->
 <Item type="amulet" subtype="amber_aml" name="amber amulet" size="small">
-	<Image image="set:feath_aml.png image:full_image" />
+	<Image image="feath_aml.png" />
 	<Mesh file="feath_aml" />
 	<Attribute
 		level_requirement="5"
@@ -60,7 +60,7 @@
 
 <!-- Silberamulet -->
 <Item type="amulet" subtype="silver_aml" name="silver amulet" size="small">
-	<Image image="set:feath_aml.png image:full_image" />
+	<Image image="feath_aml.png" />
 	<Mesh file="feath_aml" />
 	<Attribute
 		level_requirement="9"
@@ -89,7 +89,7 @@
 
 <!-- Korallenamulet -->
 <Item type="amulet" subtype="coral_aml" name="coral amulet" size="small">
-	<Image image="set:feath_aml.png image:full_image" />
+	<Image image="feath_aml.png" />
 	<Mesh file="feath_aml" />
 	<Attribute
 		level_requirement="15"
@@ -118,7 +118,7 @@
 
 <!-- Goldamulet -->
 <Item type="amulet" subtype="gold_aml" name="gold amulet" size="small">
-	<Image image="set:feath_aml.png image:full_image" />
+	<Image image="feath_aml.png" />
 	<Mesh file="feath_aml" />
 	<Attribute
 		level_requirement="20"
--- a/share/data/items/armor.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/armor.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,7 +1,7 @@
 <!-- Tuchruestung -->
 <!-- WAR, PRI, ARC, MAG-->
 <Item type="armor" subtype="cloth_arm" name="cloth armor" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="leathArm" />
 	<Attribute
 			level_requirement="1"
@@ -33,7 +33,7 @@
 <!-- Lederruestung -->
 <!-- WAR, PRI, ARC, MAG-->
 <Item type="armor" subtype="leath_arm" name="leather armor" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="leathArm" />
 	<Attribute
 			level_requirement="3"
@@ -65,7 +65,7 @@
 <!-- Nietenruestung -->
 <!-- WAR, PRI, ARC-->
 <Item type="armor" subtype="rivet_arm" name="rivet armor" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="rivetArmor" />
 	<Attribute
 			level_requirement="5"
@@ -97,7 +97,7 @@
 <!-- Banditenruestung -->
 <!-- WAR, ARC-->
 <Item type="armor" subtype="bandit_arm" name="bandit armor" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="rivetArmorOld" />
 	<Attribute
 			level_requirement="8"
@@ -129,7 +129,7 @@
 <!-- Novizenruestung -->
 <!-- PRI-->
 <Item type="armor" subtype="novice_arm" name="novice armor" size="big">
-	<Image image="set:merc_arm.png image:full_image" />
+	<Image image="merc_arm.png" />
 	<RenderInfo name="noviceArmor" />
 	<Attribute
 			level_requirement="8"
@@ -161,7 +161,7 @@
 <!-- Soeldnerruestung -->
 <!-- WAR, PRI-->
 <Item type="armor" subtype="merc_arm" name="mercenary armor" size="big">
-	<Image image="set:merc_arm.png image:full_image" />
+	<Image image="merc_arm.png" />
 	<RenderInfo name="mercArm" />
 	<Attribute
 			level_requirement="13"
@@ -193,7 +193,7 @@
 <!-- Waldlaeuferhemd -->
 <!-- ARC -->
 <Item type="armor" subtype="rngsh_arm" name="ranger shirt" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="rangerArmor" />
 	<Attribute
 			level_requirement="13"
@@ -225,7 +225,7 @@
 <!-- Assassinenruestung -->
 <!-- WAR, ARC -->
 <Item type="armor" subtype="assass_arm" name="assassin armor" size="big">
-	<Image image="set:leath_arm.png image:full_image" />
+	<Image image="leath_arm.png" />
 	<RenderInfo name="rangerArmor" />
 	<Attribute
 			level_requirement="19"
@@ -258,7 +258,7 @@
 <!-- Tempelruestung -->
 <!-- PRI -->
 <Item type="armor" subtype="temple_arm" name="temple armor" size="big">
-	<Image image="set:merc_arm.png image:full_image" />
+	<Image image="merc_arm.png" />
 	<RenderInfo name="templeArmor" />
 	<Attribute
 			level_requirement="19"
@@ -290,7 +290,7 @@
 <!-- Konzilsruestung -->
 <!-- WAR -->
 <Item type="armor" subtype="councl_arm" name="council armor" size="big">
-	<Image image="set:council_arm.png image:full_image" />
+	<Image image="council_arm.png" />
 	<RenderInfo name="counclArm" />
 	<Attribute
 			level_requirement="25"
--- a/share/data/items/axes1h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/axes1h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,7 +3,7 @@
 <!-- hatchet / Beil -->
 <Item type="weapon" subtype="hatch_axe" name="hatchet" size="medium">
 	<RenderInfo name = "hatchet" />
-	<Image image="set:hatch_axe.png image:full_image" />
+	<Image image="hatch_axe.png" />
 	<Attribute
 		level_requirement="1"
 		character_requirement="warrior,priest"
@@ -40,7 +40,7 @@
 <!-- bronze_axe-->
 <Item type="weapon" subtype="bronze_axe" name="bronze axe" size="medium">
 	<RenderInfo name = "bronzeAxe" />
-	<Image image="set:bronze_axe.png image:full_image" />
+	<Image image="bronze_axe.png" />
 	<Attribute
 		level_requirement="3"
 		character_requirement="warrior,priest"
@@ -77,7 +77,7 @@
 <!-- Eisenbeil -->
 <Item type="weapon" subtype="ironha_axe" name="iron hatchet" size="medium">
 	<RenderInfo name = "ironHatchet" />
-	<Image image="set:ironha_axe.png image:full_image" />
+	<Image image="ironha_axe.png" />
 	<Attribute
 		level_requirement="6"
 		character_requirement="warrior,priest"
@@ -114,7 +114,7 @@
 <!-- Schlachtebeil -->
 <Item type="weapon" subtype="cleave_axe" name="cleaver" size="medium">
 	<RenderInfo name= "ironHatchet" />
-	<Image image="set:ironha_axe.png image:full_image" />
+	<Image image="ironha_axe.png" />
 	<Attribute
 		level_requirement="9"
 		character_requirement="warrior,priest"
@@ -151,7 +151,7 @@
 <!-- Eisenaxt -->
 <Item type="weapon" subtype="iron_axe" name="iron axe" size="medium">
 	<RenderInfo name= "ironHatchet" />
-	<Image image="set:ironha_axe.png image:full_image" />
+	<Image image="ironha_axe.png" />
 	<Attribute
 		level_requirement="13"
 		character_requirement="warrior,priest"
@@ -187,7 +187,7 @@
 
 <!-- Soeldneraxt -->
 <Item type="weapon" subtype="merc_axe" name="mercenary axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="17"
@@ -224,7 +224,7 @@
 
 <!-- Stahlaxt -->
 <Item type="weapon" subtype="steel_axe" name="steel axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="25"
@@ -261,7 +261,7 @@
 
 <!-- Kampfaxt -->
 <Item type="weapon" subtype="battle_axe" name="battle axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="30"
@@ -298,7 +298,7 @@
 
 <!-- Waechteraxt -->
 <Item type="weapon" subtype="guard_axe" name="guard axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="35"
@@ -335,7 +335,7 @@
 
 <!-- Minotaurenaxt -->
 <Item type="weapon" subtype="mino_axe" name="minotaur axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="40"
@@ -372,7 +372,7 @@
 
 <!-- Donneraxt -->
 <Item type="weapon" subtype="wind_axe" name="thunder axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="45"
@@ -411,7 +411,7 @@
 
 <!-- Daemonenaxt -->
 <Item type="weapon" subtype="demon_axe" name="demon axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="50"
@@ -448,7 +448,7 @@
 
 <!-- Obsidianaxt -->
 <Item type="weapon" subtype="obsid_axe" name="obsidian axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="55"
@@ -485,7 +485,7 @@
 
 <!-- Vulkanaxt -->
 <Item type="weapon" subtype="vulcan_axe" name="vulcano axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="60"
@@ -524,7 +524,7 @@
 
 <!-- Berserkeraxt -->
 <Item type="weapon" subtype="bersrk_axe" name="berserker axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="65"
@@ -561,7 +561,7 @@
 
 <!-- Diamantaxt -->
 <Item type="weapon" subtype="diamnt_axe" name="diamont axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="70"
@@ -598,7 +598,7 @@
 
 <!-- Zwergenaxt -->
 <Item type="weapon" subtype="dwarf_axe" name="dwarfen axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="75"
@@ -635,7 +635,7 @@
 
 <!-- Hoellenaxt -->
 <Item type="weapon" subtype="hell_axe" name="hell axe" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHatchet" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/axes2h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/axes2h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Holzfälleraxt -->
 <Item type="weapon" subtype="lumber_axe" name="lumberjack axe" size="big">
-	<Image image="set:lumber_axe.png image:full_image" />
+	<Image image="lumber_axe.png" />
 	<RenderInfo name = "lumberAxe" />
 	<Attribute
 		level_requirement="1"
@@ -40,7 +40,7 @@
 
 <!-- Großaxt-->
 <Item type="weapon" subtype="great_axe" name="great axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name = "greatAxe" />
 	<Attribute
 		level_requirement="3"
@@ -78,7 +78,7 @@
 
 <!-- Reißeraxt -->
 <Item type="weapon" subtype="riping_axe" name="ripping axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="5"
@@ -116,7 +116,7 @@
 
 <!-- Henkersaxt -->
 <Item type="weapon" subtype="execut_axe" name="executioner axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="10"
@@ -154,7 +154,7 @@
 
 <!-- Schmetteraxt -->
 <Item type="weapon" subtype="smash_axe" name="smashing axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="14"
@@ -192,7 +192,7 @@
 
 <!-- Ogerbeil -->
 <Item type="weapon" subtype="ogrhac_axe" name="ogre hatchet" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="18"
@@ -230,7 +230,7 @@
 
 <!-- Sensenaxt -->
 <Item type="weapon" subtype="scythe_axe" name="scythe axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="25"
@@ -268,7 +268,7 @@
 
 <!-- Barbarenstreitaxt -->
 <Item type="weapon" subtype="barbar_axe" name="barbarian axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="30"
@@ -306,7 +306,7 @@
 
 <!-- Knochenbrecher -->
 <Item type="weapon" subtype="bnebrk_axe" name="bonebreaker axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="35"
@@ -344,7 +344,7 @@
 
 <!-- Riesenaxt -->
 <Item type="weapon" subtype="giant_axe" name="giant axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="40"
@@ -382,7 +382,7 @@
 
 <!-- Schlachtaxt -->
 <Item type="weapon" subtype="slautr_axe" name="slaughter axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="45"
@@ -420,7 +420,7 @@
 
 <!-- Ogerreißer -->
 <Item type="weapon" subtype="ogrkil_axe" name="ogretearer" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="50"
@@ -458,7 +458,7 @@
 
 <!-- Zwergenstahlaxt -->
 <Item type="weapon" subtype="dwfstl_axe" name="dwarfensteel axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="55"
@@ -496,7 +496,7 @@
 
 <!-- Sternenaxt -->
 <Item type="weapon" subtype="star_axe" name="star axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="60"
@@ -534,7 +534,7 @@
 
 <!-- Königsaxt -->
 <Item type="weapon" subtype="king_axe" name="kings axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="65"
@@ -572,7 +572,7 @@
 
 <!-- Folteraxt -->
 <Item type="weapon" subtype="tortur_axe" name="torture axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="70"
@@ -610,7 +610,7 @@
 
 <!-- Eislandaxt -->
 <Item type="weapon" subtype="ice_axe" name="iceland axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="75"
@@ -650,7 +650,7 @@
 
 <!-- Todesaxt -->
 <Item type="weapon" subtype="death_axe" name="death axe" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<RenderInfo name= "greatAxe" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/glove.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/glove.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,7 +1,7 @@
 <!-- Lederhandschuhe -->
 <!-- WAR, PRI, ARC, MAG -->
 <Item type="gloves" subtype="leath_glv" name="leather gloves" size="medium">
-	<Image image="set:leath_glv.png image:full_image" />
+	<Image image="leath_glv.png" />
 	<RenderInfo name="leatherGloves" />
 	<Attribute
 		level_requirement="2"
@@ -33,7 +33,7 @@
 <!-- Schlangenlederhandschuhe -->
 <!-- PRI, MAG -->
 <Item type="gloves" subtype="snake_glv" name="snakehide gloves" size="medium">
-	<Image image="set:leath_glv.png image:full_image" />
+	<Image image="leath_glv.png" />
 	<RenderInfo name="leatherGloves" />
 	<Attribute
 		level_requirement="7"
@@ -65,7 +65,7 @@
 <!-- Kettenhandschuhe -->
 <!-- WAR, PRI -->
 <Item type="gloves" subtype="chain_glv" name="chain gloves" size="medium">
-	<Image image="set:plate_glv.png image:full_image" />
+	<Image image="plate_glv.png" />
 	<RenderInfo name="gloves" />
 	<Attribute
 		level_requirement="11"
@@ -97,7 +97,7 @@
 <!-- Wildlederhandschuhe -->
 <!-- WAR, PRI, ARC, MAG -->
 <Item type="gloves" subtype="bucskn_glv" name="buckskin gloves" size="medium">
-	<Image image="set:leath_glv.png image:full_image" />
+	<Image image="leath_glv.png" />
 	<RenderInfo name="leatherGloves" />
 	<Attribute
 		level_requirement="13"
@@ -129,7 +129,7 @@
 <!-- Spinnenseidehandschuhe -->
 <!-- MAG, PRI -->
 <Item type="gloves" subtype="spider_glv" name="spidersilk gloves" size="medium">
-	<Image image="set:leath_glv.png image:full_image" />
+	<Image image="leath_glv.png" />
 	<RenderInfo name="leatherGloves" />
 	<Attribute
 		level_requirement="15"
@@ -161,7 +161,7 @@
 <!-- Shuetzenhandschuhe -->
 <!-- ARC -->
 <Item type="gloves" subtype="marksm_glv" name="marksman gloves" size="medium">
-	<Image image="set:leath_glv.png image:full_image" />
+	<Image image="leath_glv.png" />
 	<RenderInfo name="leatherGloves" />
 	<Attribute
 		level_requirement="16"
@@ -193,7 +193,7 @@
 <!-- Assassinenhandschuhe -->
 <!-- WAR, ARC -->
 <Item type="gloves" subtype="assass_glv" name="assassin gloves" size="medium">
-	<Image image="set:shark_glv.png image:full_image" />
+	<Image image="shark_glv.png" />
 	<RenderInfo name="sharkGloves" />
 	<Attribute
 		level_requirement="18"
@@ -225,7 +225,7 @@
 <!-- Haifischhandschuhe -->
 <!-- WAR, PRI -->
 <Item type="gloves" subtype="shark_glv" name="shark gloves" size="medium">
-	<Image image="set:shark_glv.png image:full_image" />
+	<Image image="shark_glv.png" />
 	<RenderInfo name="sharkGloves" />
 	<Attribute
 		level_requirement="23"
--- a/share/data/items/goblinEqu.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/goblinEqu.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 <!-- WAR, PRI, ARC, MAG-->
 <!-- Zusaetzliches Mesh: gobLeg_arm.mesh -->
 <Item type="armor" subtype="goblin_arm" name="goblin armor" size="medium">
-	<Image image="set:gobLeg_Arm.png image:full_image" />
+	<Image image="gobLeg_Arm.png" />
 	<RenderInfo name="goblinArmor" />
 	<Attribute
 			level_requirement="3"
@@ -34,7 +34,7 @@
 <!-- Goblinarmschiene -->
 <!-- WAR, PRI, ARC, MAG -->
 <Item type="gloves" subtype="goblin_glv" name="goblin bracer" size="medium">
-	<Image image="set:goblin_glv.png image:full_image" />
+	<Image image="goblin_glv.png" />
 	<RenderInfo name = "goblinGloves"/>
 	<Attribute
 		level_requirement="2"
@@ -65,7 +65,7 @@
 
 <!-- Schamanenmaske -->
 <Item type="helmet" subtype="goblin_hlm" name="shaman mask" size="medium">
-	<Image image="set:goblin_hlm.png image:full_image" />
+	<Image image="goblin_hlm.png" />
 	<Mesh file="goblin_hlm.mesh" />
 	<Attribute
 			level_requirement="5"
@@ -98,7 +98,7 @@
 
 <!-- Goblin Keule -->
 <Item type="weapon" subtype="goblin_hmr" name="goblin club" size="medium">
-	<Image image="set:goblin_hmr.png image:full_image" />
+	<Image image="goblin_hmr.png" />
 	<RenderInfo name = "goblinClub" />
 	<Attribute
 		level_requirement="1"
@@ -136,7 +136,7 @@
 <!-- Rostiger Dolch-->
 <Item type="weapon" subtype="crude_sw" name="rusty dagger" size="medium">
 	<RenderInfo name = "rustyDagger" />
-	<Image image="set:crude_sw.png image:full_image" />
+	<Image image="crude_sw.png" />
 	<Attribute
 		level_requirement="1"
 		character_requirement="warrior,priest"
@@ -171,7 +171,7 @@
 
 <!-- Schamanenstab -->
 <Item type="weapon" subtype="goblin_stf" name="shaman staff" size="big">
-	<Image image="set:goblin_stf.png image:full_image" />
+	<Image image="goblin_stf.png" />
 	<Mesh file="goblin_stf.mesh" />
 	<Attribute
 			  level_requirement="12"
@@ -204,7 +204,7 @@
 
 <!-- Nagelkeule -->
 <Item type="weapon" subtype="nail_hmr" name="nail club" size="medium">
-	<Image image="set:nail_hmr.png image:full_image" />
+	<Image image="nail_hmr.png" />
 	<RenderInfo name = "nailClub" />
 	<Attribute
 		level_requirement="4"
@@ -242,7 +242,7 @@
 <!-- Goblinbogen -->
 <Item type="weapon" subtype="goblin_sbw" name="goblin bow" size="medium">
 	<Mesh file="goblin_sbw.mesh" />
-	<Image image="set:goblin_sbw.png image:full_image" />
+	<Image image="goblin_sbw.png" />
 	<Attribute
 		level_requirement="2"
 		character_requirement="archer"
@@ -277,7 +277,7 @@
 
 <!-- Goblinspeer -->
 <Item type="weapon" subtype="gobSpear_pol" name="goblin spear" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<Mesh file="gobSpear_pol.mesh" />
 	<Attribute
 		level_requirement="12"
--- a/share/data/items/hammer1h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/hammer1h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,7 +3,7 @@
 
 <!-- hammer -->
 <Item type="weapon" subtype="hammer_hmr" name="hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "hammer" />
 	<Attribute
 		level_requirement="1"
@@ -40,7 +40,7 @@
 
 <!-- Zeremonienhammer -->
 <Item type="weapon" subtype="cermon_hmr" name="cermeonial hammer" size="medium">
-	<Image image="set:cermon_hmr.png image:full_image" />
+	<Image image="cermon_hmr.png" />
 	<RenderInfo name = "ceremonialHammer" />
 	<Attribute
 			  level_requirement="3"
@@ -77,7 +77,7 @@
 
 <!-- Eisenhammer -->
 <Item type="weapon" subtype="iron_hmr" name="iron hammer" size="medium">
-	<Image image="set:iron_hmr.png image:full_image" />
+	<Image image="iron_hmr.png" />
 	<RenderInfo name = "ironHammer" />
 	<Attribute
 		level_requirement="5"
@@ -114,7 +114,7 @@
 
 <!-- Eisenbeschlagene Keule -->
 <Item type="weapon" subtype="iroclb_hmr" name="iron club" size="medium">
-	<Image image="set:iroclb_hmr.png image:full_image" />
+	<Image image="iroclb_hmr.png" />
 	<RenderInfo name = "ironClub" />
 	<Attribute
 		level_requirement="7"
@@ -151,7 +151,7 @@
 
 <!-- Schlaegel -->
 <Item type="weapon" subtype="maul_hmr" name="maul" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="8"
@@ -188,7 +188,7 @@
 
 <!-- Morgenstern -->
 <Item type="weapon" subtype="mrnstr_hmr" name="morning star" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="13"
@@ -225,7 +225,7 @@
 
 <!-- Kraehenkopf -->
 <Item type="weapon" subtype="crow_hmr" name="crowhead" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="19"
@@ -262,7 +262,7 @@
 
 <!-- Reiterhammer -->
 <Item type="weapon" subtype="rider_hmr" name="rider hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="25"
@@ -299,7 +299,7 @@
 
 <!-- Streitkolben -->
 <Item type="weapon" subtype="mace_hmr" name="mace" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="30"
@@ -336,7 +336,7 @@
 
 <!-- Stahlhammer -->
 <Item type="weapon" subtype="steel_hmr" name="steel hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="35"
@@ -373,7 +373,7 @@
 
 <!-- Kriegshammer -->
 <Item type="weapon" subtype="battle_hmr" name="battle hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="40"
@@ -410,7 +410,7 @@
 
 <!-- Schmetterkopf -->
 <Item type="weapon" subtype="smash_hmr" name="smashhead" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="45"
@@ -447,7 +447,7 @@
 
 <!-- Stahlstreitkolben -->
 <Item type="weapon" subtype="stlmce_hmr" name="steel mace" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="50"
@@ -484,7 +484,7 @@
 
 <!-- Stahlschlaegel -->
 <Item type="weapon" subtype="stlml_hmr" name="steel maul" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="55"
@@ -521,7 +521,7 @@
 
 <!-- Sechskantstreitkolben -->
 <Item type="weapon" subtype="mace6_hmr" name="sixedged mace" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="60"
@@ -558,7 +558,7 @@
 
 <!-- Silberhammer -->
 <Item type="weapon" subtype="silver_hmr" name="silver hammer" size="medium">
-	<Image image="set:axe.png image:full_image" />
+	<Image image="axe.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="65"
@@ -595,7 +595,7 @@
 
 <!-- Diamanthammer -->
 <Item type="weapon" subtype="diamnt_hmr" name="diamont hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 			  level_requirement="70"
@@ -632,7 +632,7 @@
 
 <!-- Priesterstreitkolben -->
 <Item type="weapon" subtype="prsmce_hmr" name="priest mace" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="75"
@@ -669,7 +669,7 @@
 
 <!-- Heiliger Hammer -->
 <Item type="weapon" subtype="holy_hmr" name="holy hammer" size="medium">
-	<Image image="set:hammer.png image:full_image" />
+	<Image image="hammer.png" />
 	<RenderInfo name= "ironHammer" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/hammer2h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/hammer2h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Vorschlaghammer -->
 <Item type="weapon" subtype="sledge_hmr" name="sledgehammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name = "sledgeHammer" />
 	<Attribute
 		level_requirement="1"
@@ -40,7 +40,7 @@
 
 <!-- Bronzehammer -->
 <Item type="weapon" subtype="bronze_hmr" name="bronze hammer" size="big">
-	<Image image="set:bronze_hmr.png image:full_image" />
+	<Image image="bronze_hmr.png" />
 	<RenderInfo name = "bronzeHammer" />
 	<Attribute
 		level_requirement="3"
@@ -78,7 +78,7 @@
 
 <!-- Langstiel -->
 <Item type="weapon" subtype="long_hmr" name="longshaft" size="big">
-	<Image image="set:long_hmr.png image:full_image" />
+	<Image image="long_hmr.png" />
 	<RenderInfo name = "longshaft" />
 	<Attribute
 		level_requirement="5"
@@ -117,7 +117,7 @@
 
 <!-- Waechterhammer -->
 <Item type="weapon" subtype="guard_hmr" name="guard hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="8"
@@ -156,7 +156,7 @@
 
 <!-- Silberschrecken -->
 <Item type="weapon" subtype="silverTerror_hmr" name="silverterror" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="13"
@@ -195,7 +195,7 @@
 
 <!-- Glimmhammer -->
 <Item type="weapon" subtype="glow_hmr" name="glow hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="17"
@@ -236,7 +236,7 @@
 
 <!-- Knochenbrecher -->
 <Item type="weapon" subtype="bone_hmr" name="bonebreaker" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="25"
@@ -274,7 +274,7 @@
 
 <!-- Truemmerkopf -->
 <Item type="weapon" subtype="crash_hmr" name="crashhead" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="30"
@@ -312,7 +312,7 @@
 
 <!-- Aisen Kriegshammer -->
 <Item type="weapon" subtype="aisen_hmr" name="aisener warhammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="35"
@@ -351,7 +351,7 @@
 
 <!-- Urteilshammer -->
 <Item type="weapon" subtype="jugmnt_hmr" name="judgement hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="40"
@@ -390,7 +390,7 @@
 
 <!-- Priesterhammer -->
 <Item type="weapon" subtype="priest_hmr" name="priest hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="45"
@@ -429,7 +429,7 @@
 
 <!-- Obsidianhammer -->
 <Item type="weapon" subtype="obsid_hmr" name="obsidian hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="50"
@@ -468,7 +468,7 @@
 
 <!-- Richthammer -->
 <Item type="weapon" subtype="judge_hmr" name="judge hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="55"
@@ -507,7 +507,7 @@
 
 <!-- Zyklopenhammer -->
 <Item type="weapon" subtype="cyclps_hmr" name="cyclops hammer" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<Mesh file="battleaxe.mesh" />
 	<Attribute
 		level_requirement="60"
@@ -545,7 +545,7 @@
 
 <!-- Zwergenstahlhammer -->
 <Item type="weapon" subtype="dwfstl_hmr" name="dwarfensteel hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="65"
@@ -584,7 +584,7 @@
 
 <!-- Elementenjaeger -->
 <Item type="weapon" subtype="elem_hmr" name="elementhunter" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="70"
@@ -623,7 +623,7 @@
 
 <!-- Exorzistenhammer -->
 <Item type="weapon" subtype="exocis_hmr" name="exorcists hammer" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="75"
@@ -662,7 +662,7 @@
 
 <!-- Welterschuetterer -->
 <Item type="weapon" subtype="world_hmr" name="worldshaker" size="big">
-	<Image image="set:sledgehammer.png image:full_image" />
+	<Image image="sledgehammer.png" />
 	<RenderInfo name= "sledgeHammer" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/hat.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/hat.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Vagabundenhut -->
 <Item type="helmet" subtype="vag_hat" name="vagabond hat" size="medium">
-	<Image image="set:peasent_hat.png image:full_image" />
+	<Image image="peasent_hat.png" />
 	<RenderInfo name="peasentHat" />
 	<Attribute
 			level_requirement="1"
@@ -34,7 +34,7 @@
 
 <!-- Lehrlingskappe -->
 <Item type="helmet" subtype="prentc_hat" name="apprentice cap" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<RenderInfo name="vagabondHat" />
 	<Attribute
 			level_requirement="3"
@@ -67,7 +67,7 @@
 
 <!-- Novizenhut -->
 <Item type="helmet" subtype="novice_hat" name="novice hat" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<RenderInfo name="vagabondHat" />
 	<Attribute
 			level_requirement="5"
@@ -100,7 +100,7 @@
 
 <!-- Alchemistenkappe -->
 <Item type="helmet" subtype="alch_hat" name="alchemist cap" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<RenderInfo name="vagabondHat" />
 	<Attribute
 			level_requirement="8"
@@ -134,7 +134,7 @@
 
 <!-- Barett -->
 <Item type="helmet" subtype="beret_hat" name="beret" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<RenderInfo name="vagabondHat" />
 	<Attribute
 			level_requirement="13"
@@ -167,7 +167,7 @@
 
 <!-- Magierhut -->
 <Item type="helmet" subtype="mage_hat" name="magus hat" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<RenderInfo name="vagabondHat" />
 	<Attribute
 			level_requirement="19"
@@ -201,7 +201,7 @@
 
 <!-- Konzilsturban -->
 <Item type="helmet" subtype="turban_hat" name="turban" size="medium">
-	<Image image="set:vag_hat.png image:full_image" />
+	<Image image="vag_hat.png" />
 	<Mesh file="turban_hat.mesh" />
 	<Attribute
 			level_requirement="22"
--- a/share/data/items/helmet.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/helmet.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,7 +1,7 @@
 <!-- Kappe -->
 <!-- WAR, PRI, ARC, MAG -->
 <Item type="helmet" subtype="cap_hlm" name="cap" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="1"
@@ -32,7 +32,7 @@
 <!-- Lederkappe -->
 <!-- WAR, PRI, ARC, MAG -->
 <Item type="helmet" subtype="lthcap_hlm" name="leather cap" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="3"
@@ -63,7 +63,7 @@
 <!-- Lederhelm -->
 <!-- WAR, PRI, ARC -->
 <Item type="helmet" subtype="leath_hlm" name="leather helmet" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="5"
@@ -94,7 +94,7 @@
 <!-- Soeldnerkopf -->
 <!-- WAR, ARC --><!-- abschreckende Maske um Furcht bei Feinden zu verursachen -->
 <Item type="helmet" subtype="merchd_hlm" name="mercenary head" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="8"
@@ -125,7 +125,7 @@
 <!-- Novizenhelm -->
 <!-- PRI -->
 <Item type="helmet" subtype="novice_hlm" name="novice headgear" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="8"
@@ -156,7 +156,7 @@
 <!-- Soeldnerhelm -->
 <!-- WAR, PRI -->
 <Item type="helmet" subtype="merc_hlm" name="mercenary helmet" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="13"
@@ -187,7 +187,7 @@
 <!-- Waldlaeuferstirband -->
 <!-- ARC -->
 <Item type="helmet" subtype="rngbnd_hlm" name="ranger bandana" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="13"
@@ -218,7 +218,7 @@
 <!-- Assasssinenkapuze -->
 <!-- WAR, ARC -->
 <Item type="helmet" subtype="assass_hlm" name="assassin hood" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="19"
@@ -249,7 +249,7 @@
 <!-- Birett -->
 <!-- PRI -->
 <Item type="helmet" subtype="birett_hlm" name="biretta" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="merc_hlm" />
 	<Attribute
 		level_requirement="19"
@@ -280,7 +280,7 @@
 <!-- Kettenturban -->
 <!-- WAR, PRI, ARC -->
 <Item type="helmet" subtype="turban_hlm" name="chain turban" size="medium">
-	<Image image="set:merc_hlm.png image:full_image" />
+	<Image image="merc_hlm.png" />
 	<Mesh file="turban_hlm.mesh" />
 	<Attribute
 		level_requirement="23"
--- a/share/data/items/items.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/items.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -143,7 +143,7 @@
 
 <!-- general
 <Item type="weapon" subtype="short_sw" name="string" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<Mesh file="sword.mesh" />
 	<Attribute
 		level_requirement="char"
--- a/share/data/items/longbow.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/longbow.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,7 +3,7 @@
 <!-- Turnierbogen -->
 <Item type="weapon" subtype="turney_lbw" name="tourney bow" size="big">
 	<RenderInfo name="turneyLongbow" />
-	<Image image="set:turney_lbw.png image:full_image" />
+	<Image image="turney_lbw.png" />
 	<Attribute
 		level_requirement="1"
 		character_requirement="archer"
@@ -40,7 +40,7 @@
 <!-- Orkbogen -->
 <Item type="weapon" subtype="orc_lbw" name="orc bow" size="big">
 	<RenderInfo name="turneyLongbow" />
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<Attribute
 		level_requirement="3"
 		character_requirement="archer"
@@ -77,7 +77,7 @@
 <!-- Eibenbogen -->
 <Item type="weapon" subtype="yew_lbw" name="yew bow" size="big">
 	<RenderInfo name="turneyLongbow" />
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<Attribute
 		level_requirement="6"
 		character_requirement="archer"
@@ -113,7 +113,7 @@
 
 <!-- Langbogen -->
 <Item type="weapon" subtype="long_lbw" name="longbow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="8"
@@ -150,7 +150,7 @@
 
 <!-- Soldatenbogen -->
 <Item type="weapon" subtype="soldr_lbw" name="soldier bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="14"
@@ -187,7 +187,7 @@
 
 <!-- Hornbogen -->
 <Item type="weapon" subtype="horn_lbw" name="horn bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="19"
@@ -224,7 +224,7 @@
 
 <!-- Ahornbogen -->
 <Item type="weapon" subtype="maple_lbw" name="maple bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="25"
@@ -261,7 +261,7 @@
 
 <!-- Kriegsbogen -->
 <Item type="weapon" subtype="battle_lbw" name="battle bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="30"
@@ -298,7 +298,7 @@
 
 <!-- Kompositlangbogen -->
 <Item type="weapon" subtype="compst_lbw" name="composite longbow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="35"
@@ -335,7 +335,7 @@
 
 <!-- Sturmsaenger -->
 <Item type="weapon" subtype="wind_lbw" name="stormsinger" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="40"
@@ -374,7 +374,7 @@
 
 <!-- Eichenbogen -->
 <Item type="weapon" subtype="oak_lbw" name="oak bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="45"
@@ -411,7 +411,7 @@
 
 <!-- Daemonenhornbogen -->
 <Item type="weapon" subtype="demhrn_lbw" name="demonhorn bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="50"
@@ -448,7 +448,7 @@
 
 <!-- Waldlaeuferbogen -->
 <Item type="weapon" subtype="ranger_lbw" name="ranger bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="55"
@@ -486,7 +486,7 @@
 
 <!-- Eschenlangbogen -->
 <Item type="weapon" subtype="ash_lbw" name="ash longbow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="60"
@@ -524,7 +524,7 @@
 
 <!-- Engelsbogen -->
 <Item type="weapon" subtype="angel_lbw" name="soul bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="65"
@@ -561,7 +561,7 @@
 
 <!-- Daemonenkompositbogen -->
 <Item type="weapon" subtype="demon_lbw" name="demon compositebow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="70"
@@ -598,7 +598,7 @@
 
 <!-- Heldenbogen -->
 <Item type="weapon" subtype="hero_lbw" name="hero bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="75"
@@ -635,7 +635,7 @@
 
 <!-- Elfenbogen -->
 <Item type="weapon" subtype="elf_lbw" name="elf bow" size="big">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="turneyLongbow" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/polearms.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/polearms.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,6 +1,6 @@
 <!-- Pike -->
 <Item type="weapon" subtype="pike_pol" name="pike" size="big">
-	<Image image="set:axe2H.png image:full_image" />
+	<Image image="axe2H.png" />
 	<Mesh file="pike_pol.mesh" />
 	<Attribute
 		level_requirement="8"
--- a/share/data/items/potion.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/potion.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,6 +1,6 @@
 <!-- POTION -->
 <Item type="potion" subtype="town_portal" name="scroll of town portal" size="small" consumable="true">
-	<Image image="set:voidScroll.png image:full_image" />
+	<Image image="voidScroll.png" />
 	<Mesh file="townPortalScroll.mesh" />
 	<Attribute
 			  character_requirement="all"
@@ -14,7 +14,7 @@
 
 <!-- small potion -->
 <Item type="potion" subtype="heal_1" name="small potion" size="small" consumable="true" consume_timer_nr="8" consume_timer="5000" >
-	<Image image="set:potion_health.png image:full_image" />
+	<Image image="potion_health.png" />
 	<RenderInfo name="potion" />
 	<Attribute
 		character_requirement="all"
@@ -34,7 +34,7 @@
 
 <!-- medium potion -->
 <Item type="potion" subtype="heal_2" name="medium potion" size="small" consumable="true" consume_timer_nr="8" consume_timer="5000" >
-	<Image image="set:heal_2.png image:full_image" />
+	<Image image="heal_2.png" />
 	<RenderInfo name="mediumPotion" />
 	<Attribute
 		character_requirement="all"
@@ -54,7 +54,7 @@
 
 <!-- anti blind-->
 <Item type="potion" subtype="heal_bl" name="eyedrops" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_bl.png image:full_image" />
+	<Image image="heal_bl.png" />
 	<RenderInfo name="antiBlind" />
 	<Attribute
 		character_requirement="all"
@@ -74,7 +74,7 @@
 
 <!-- anti poison-->
 <Item type="potion" subtype="heal_ps" name="antidot" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_ps.png image:full_image" />
+	<Image image="heal_ps.png" />
 	<RenderInfo name="antiPoison" />
 	<Attribute
 		character_requirement="all"
@@ -94,7 +94,7 @@
 
 <!-- anti berserk -->
 <Item type="potion" subtype="heal_br" name="calming salve" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_br.png image:full_image" />
+	<Image image="heal_br.png" />
 	<RenderInfo name="antiBerserk" />
 	<Attribute
 		character_requirement="all"
@@ -114,7 +114,7 @@
 
 <!-- anti confuse -->
 <Item type="potion" subtype="heal_cf" name="potion of determination" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_cf.png image:full_image" />
+	<Image image="heal_cf.png" />
 	<RenderInfo name="antiConfuse" />
 	<Attribute
 		character_requirement="all"
@@ -134,7 +134,7 @@
 
 <!-- anti mute -->
 <Item type="potion" subtype="heal_mt" name="echo potion" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_mt.png image:full_image" />
+	<Image image="heal_mt.png" />
 	<RenderInfo name="antiMute" />
 	<Attribute
 		character_requirement="all"
@@ -154,7 +154,7 @@
 
 <!-- anti paralyse -->
 <Item type="potion" subtype="heal_py" name="muscle salve" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_py.png image:full_image" />
+	<Image image="heal_py.png" />
 	<RenderInfo name="antiParalyze" />
 	<Attribute
 		character_requirement="all"
@@ -174,7 +174,7 @@
 
 <!-- anti freeze -->
 <Item type="potion" subtype="heal_fr" name="potion of melting" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_fr.png image:full_image" />
+	<Image image="heal_fr.png" />
 	<RenderInfo name="antiFreeze" />
 	<Attribute
 		character_requirement="all"
@@ -194,7 +194,7 @@
 
 <!-- anti burn -->
 <Item type="potion" subtype="heal_bu" name="spike oil" size="small" consumable="true" consume_timer_nr="7" consume_timer="2000" >
-	<Image image="set:heal_bu.png image:full_image" />
+	<Image image="heal_bu.png" />
 	<RenderInfo name="antiBurn" />
 	<Attribute
 		character_requirement="all"
--- a/share/data/items/ring.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/ring.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Bronzering -->
 <Item type="ring" subtype="bronze_rng" name="bronze ring" size="small">
-	<Image image="set:bronze_rng.png image:full_image" />
+	<Image image="bronze_rng.png" />
 	<Mesh file="bronze_rng" />
 	<Attribute
 		level_requirement="2"
@@ -31,7 +31,7 @@
 
 <!-- Bernsteinring -->
 <Item type="ring" subtype="amber_rng" name="amber ring" size="small">
-	<Image image="set:bronze_rng.png image:full_image" />
+	<Image image="bronze_rng.png" />
 	<Mesh file="bronze_rng" />
 	<Attribute
 		level_requirement="4"
@@ -60,7 +60,7 @@
 
 <!-- Silberring -->
 <Item type="ring" subtype="silver_rng" name="silver ring" size="small">
-	<Image image="set:silver_rng.png image:full_image" />
+	<Image image="silver_rng.png" />
 	<Mesh file="silver_rng" />
 	<Attribute
 		level_requirement="7"
@@ -89,7 +89,7 @@
 
 <!-- Jettring (schwarzer stein) -->
 <Item type="ring" subtype="jet_rng" name="jet ring" size="small">
-	<Image image="set:bronze_rng.png image:full_image" />
+	<Image image="bronze_rng.png" />
 	<Mesh file="silver_rng" />
 	<Attribute
 		level_requirement="13"
@@ -118,7 +118,7 @@
 
 <!-- Goldring -->
 <Item type="ring" subtype="gold_rng" name="gold ring" size="small">
-	<Image image="set:gold_rng.png image:full_image" />
+	<Image image="gold_rng.png" />
 	<Mesh file="gold_rng" />
 	<Attribute
 		level_requirement="21"
--- a/share/data/items/robes.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/robes.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Flickenrobe -->
 <Item type="armor" subtype="rag_rob" name="ragged robe" size="medium">
-	<Image image="set:rag_rob.png image:full_image" />
+	<Image image="rag_rob.png" />
 	<RenderInfo name="robeSimple" />
 	<Attribute
 			level_requirement="1"
@@ -36,7 +36,7 @@
 
 <!-- Lehrlingsrobe -->
 <Item type="armor" subtype="prentc_rob" name="apprentice robe" size="medium">
-	<Image image="set:rag_rob.png image:full_image" />
+	<Image image="rag_rob.png" />
 	<RenderInfo name="robeSimple" />
 	<Attribute
 			level_requirement="3"
@@ -70,7 +70,7 @@
 
 <!-- Novizenrobe -->
 <Item type="armor" subtype="novice_rob" name="novice robe" size="medium">
-	<Image image="set:novice_rob.png image:full_image" />
+	<Image image="novice_rob.png" />
 	<RenderInfo name="robeNovice" />
 	<Attribute
 			level_requirement="5"
@@ -104,7 +104,7 @@
 
 <!-- Alchemistenrobe -->
 <Item type="armor" subtype="alch_rob" name="alchemist robe" size="medium">
-	<Image image="set:council_rob.png image:full_image" />
+	<Image image="council_rob.png" />
 	<RenderInfo name="counclRob" />
 	<Attribute
 			level_requirement="8"
@@ -138,7 +138,7 @@
 
 <!-- Gelehrtenrobe -->
 <Item type="armor" subtype="sholar_rob" name="scholar robe" size="medium">
-	<Image image="set:necromancer_robe.png image:full_image" />
+	<Image image="necromancer_robe.png" />
 	<RenderInfo name="necromancerRobe" />
 	<Attribute
 			level_requirement="13"
@@ -172,7 +172,7 @@
 
 <!-- Magierrobe -->
 <Item type="armor" subtype="mage_rob" name="magus robe" size="medium">
-	<Image image="set:novice_rob.png image:full_image" />
+	<Image image="novice_rob.png" />
 	<RenderInfo name="robeNovice" />
 	<Attribute
 			level_requirement="19"
@@ -206,7 +206,7 @@
 
 <!-- Konzilsrobe -->
 <Item type="armor" subtype="councl_rob" name="council robe" size="medium">
-	<Image image="set:council_rob.png image:full_image" />
+	<Image image="council_rob.png" />
 	<Mesh file="counclRob" />
 	<Attribute
 			level_requirement="27"
--- a/share/data/items/shields.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/shields.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Tartsche -->
 <Item type="shield" subtype="targe_shd" name="targe" size="medium">
-	 <Image image="set:shield.png image:full_image" />
+	 <Image image="shield.png" />
 	<Mesh file="shield" />
 	<Attribute
 		level_requirement="1"
@@ -32,7 +32,7 @@
 
 <!-- Buckler 3-->
 <Item type="shield" subtype="buck_shd" name="buckler" size="medium">
-	 <Image image="set:shield.png image:full_image" />
+	 <Image image="shield.png" />
 	<Mesh file="shield" />
 	<Attribute
 		level_requirement="3"
@@ -62,7 +62,7 @@
 
 <!-- Holzschild 5 XX-->
 <Item type="shield" subtype="wood_shd" name="wood shield" size="medium">
-	 <Image image="set:shield.png image:full_image" />
+	 <Image image="shield.png" />
 	<Mesh file="wood_shd" />
 	<Attribute
 		level_requirement="5"
@@ -92,7 +92,7 @@
 
 <!-- Bronzeschild 8-->
 <Item type="shield" subtype="bronze_shd" name="bronze shield" size="medium">
-	<Image image="set:metal_shd.png image:full_image" />
+	<Image image="metal_shd.png" />
 	<Mesh file="metal_shd" />
 	<Attribute
 		level_requirement="8"
@@ -122,7 +122,7 @@
 
 <!-- Eisenschild 13 XX-->
 <Item type="shield" subtype="iron_shd" name="iron shield" size="medium">
-	<Image image="set:metal_shd.png image:full_image" />
+	<Image image="metal_shd.png" />
 	<Mesh file="metal_shd" />
 	<Attribute
 		level_requirement="13"
@@ -152,7 +152,7 @@
 
 <!-- Stahlschild 19-->
 <Item type="shield" subtype="steel_shd" name="steel shield" size="medium">
-	<Image image="set:metal_shd.png image:full_image" />
+	<Image image="metal_shd.png" />
 	<Mesh file="metal_shd" />
 	<Attribute
 		level_requirement="19"
--- a/share/data/items/shortbow.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/shortbow.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,7 +3,7 @@
 <!-- Uebungsbogen -->
 <Item type="weapon" subtype="pract_sbw" name="practice bow" size="medium">
 	<RenderInfo name="practiceBow" />
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<Attribute
 		level_requirement="1"
 		character_requirement="archer"
@@ -39,7 +39,7 @@
 <!-- Eibenkurzbogen -->
 <Item type="weapon" subtype="yew_sbw" name="yew shortbow" size="medium">
 	<RenderInfo name="practiceBow" />
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<Attribute
 		level_requirement="3"
 		character_requirement="archer"
@@ -75,7 +75,7 @@
 <!-- Kurzbogen -->
 <Item type="weapon" subtype="short_sbw" name="shortbow" size="medium">
 	<RenderInfo name="practiceBow" />
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<Attribute
 		level_requirement="5"
 		character_requirement="archer"
@@ -110,7 +110,7 @@
 
 <!-- Jagdbogen -->
 <Item type="weapon" subtype="hunter_sbw" name="hunting bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="8"
@@ -147,7 +147,7 @@
 
 <!-- Rattanbogen -->
 <Item type="weapon" subtype="rattan_sbw" name="rattan bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="12"
@@ -183,7 +183,7 @@
 
 <!-- Banditenbogen -->
 <Item type="weapon" subtype="bandit_sbw" name="bandit bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="17"
@@ -219,7 +219,7 @@
 
 <!-- Nordauge -->
 <Item type="weapon" subtype="ice_sbw" name="northeye" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="23"
@@ -257,7 +257,7 @@
 
 <!-- Kriegskurzbogen -->
 <Item type="weapon" subtype="battle_sbw" name="battle shortbow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="30"
@@ -293,7 +293,7 @@
 
 <!-- Kompositbogen -->
 <Item type="weapon" subtype="compst_sbw" name="composite shortbow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="35"
@@ -329,7 +329,7 @@
 
 <!-- Reiterbogen -->
 <Item type="weapon" subtype="rider_sbw" name="rider bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="40"
@@ -365,7 +365,7 @@
 
 <!-- Kohlebogen -->
 <Item type="weapon" subtype="coal_sbw" name="coal bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="45"
@@ -401,7 +401,7 @@
 
 <!-- Eschenbogen -->
 <Item type="weapon" subtype="ash_sbw" name="ash bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="50"
@@ -438,7 +438,7 @@
 
 <!-- Fluchbogen -->
 <Item type="weapon" subtype="bane_sbw" name="bane bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="55"
@@ -475,7 +475,7 @@
 
 <!-- Eichenkurzbogen -->
 <Item type="weapon" subtype="oak_sbw" name="oak shortbow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="60"
@@ -511,7 +511,7 @@
 
 <!-- Seelenbogen -->
 <Item type="weapon" subtype="soul_sbw" name="soul bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="65"
@@ -547,7 +547,7 @@
 
 <!-- Sucher -->
 <Item type="weapon" subtype="seeker_sbw" name="seeker" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="70"
@@ -583,7 +583,7 @@
 
 <!-- Chaosbogen -->
 <Item type="weapon" subtype="chaos_sbw" name="chaos shortbow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="75"
@@ -619,7 +619,7 @@
 
 <!-- Feenbogen -->
 <Item type="weapon" subtype="fairy_sbw" name="fairy bow" size="medium">
-	<Image image="set:bow.png image:full_image" />
+	<Image image="bow.png" />
 	<RenderInfo name="practiceBow" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/staff.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/staff.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Fichtenstab -->
 <Item type="weapon" subtype="spruce_stf_fire" name="spruce staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="spruce_stf" />
 	<Attribute
 			  level_requirement="1"
@@ -33,7 +33,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="spruce_stf_air" name="spruce staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="spruce_stf" />
 	<Attribute
 			  level_requirement="1"
@@ -64,7 +64,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="spruce_stf_ice" name="spruce staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="spruce_stf" />
 	<Attribute
 			  level_requirement="1"
@@ -97,7 +97,7 @@
 
 <!-- Lehrlingsstab -->
 <Item type="weapon" subtype="prntc_stf_fire" name="apprentice staff" size="big">
-	<Image image="set:aprnt_stf.png image:full_image" />
+	<Image image="aprnt_stf.png" />
 	<Mesh file="aprnt_stf" />
 	<Attribute
 			  level_requirement="3"
@@ -128,7 +128,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="prntc_stf_air" name="apprentice staff" size="big">
-	<Image image="set:aprnt_stf.png image:full_image" />
+	<Image image="aprnt_stf.png" />
 	<Mesh file="aprnt_stf" />
 	<Attribute
 			  level_requirement="3"
@@ -159,7 +159,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="prntc_stf_ice" name="apprentice staff" size="big">
-	<Image image="set:aprnt_stf.png image:full_image" />
+	<Image image="aprnt_stf.png" />
 	<Mesh file="aprnt_stf" />
 	<Attribute
 			  level_requirement="3"
@@ -192,7 +192,7 @@
 
 <!-- Novizenstab -->
 <Item type="weapon" subtype="novice_stf_fire" name="novice staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="5"
@@ -222,7 +222,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="novice_stf_air" name="novice staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="5"
@@ -253,7 +253,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="novice_stf_ice" name="novice staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="5"
@@ -286,7 +286,7 @@
 
 <!-- Eremitenstab -->
 <Item type="weapon" subtype="hermit_stf_fire" name="hermit staff" size="big">
-	<Image image="set:hermit_stf.png image:full_image" />
+	<Image image="hermit_stf.png" />
 	<Mesh file="hermit_stf" />
 	<Attribute
 			  level_requirement="7"
@@ -317,7 +317,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="hermit_stf_air" name="hermit staff" size="big">
-	<Image image="set:hermit_stf.png image:full_image" />
+	<Image image="hermit_stf.png" />
 	<Mesh file="hermit_stf" />
 	<Attribute
 			  level_requirement="7"
@@ -348,7 +348,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="hermit_stf_ice" name="hermit staff" size="big">
-	<Image image="set:hermit_stf.png image:full_image" />
+	<Image image="hermit_stf.png" />
 	<Mesh file="hermit_stf" />
 	<Attribute
 			  level_requirement="7"
@@ -380,7 +380,7 @@
 
 <!-- Felsstab -->
 <Item type="weapon" subtype="rock_stf" name="rock staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="8"
@@ -417,7 +417,7 @@
 
 <!-- Erlenstab -->
 <Item type="weapon" subtype="alder_stf_fire" name="alder staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="13"
@@ -448,7 +448,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="alder_stf_air" name="alder staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="13"
@@ -479,7 +479,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="alder_stf_ice" name="alder staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="13"
@@ -512,7 +512,7 @@
 
 <!-- Bardenstab -->
 <Item type="weapon" subtype="bard_stf_fire" name="bard's staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="15"
@@ -543,7 +543,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="bard_stf_air" name="bard's staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="15"
@@ -574,7 +574,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="bard_stf_ice" name="bard's staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="15"
@@ -607,7 +607,7 @@
 
 <!-- Magierstab -->
 <Item type="weapon" subtype="magus_stf_fire" name="magus staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="18"
@@ -637,7 +637,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="magus_stf_air" name="magus staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="18"
@@ -668,7 +668,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="magus_stf_ice" name="magus staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="18"
@@ -701,7 +701,7 @@
 
 <!-- Silberstab -->
 <Item type="weapon" subtype="silver_stf_fire" name="silver staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="23"
@@ -732,7 +732,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="silver_stf_air" name="silver staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="23"
@@ -763,7 +763,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="silver_stf_ice" name="silver staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="23"
@@ -795,7 +795,7 @@
 
 <!-- Infernostab -->
 <Item type="weapon" subtype="inferno_stf" name="inferno staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="26"
@@ -827,7 +827,7 @@
 
 <!-- Eichenstab -->
 <Item type="weapon" subtype="oak_stf" name="oak staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="30"
@@ -859,7 +859,7 @@
 
 <!-- Phoenixstab -->
 <Item type="weapon" subtype="phenix_stf" name="phenix staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="35"
@@ -891,7 +891,7 @@
 
 <!-- Froststab -->
 <Item type="weapon" subtype="frost_stf" name="frost staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="40"
@@ -923,7 +923,7 @@
 
 <!-- Gewitterstab -->
 <Item type="weapon" subtype="thundr_stf" name="thunder staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="45"
@@ -955,7 +955,7 @@
 
 <!-- Eschenstab -->
 <Item type="weapon" subtype="ash_stf" name="ash staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="50"
@@ -987,7 +987,7 @@
 
 <!-- Beschwoererstab -->
 <Item type="weapon" subtype="sumonr_stf" name="summoner staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="55"
@@ -1019,7 +1019,7 @@
 
 <!-- Magisterstab -->
 <Item type="weapon" subtype="master_stf" name="master staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="60"
@@ -1051,7 +1051,7 @@
 
 <!-- Nekromantenstab -->
 <Item type="weapon" subtype="necro_stf" name="necromancer staff" size="big">
-	<Image image="set:necro_stf.png image:full_image" />
+	<Image image="necro_stf.png" />
 	<Mesh file="necro_stf" />
 	<Attribute
 			  level_requirement="65"
@@ -1083,7 +1083,7 @@
 
 <!-- Daemonenstab -->
 <Item type="weapon" subtype="demon_stf" name="demon staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="70"
@@ -1115,7 +1115,7 @@
 
 <!-- Feenstab -->
 <Item type="weapon" subtype="fairy_stf" name="fairy staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="75"
@@ -1151,7 +1151,7 @@
 
 <!-- Ifreetstab -->
 <Item type="weapon" subtype="ifreet_stf" name="ifreet staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="75"
@@ -1183,7 +1183,7 @@
 
 <!-- Eishexenstab -->
 <Item type="weapon" subtype="icewitch_stf" name="icewitch staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="75"
@@ -1215,7 +1215,7 @@
 
 <!-- Sylphenstab -->
 <Item type="weapon" subtype="sylph_stf" name="sylph staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="75"
@@ -1248,7 +1248,7 @@
 
 <!-- Erzmagierstab -->
 <Item type="weapon" subtype="arcmag_stf" name="archmage staff" size="big">
-	<Image image="set:spruce_stf.png image:full_image" />
+	<Image image="spruce_stf.png" />
 	<Mesh file="basicStaff" />
 	<Attribute
 			  level_requirement="80"
--- a/share/data/items/swords1h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/swords1h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -4,7 +4,7 @@
 <!-- Dagger -->
 <Item type="weapon" subtype="dagger_sw" name="dagger" size="medium">
 	<RenderInfo name = "dagger"/>
-	<Image image="set:dagger_sw.png image:full_image" />
+	<Image image="dagger_sw.png" />
 	<Attribute
 		level_requirement="1"
 		character_requirement="warrior,priest"
@@ -40,7 +40,7 @@
 <!-- Short Sword -->
 <Item type="weapon" subtype="short_sw" name="shortsword" size="medium">
 	<RenderInfo name = "shortSword"/>
-	<Image image="set:short_sw.png image:full_image" />
+	<Image image="short_sw.png" />
 	<Attribute
 		level_requirement="3"
 		character_requirement="warrior"
@@ -76,7 +76,7 @@
 <!-- Bronze Sword -->
 <Item type="weapon" subtype="bronze_sw" name="bronzesword" size="medium">
 	<RenderInfo name = "bronzeSword"/>
-	<Image image="set:bronze_sw.png image:full_image" />
+	<Image image="bronze_sw.png" />
 	<Attribute
 		level_requirement="5"
 		character_requirement="warrior"
@@ -111,7 +111,7 @@
 
 <!-- -Sabre -->
 <Item type="weapon" subtype="sabre_sw" name="sabre" size="medium">
-	<Image image="set:sabre_sw.png image:full_image" />
+	<Image image="sabre_sw.png" />
 	<RenderInfo name="sabre" />
 	<Attribute
 		level_requirement="8"
@@ -149,7 +149,7 @@
 
 <!-- Legions Blade-->
 <Item type="weapon" subtype="legion_sw" name="legion blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="legionBlade" />
 	<Attribute
 		level_requirement="13"
@@ -185,7 +185,7 @@
 
 <!-- long sword  -->
 <Item type="weapon" subtype="long_sw" name="long sword" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="19"
@@ -221,7 +221,7 @@
 
 <!-- coastal sword-->
 <Item type="weapon" subtype="coast_sw" name="sword of the coast" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="25"
@@ -257,7 +257,7 @@
 
 <!-- council sabre-->
 <Item type="weapon" subtype="council_sw" name="council sabre" size="medium">
-	<Image image="set:council_sw.png image:full_image" />
+	<Image image="council_sw.png" />
 	<RenderInfo name="councilSabre"/>
 	<Attribute
 		level_requirement="25"
@@ -293,7 +293,7 @@
 
 <!-- scimitar-->
 <Item type="weapon" subtype="scimita_sw" name="scimitar" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="30"
@@ -329,7 +329,7 @@
 
 <!-- barbar sword-->
 <Item type="weapon" subtype="barbar_sw" name="barbarian sword" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="35"
@@ -365,7 +365,7 @@
 
 <!-- northlings blade -->
 <Item type="weapon" subtype="northli_sw" name="northlings blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="40"
@@ -403,7 +403,7 @@
 
 <!-- steel sword-->
 <Item type="weapon" subtype="steel_sw" name="steel sword" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="45"
@@ -439,7 +439,7 @@
 
 <!-- assassins blade-->
 <Item type="weapon" subtype="assassi_sw" name="assassins blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="50"
@@ -475,7 +475,7 @@
 
 <!-- diamond sword-->
 <Item type="weapon" subtype="diamond_sw" name="diamont sword" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="55"
@@ -511,7 +511,7 @@
 
 <!-- dwarf steel sword-->
 <Item type="weapon" subtype="dwarfst_sw" name="dwarfsteel sword" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="60"
@@ -547,7 +547,7 @@
 
 <!-- demon blade -->
 <Item type="weapon" subtype="demon_sw" name="demon blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="65"
@@ -585,7 +585,7 @@
 
 <!-- hero blade -->
 <Item type="weapon" subtype="heroe_sw" name="hero blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="70"
@@ -621,7 +621,7 @@
 
 <!-- angel blade -->
 <Item type="weapon" subtype="angel_sw" name="angel blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="75"
@@ -657,7 +657,7 @@
 
 <!-- gods blade -->
 <Item type="weapon" subtype="gods_sw" name="gods blade" size="medium">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name="longSword"/>
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/swords2h.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/swords2h.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,7 +3,7 @@
 <!-- TWO HANDED SWORDS -->
 <!-- farmers two hand sword-->
 <Item type="weapon" subtype="farm2h_sw" name="farmer sword" size="big">
-	<Image image="set:farm2h_sw.png image:full_image" />
+	<Image image="farm2h_sw.png" />
 	<RenderInfo name= "farmerSword" />
 	<Attribute
 		level_requirement="1"
@@ -41,7 +41,7 @@
 
 <!-- mercenary blade -->
 <Item type="weapon" subtype="merc2h_sw" name="mercenary blade" size="big">
-	<Image image="set:merc2h_sw.png image:full_image" />
+	<Image image="merc2h_sw.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="3"
@@ -79,7 +79,7 @@
 
 <!-- two handed steelsword -->
 <Item type="weapon" subtype="steel2h_sw" name="two handed steel sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="5"
@@ -117,7 +117,7 @@
 
 <!-- smash sword -->
 <Item type="weapon" subtype="smash_sw" name="smash sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="8"
@@ -155,7 +155,7 @@
 
 <!-- horse killer -->
 <Item type="weapon" subtype="horse_sw" name="horse killer" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="12"
@@ -193,7 +193,7 @@
 
 <!-- bastard sword -->
 <Item type="weapon" subtype="bast_sw" name="bastard sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="18"
@@ -231,7 +231,7 @@
 
 <!-- Ogerdolch -->
 <Item type="weapon" subtype="ogre_sw" name="ogre dagger" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="25"
@@ -269,7 +269,7 @@
 
 <!-- Goblintoeter -->
 <Item type="weapon" subtype="gobkil_sw" name="goblinkiller" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="30"
@@ -307,7 +307,7 @@
 
 <!-- Richtschwert -->
 <Item type="weapon" subtype="judge_sw" name="executioner's sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="35"
@@ -345,7 +345,7 @@
 
 <!-- Gardistenzweihaender -->
 <Item type="weapon" subtype="garde_sw" name="two handed guardsman sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="40"
@@ -383,7 +383,7 @@
 
 <!-- Flamberg -->
 <Item type="weapon" subtype="flame2h_sw" name="flamberg" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="45"
@@ -423,7 +423,7 @@
 
 <!-- Aisener Kriegsschwert -->
 <Item type="weapon" subtype="aisen_sw" name="aisener battle sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="50"
@@ -461,7 +461,7 @@
 
 <!-- Monsterschwert -->
 <Item type="weapon" subtype="monster_sw" name="monster sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="55"
@@ -499,7 +499,7 @@
 
 <!-- Traenenschwert -->
 <Item type="weapon" subtype="tear_sw" name="tear sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="60"
@@ -537,7 +537,7 @@
 
 <!-- Todeswind -->
 <Item type="weapon" subtype="death_sw" name="deathwind" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="65"
@@ -577,7 +577,7 @@
 
 <!-- Schreckensschwert -->
 <Item type="weapon" subtype="dread_sw" name="dread sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="70"
@@ -615,7 +615,7 @@
 
 <!-- Grossschwert -->
 <Item type="weapon" subtype="great_sw" name="great sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="75"
@@ -653,7 +653,7 @@
 
 <!-- Engelsschwert -->
 <Item type="weapon" subtype="angl2h_sw" name="angel sword" size="big">
-	<Image image="set:sword.png image:full_image" />
+	<Image image="sword.png" />
 	<RenderInfo name= "mercenaryBlade" />
 	<Attribute
 		level_requirement="80"
--- a/share/data/items/undeadEqu.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/undeadEqu.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,6 +1,6 @@
 <!-- Zerbrochener Schild 5 -->
 <Item type="shield" subtype="broken_shd" name="broken shield" size="medium">
-	 <Image image="set:shield.png image:full_image" />
+	 <Image image="shield.png" />
 	<Mesh file="broken_shd.mesh" />
 	<Attribute
 		level_requirement="4"
@@ -30,7 +30,7 @@
 
 <!-- Altes Schwert -->
 <Item type="weapon" subtype="old_sw" name="old sword" size="medium">
-	<Image image="set:old_sword.png image:full_image" />
+	<Image image="old_sword.png" />
 	<Mesh file="old_sw.mesh" />
 	<Attribute
 		level_requirement="6"
--- a/share/data/items/wands.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/items/wands.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,7 @@
 
 <!-- Fichtenzauberstab -->
 <Item type="weapon" subtype="spruce_wnd_fire" name="spruce wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="spruce_wnd" />
 	<Attribute
 			  level_requirement="1"
@@ -33,7 +33,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="spruce_wnd_air" name="spruce wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="spruce_wnd" />
 	<Attribute
 			  level_requirement="1"
@@ -64,7 +64,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="spruce_wnd_ice" name="spruce wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="spruce_wnd" />
 	<Attribute
 			  level_requirement="1"
@@ -97,7 +97,7 @@
 
 <!-- Lehrlingszauberstab -->
 <Item type="weapon" subtype="prntc_wnd_fire" name="apprentice wand" size="medium">
-	<Image image="set:aprnt_wnd.png image:full_image" />
+	<Image image="aprnt_wnd.png" />
 	<Mesh file="aprnt_wnd" />
 	<Attribute
 			  level_requirement="2"
@@ -128,7 +128,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="prntc_wnd_air" name="apprentice wand" size="medium">
-	<Image image="set:aprnt_wnd.png image:full_image" />
+	<Image image="aprnt_wnd.png" />
 	<Mesh file="aprnt_wnd" />
 	<Attribute
 			  level_requirement="2"
@@ -159,7 +159,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="prntc_wnd_ice" name="apprentice wand" size="medium">
-	<Image image="set:aprnt_wnd.png image:full_image" />
+	<Image image="aprnt_wnd.png" />
 	<Mesh file="aprnt_wnd" />
 	<Attribute
 			  level_requirement="2"
@@ -192,7 +192,7 @@
 
 <!-- Novizenzauberstab -->
 <Item type="weapon" subtype="novice_wnd_fire" name="novice wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="4"
@@ -222,7 +222,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="novice_wnd_air" name="novice wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="4"
@@ -253,7 +253,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="novice_wnd_ice" name="novice wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="4"
@@ -286,7 +286,7 @@
 
 <!-- Eremitenzauberstab -->
 <Item type="weapon" subtype="hermit_wnd_fire" name="hermit wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="6"
@@ -315,7 +315,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="hermit_wnd_air" name="hermit wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="6"
@@ -344,7 +344,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="hermit_wnd_ice" name="hermit wand" size="medium">
-	<Image image="set:novice_wnd.png image:full_image" />
+	<Image image="novice_wnd.png" />
 	<Mesh file="novice_wnd" />
 	<Attribute
 			  level_requirement="6"
@@ -374,7 +374,7 @@
 
 <!-- Felszauberstab -->
 <Item type="weapon" subtype="rock_wnd" name="rock wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="7"
@@ -409,7 +409,7 @@
 
 <!-- Erlenzauberstab -->
 <Item type="weapon" subtype="alder_wnd_fire" name="alder wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="12"
@@ -438,7 +438,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="alder_wnd_air" name="alder wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="12"
@@ -467,7 +467,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="alder_wnd_ice" name="alder wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="12"
@@ -497,7 +497,7 @@
 
 <!-- Bardenzauberstab -->
 <Item type="weapon" subtype="bard_wnd_fire" name="bard's wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="14"
@@ -528,7 +528,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="bard_wnd_air" name="bard's wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="14"
@@ -559,7 +559,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="bard_wnd_ice" name="bard's wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="14"
@@ -592,7 +592,7 @@
 
 <!-- Magierzauberstab -->
 <Item type="weapon" subtype="magus_wnd_fire" name="magus wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="19"
@@ -620,7 +620,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="magus_wnd_air" name="magus wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="19"
@@ -649,7 +649,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="magus_wnd_ice" name="magus wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="19"
@@ -679,7 +679,7 @@
 
 <!-- Silberzauberstab -->
 <Item type="weapon" subtype="silver_wnd_fire" name="silver wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="22"
@@ -707,7 +707,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="silver_wnd_air" name="silver wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="22"
@@ -736,7 +736,7 @@
 			   />
 </Item>
 <Item type="weapon" subtype="silver_wnd_ice" name="silver wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="22"
@@ -766,7 +766,7 @@
 
 <!-- Infernozauberstab -->
 <Item type="weapon" subtype="silver_wnd" name="silver wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="25"
@@ -796,7 +796,7 @@
 
 <!-- Eichenzauberstab -->
 <Item type="weapon" subtype="oak_wnd" name="oak wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="29"
@@ -826,7 +826,7 @@
 
 <!-- Phoenixzauberstab -->
 <Item type="weapon" subtype="phenix_wnd" name="phenix wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="34"
@@ -856,7 +856,7 @@
 
 <!-- Frostzauberstab -->
 <Item type="weapon" subtype="frost_wnd" name="frost wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="39"
@@ -886,7 +886,7 @@
 
 <!-- Gewitterzauberstab -->
 <Item type="weapon" subtype="thundr_wnd" name="thunder wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="44"
@@ -916,7 +916,7 @@
 
 <!-- Eschenzauberstab -->
 <Item type="weapon" subtype="ash_wnd" name="ash wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="49"
@@ -946,7 +946,7 @@
 
 <!-- Beschwoererzauberstab -->
 <Item type="weapon" subtype="sumonr_wnd" name="summoner wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="54"
@@ -976,7 +976,7 @@
 
 <!-- Magisterzauberstab -->
 <Item type="weapon" subtype="master_wnd" name="master wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="59"
@@ -1006,7 +1006,7 @@
 
 <!-- Nekromantenzauberstab -->
 <Item type="weapon" subtype="necro_wnd" name="necromancer wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="64"
@@ -1036,7 +1036,7 @@
 
 <!-- Daemonenzauberstab -->
 <Item type="weapon" subtype="demon_wnd" name="demon wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="69"
@@ -1066,7 +1066,7 @@
 
 <!-- Feenzauberstab -->
 <Item type="weapon" subtype="fairy_wnd" name="fairy wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="74"
@@ -1099,7 +1099,7 @@
 
 <!-- Erzmagierzauberstab -->
 <Item type="weapon" subtype="arcmag_wnd" name="archmage wand" size="medium">
-	<Image image="set:spruce_wnd.png image:full_image" />
+	<Image image="spruce_wnd.png" />
 	<Mesh file="basicWand" />
 	<Attribute
 			  level_requirement="80"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/data/main_menu/main_menu_playlist.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<!-- The sound-track for the menu is defined here -->
+
+<Playlist name="menu" repeat="true" shuffle="true">
+	<Track source="reluctant_hero.ogg" />
+	<Track source="battle_intro.ogg" />
+	<Track source="dark_descent.ogg" />
+	<Track source="Dark_Exploration.ogg" />
+</Playlist>
--- a/share/data/monsters/npcStats.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/monsters/npcStats.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -1,511 +1,511 @@
 <?xml version="1.0" ?>
 
 <EmotionSet name="human_standard"
-			default_image="set:emo_farmer image:normal" >
-	<Emotion name="normal" image="set:emo_farmer image:normal" />
-	<Emotion name="surprised" image="set:emo_farmer image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_farmer image:thoughtful" />
-	<Emotion name="happy" image="set:emo_farmer image:happy" />
-	<Emotion name="amused" image="set:emo_farmer image:amused" />
-	<Emotion name="excited" image="set:emo_farmer image:excited" />
-	<Emotion name="inlove" image="set:emo_farmer image:inlove" />
-	<Emotion name="bored" image="set:emo_farmer image:bored" />
-	<Emotion name="unhappy" image="set:emo_farmer image:unhappy" />
-	<Emotion name="sad" image="set:emo_farmer image:sad" />
-	<Emotion name="pain" image="set:emo_farmer image:pain" />
-	<Emotion name="sneer" image="set:emo_farmer image:sneer" />
-	<Emotion name="grin" image="set:emo_farmer image:grin" />
-	<Emotion name="offended" image="set:emo_farmer image:offended" />
-	<Emotion name="threaten" image="set:emo_farmer image:threaten" />
-	<Emotion name="angry" image="set:emo_farmer image:angry" />
-	<Emotion name="warcry" image="set:emo_farmer image:warcry" />
-	<Emotion name="injured" image="set:emo_farmer image:injured" />
-	<Emotion name="injured2" image="set:emo_farmer image:injured2" />
-	<Emotion name="injured3" image="set:emo_farmer image:injured3" />
+      default_image="emo_farmer/normal" >
+  <Emotion name="normal" image="emo_farmer/normal" />
+  <Emotion name="surprised" image="emo_farmer/surprised" />
+  <Emotion name="thoughtful" image="emo_farmer/thoughtful" />
+  <Emotion name="happy" image="emo_farmer/happy" />
+  <Emotion name="amused" image="emo_farmer/amused" />
+  <Emotion name="excited" image="emo_farmer/excited" />
+  <Emotion name="inlove" image="emo_farmer/inlove" />
+  <Emotion name="bored" image="emo_farmer/bored" />
+  <Emotion name="unhappy" image="emo_farmer/unhappy" />
+  <Emotion name="sad" image="emo_farmer/sad" />
+  <Emotion name="pain" image="emo_farmer/pain" />
+  <Emotion name="sneer" image="emo_farmer/sneer" />
+  <Emotion name="grin" image="emo_farmer/grin" />
+  <Emotion name="offended" image="emo_farmer/offended" />
+  <Emotion name="threaten" image="emo_farmer/threaten" />
+  <Emotion name="angry" image="emo_farmer/angry" />
+  <Emotion name="warcry" image="emo_farmer/warcry" />
+  <Emotion name="injured" image="emo_farmer/injured" />
+  <Emotion name="injured2" image="emo_farmer/injured2" />
+  <Emotion name="injured3" image="emo_farmer/injured3" />
 </EmotionSet>
 
 <EmotionSet name="farmer"
-			default_image="set:emo_farmer image:normal" >
-	<Emotion name="normal" image="set:emo_farmer image:normal" />
-	<Emotion name="surprised" image="set:emo_farmer image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_farmer image:thoughtful" />
-	<Emotion name="happy" image="set:emo_farmer image:happy" />
-	<Emotion name="amused" image="set:emo_farmer image:amused" />
-	<Emotion name="excited" image="set:emo_farmer image:excited" />
-	<Emotion name="inlove" image="set:emo_farmer image:inlove" />
-	<Emotion name="bored" image="set:emo_farmer image:bored" />
-	<Emotion name="unhappy" image="set:emo_farmer image:unhappy" />
-	<Emotion name="sad" image="set:emo_farmer image:sad" />
-	<Emotion name="pain" image="set:emo_farmer image:pain" />
-	<Emotion name="sneer" image="set:emo_farmer image:sneer" />
-	<Emotion name="grin" image="set:emo_farmer image:grin" />
-	<Emotion name="offended" image="set:emo_farmer image:offended" />
-	<Emotion name="threaten" image="set:emo_farmer image:threaten" />
-	<Emotion name="angry" image="set:emo_farmer image:angry" />
-	<Emotion name="warcry" image="set:emo_farmer image:warcry" />
-	<Emotion name="injured" image="set:emo_farmer image:injured" />
-	<Emotion name="injured2" image="set:emo_farmer image:injured2" />
-	<Emotion name="injured3" image="set:emo_farmer image:injured3" />
+      default_image="emo_farmer/normal" >
+  <Emotion name="normal" image="emo_farmer/normal" />
+  <Emotion name="surprised" image="emo_farmer/surprised" />
+  <Emotion name="thoughtful" image="emo_farmer/thoughtful" />
+  <Emotion name="happy" image="emo_farmer/happy" />
+  <Emotion name="amused" image="emo_farmer/amused" />
+  <Emotion name="excited" image="emo_farmer/excited" />
+  <Emotion name="inlove" image="emo_farmer/inlove" />
+  <Emotion name="bored" image="emo_farmer/bored" />
+  <Emotion name="unhappy" image="emo_farmer/unhappy" />
+  <Emotion name="sad" image="emo_farmer/sad" />
+  <Emotion name="pain" image="emo_farmer/pain" />
+  <Emotion name="sneer" image="emo_farmer/sneer" />
+  <Emotion name="grin" image="emo_farmer/grin" />
+  <Emotion name="offended" image="emo_farmer/offended" />
+  <Emotion name="threaten" image="emo_farmer/threaten" />
+  <Emotion name="angry" image="emo_farmer/angry" />
+  <Emotion name="warcry" image="emo_farmer/warcry" />
+  <Emotion name="injured" image="emo_farmer/injured" />
+  <Emotion name="injured2" image="emo_farmer/injured2" />
+  <Emotion name="injured3" image="emo_farmer/injured3" />
 </EmotionSet>
 
 <EmotionSet name="fenor_emotion"
-			default_image="set:emo_farmer image:normal" >
-	<Emotion name="normal" image="set:emo_farmer image:normal" />
-	<Emotion name="surprised" image="set:emo_farmer image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_farmer image:thoughtful" />
-	<Emotion name="happy" image="set:emo_farmer image:happy" />
-	<Emotion name="amused" image="set:emo_farmer image:amused" />
-	<Emotion name="excited" image="set:emo_farmer image:excited" />
-	<Emotion name="inlove" image="set:emo_farmer image:inlove" />
-	<Emotion name="bored" image="set:emo_farmer image:bored" />
-	<Emotion name="unhappy" image="set:emo_farmer image:unhappy" />
-	<Emotion name="sad" image="set:emo_farmer image:sad" />
-	<Emotion name="pain" image="set:emo_farmer image:pain" />
-	<Emotion name="sneer" image="set:emo_farmer image:sneer" />
-	<Emotion name="grin" image="set:emo_farmer image:grin" />
-	<Emotion name="offended" image="set:emo_farmer image:offended" />
-	<Emotion name="threaten" image="set:emo_farmer image:threaten" />
-	<Emotion name="angry" image="set:emo_farmer image:angry" />
-	<Emotion name="warcry" image="set:emo_farmer image:warcry" />
-	<Emotion name="injured" image="set:emo_farmer image:injured" />
-	<Emotion name="injured2" image="set:emo_farmer image:injured2" />
-	<Emotion name="injured3" image="set:emo_farmer image:injured3" />
+      default_image="emo_farmer/normal" >
+  <Emotion name="normal" image="emo_farmer/normal" />
+  <Emotion name="surprised" image="emo_farmer/surprised" />
+  <Emotion name="thoughtful" image="emo_farmer/thoughtful" />
+  <Emotion name="happy" image="emo_farmer/happy" />
+  <Emotion name="amused" image="emo_farmer/amused" />
+  <Emotion name="excited" image="emo_farmer/excited" />
+  <Emotion name="inlove" image="emo_farmer/inlove" />
+  <Emotion name="bored" image="emo_farmer/bored" />
+  <Emotion name="unhappy" image="emo_farmer/unhappy" />
+  <Emotion name="sad" image="emo_farmer/sad" />
+  <Emotion name="pain" image="emo_farmer/pain" />
+  <Emotion name="sneer" image="emo_farmer/sneer" />
+  <Emotion name="grin" image="emo_farmer/grin" />
+  <Emotion name="offended" image="emo_farmer/offended" />
+  <Emotion name="threaten" image="emo_farmer/threaten" />
+  <Emotion name="angry" image="emo_farmer/angry" />
+  <Emotion name="warcry" image="emo_farmer/warcry" />
+  <Emotion name="injured" image="emo_farmer/injured" />
+  <Emotion name="injured2" image="emo_farmer/injured2" />
+  <Emotion name="injured3" image="emo_farmer/injured3" />
 </EmotionSet>
 
 <EmotionSet name="councilMage_emotion"
-			default_image="set:emo_councilMage image:normal" >
-	<Emotion name="normal" image="set:emo_councilMage image:normal" />
-	<Emotion name="surprised" image="set:emo_councilMage image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_councilMage image:thoughtful" />
-	<Emotion name="happy" image="set:emo_councilMage image:happy" />
-	<Emotion name="amused" image="set:emo_councilMage image:amused" />
-	<Emotion name="excited" image="set:emo_councilMage image:excited" />
-	<Emotion name="inlove" image="set:emo_councilMage image:inlove" />
-	<Emotion name="bored" image="set:emo_councilMage image:bored" />
-	<Emotion name="unhappy" image="set:emo_councilMage image:unhappy" />
-	<Emotion name="sad" image="set:emo_councilMage image:sad" />
-	<Emotion name="pain" image="set:emo_councilMage image:pain" />
-	<Emotion name="sneer" image="set:emo_councilMage image:sneer" />
-	<Emotion name="grin" image="set:emo_councilMage image:grin" />
-	<Emotion name="offended" image="set:emo_councilMage image:offended" />
-	<Emotion name="threaten" image="set:emo_councilMage image:threaten" />
-	<Emotion name="angry" image="set:emo_councilMage image:angry" />
-	<Emotion name="warcry" image="set:emo_councilMage image:warcry" />
-	<Emotion name="injured" image="set:emo_councilMage image:injured" />
-	<Emotion name="injured2" image="set:emo_councilMage image:injured2" />
-	<Emotion name="injured3" image="set:emo_councilMage image:injured3" />
+      default_image="emo_councilMage/normal" >
+  <Emotion name="normal" image="emo_councilMage/normal" />
+  <Emotion name="surprised" image="emo_councilMage/surprised" />
+  <Emotion name="thoughtful" image="emo_councilMage/thoughtful" />
+  <Emotion name="happy" image="emo_councilMage/happy" />
+  <Emotion name="amused" image="emo_councilMage/amused" />
+  <Emotion name="excited" image="emo_councilMage/excited" />
+  <Emotion name="inlove" image="emo_councilMage/inlove" />
+  <Emotion name="bored" image="emo_councilMage/bored" />
+  <Emotion name="unhappy" image="emo_councilMage/unhappy" />
+  <Emotion name="sad" image="emo_councilMage/sad" />
+  <Emotion name="pain" image="emo_councilMage/pain" />
+  <Emotion name="sneer" image="emo_councilMage/sneer" />
+  <Emotion name="grin" image="emo_councilMage/grin" />
+  <Emotion name="offended" image="emo_councilMage/offended" />
+  <Emotion name="threaten" image="emo_councilMage/threaten" />
+  <Emotion name="angry" image="emo_councilMage/angry" />
+  <Emotion name="warcry" image="emo_councilMage/warcry" />
+  <Emotion name="injured" image="emo_councilMage/injured" />
+  <Emotion name="injured2" image="emo_councilMage/injured2" />
+  <Emotion name="injured3" image="emo_councilMage/injured3" />
 </EmotionSet>
 <EmotionSet name="councilMageCrystal_emotion"
-			default_image="set:emo_councilMageCrystal image:normal" >
-	<Emotion name="normal" image="set:emo_councilMageCrystal image:normal" />
-	<Emotion name="surprised" image="set:emo_councilMageCrystal image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_councilMageCrystal image:thoughtful" />
-	<Emotion name="happy" image="set:emo_councilMageCrystal image:happy" />
-	<Emotion name="amused" image="set:emo_councilMageCrystal image:amused" />
-	<Emotion name="excited" image="set:emo_councilMageCrystal image:excited" />
-	<Emotion name="inlove" image="set:emo_councilMageCrystal image:inlove" />
-	<Emotion name="bored" image="set:emo_councilMageCrystal image:bored" />
-	<Emotion name="unhappy" image="set:emo_councilMageCrystal image:unhappy" />
-	<Emotion name="sad" image="set:emo_councilMageCrystal image:sad" />
-	<Emotion name="pain" image="set:emo_councilMageCrystal image:pain" />
-	<Emotion name="sneer" image="set:emo_councilMageCrystal image:sneer" />
-	<Emotion name="grin" image="set:emo_councilMageCrystal image:grin" />
-	<Emotion name="offended" image="set:emo_councilMageCrystal image:offended" />
-	<Emotion name="threaten" image="set:emo_councilMageCrystal image:threaten" />
-	<Emotion name="angry" image="set:emo_councilMageCrystal image:angry" />
-	<Emotion name="warcry" image="set:emo_councilMageCrystal image:warcry" />
-	<Emotion name="injured" image="set:emo_councilMageCrystal image:injured" />
-	<Emotion name="injured2" image="set:emo_councilMageCrystal image:injured2" />
-	<Emotion name="injured3" image="set:emo_councilMageCrystal image:injured3" />
+      default_image="emo_councilMageCrystal/normal" >
+  <Emotion name="normal" image="emo_councilMageCrystal/normal" />
+  <Emotion name="surprised" image="emo_councilMageCrystal/surprised" />
+  <Emotion name="thoughtful" image="emo_councilMageCrystal/thoughtful" />
+  <Emotion name="happy" image="emo_councilMageCrystal/happy" />
+  <Emotion name="amused" image="emo_councilMageCrystal/amused" />
+  <Emotion name="excited" image="emo_councilMageCrystal/excited" />
+  <Emotion name="inlove" image="emo_councilMageCrystal/inlove" />
+  <Emotion name="bored" image="emo_councilMageCrystal/bored" />
+  <Emotion name="unhappy" image="emo_councilMageCrystal/unhappy" />
+  <Emotion name="sad" image="emo_councilMageCrystal/sad" />
+  <Emotion name="pain" image="emo_councilMageCrystal/pain" />
+  <Emotion name="sneer" image="emo_councilMageCrystal/sneer" />
+  <Emotion name="grin" image="emo_councilMageCrystal/grin" />
+  <Emotion name="offended" image="emo_councilMageCrystal/offended" />
+  <Emotion name="threaten" image="emo_councilMageCrystal/threaten" />
+  <Emotion name="angry" image="emo_councilMageCrystal/angry" />
+  <Emotion name="warcry" image="emo_councilMageCrystal/warcry" />
+  <Emotion name="injured" image="emo_councilMageCrystal/injured" />
+  <Emotion name="injured2" image="emo_councilMageCrystal/injured2" />
+  <Emotion name="injured3" image="emo_councilMageCrystal/injured3" />
 </EmotionSet>
 
 <EmotionSet name="gertlinde_emotion"
-			default_image="set:emo_gertlinde image:normal" >
-	<Emotion name="normal" image="set:emo_gertlinde image:normal" />
-	<Emotion name="surprised" image="set:emo_gertlinde image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_gertlinde image:thoughtful" />
-	<Emotion name="happy" image="set:emo_gertlinde image:happy" />
-	<Emotion name="amused" image="set:emo_gertlinde image:amused" />
-	<Emotion name="excited" image="set:emo_gertlinde image:excited" />
-	<Emotion name="inlove" image="set:emo_gertlinde image:inlove" />
-	<Emotion name="bored" image="set:emo_gertlinde image:bored" />
-	<Emotion name="unhappy" image="set:emo_gertlinde image:unhappy" />
-	<Emotion name="sad" image="set:emo_gertlinde image:sad" />
-	<Emotion name="pain" image="set:emo_gertlinde image:pain" />
-	<Emotion name="sneer" image="set:emo_gertlinde image:sneer" />
-	<Emotion name="grin" image="set:emo_gertlinde image:grin" />
-	<Emotion name="offended" image="set:emo_gertlinde image:offended" />
-	<Emotion name="threaten" image="set:emo_gertlinde image:threaten" />
-	<Emotion name="angry" image="set:emo_gertlinde image:angry" />
-	<Emotion name="warcry" image="set:emo_gertlinde image:warcry" />
-	<Emotion name="injured" image="set:emo_gertlinde image:injured" />
-	<Emotion name="injured2" image="set:emo_gertlinde image:injured2" />
-	<Emotion name="injured3" image="set:emo_gertlinde image:injured3" />
-	<Emotion name="fear" image="set:emo_gertlinde image:fear" />
-	<Emotion name="panic" image="set:emo_gertlinde image:panic" />
-	<Emotion name="aloof" image="set:emo_gertlinde image:aloof" />
-	<Emotion name="disgust" image="set:emo_gertlinde image:disgust" />
+      default_image="emo_gertlinde/normal" >
+  <Emotion name="normal" image="emo_gertlinde/normal" />
+  <Emotion name="surprised" image="emo_gertlinde/surprised" />
+  <Emotion name="thoughtful" image="emo_gertlinde/thoughtful" />
+  <Emotion name="happy" image="emo_gertlinde/happy" />
+  <Emotion name="amused" image="emo_gertlinde/amused" />
+  <Emotion name="excited" image="emo_gertlinde/excited" />
+  <Emotion name="inlove" image="emo_gertlinde/inlove" />
+  <Emotion name="bored" image="emo_gertlinde/bored" />
+  <Emotion name="unhappy" image="emo_gertlinde/unhappy" />
+  <Emotion name="sad" image="emo_gertlinde/sad" />
+  <Emotion name="pain" image="emo_gertlinde/pain" />
+  <Emotion name="sneer" image="emo_gertlinde/sneer" />
+  <Emotion name="grin" image="emo_gertlinde/grin" />
+  <Emotion name="offended" image="emo_gertlinde/offended" />
+  <Emotion name="threaten" image="emo_gertlinde/threaten" />
+  <Emotion name="angry" image="emo_gertlinde/angry" />
+  <Emotion name="warcry" image="emo_gertlinde/warcry" />
+  <Emotion name="injured" image="emo_gertlinde/injured" />
+  <Emotion name="injured2" image="emo_gertlinde/injured2" />
+  <Emotion name="injured3" image="emo_gertlinde/injured3" />
+  <Emotion name="fear" image="emo_gertlinde/fear" />
+  <Emotion name="panic" image="emo_gertlinde/panic" />
+  <Emotion name="aloof" image="emo_gertlinde/aloof" />
+  <Emotion name="disgust" image="emo_gertlinde/disgust" />
 </EmotionSet>
 
 <EmotionSet name="derred_emotion"
-			default_image="set:emo_derred image:normal" >
-	<Emotion name="normal" image="set:emo_derred image:normal" />
-	<Emotion name="surprised" image="set:emo_derred image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_derred image:thoughtful" />
-	<Emotion name="happy" image="set:emo_derred image:happy" />
-	<Emotion name="amused" image="set:emo_derred image:amused" />
-	<Emotion name="excited" image="set:emo_derred image:excited" />
-	<Emotion name="inlove" image="set:emo_derred image:inlove" />
-	<Emotion name="bored" image="set:emo_derred image:bored" />
-	<Emotion name="unhappy" image="set:emo_derred image:unhappy" />
-	<Emotion name="sad" image="set:emo_derred image:sad" />
-	<Emotion name="pain" image="set:emo_derred image:pain" />
-	<Emotion name="sneer" image="set:emo_derred image:sneer" />
-	<Emotion name="grin" image="set:emo_derred image:grin" />
-	<Emotion name="offended" image="set:emo_derred image:offended" />
-	<Emotion name="threaten" image="set:emo_derred image:threaten" />
-	<Emotion name="angry" image="set:emo_derred image:angry" />
-	<Emotion name="warcry" image="set:emo_derred image:warcry" />
-	<Emotion name="injured" image="set:emo_derred image:injured" />
-	<Emotion name="injured2" image="set:emo_derred image:injured2" />
-	<Emotion name="injured3" image="set:emo_derred image:injured3" />
-	<Emotion name="fear" image="set:emo_derred image:fear" />
-	<Emotion name="panic" image="set:emo_derred image:panic" />
-	<Emotion name="aloof" image="set:emo_derred image:aloof" />
-	<Emotion name="disgust" image="set:emo_derred image:disgust" />
+      default_image="emo_derred/normal" >
+  <Emotion name="normal" image="emo_derred/normal" />
+  <Emotion name="surprised" image="emo_derred/surprised" />
+  <Emotion name="thoughtful" image="emo_derred/thoughtful" />
+  <Emotion name="happy" image="emo_derred/happy" />
+  <Emotion name="amused" image="emo_derred/amused" />
+  <Emotion name="excited" image="emo_derred/excited" />
+  <Emotion name="inlove" image="emo_derred/inlove" />
+  <Emotion name="bored" image="emo_derred/bored" />
+  <Emotion name="unhappy" image="emo_derred/unhappy" />
+  <Emotion name="sad" image="emo_derred/sad" />
+  <Emotion name="pain" image="emo_derred/pain" />
+  <Emotion name="sneer" image="emo_derred/sneer" />
+  <Emotion name="grin" image="emo_derred/grin" />
+  <Emotion name="offended" image="emo_derred/offended" />
+  <Emotion name="threaten" image="emo_derred/threaten" />
+  <Emotion name="angry" image="emo_derred/angry" />
+  <Emotion name="warcry" image="emo_derred/warcry" />
+  <Emotion name="injured" image="emo_derred/injured" />
+  <Emotion name="injured2" image="emo_derred/injured2" />
+  <Emotion name="injured3" image="emo_derred/injured3" />
+  <Emotion name="fear" image="emo_derred/fear" />
+  <Emotion name="panic" image="emo_derred/panic" />
+  <Emotion name="aloof" image="emo_derred/aloof" />
+  <Emotion name="disgust" image="emo_derred/disgust" />
 </EmotionSet>
 
 <EmotionSet name="tolec_emotion"
-			default_image="set:emo_tolec image:normal" >
-	<Emotion name="normal" image="set:emo_tolec image:normal" />
-	<Emotion name="surprised" image="set:emo_tolec image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_tolec image:thoughtful" />
-	<Emotion name="happy" image="set:emo_tolec image:happy" />
-	<Emotion name="amused" image="set:emo_tolec image:amused" />
-	<Emotion name="excited" image="set:emo_tolec image:excited" />
-	<Emotion name="inlove" image="set:emo_tolec image:inlove" />
-	<Emotion name="bored" image="set:emo_tolec image:bored" />
-	<Emotion name="unhappy" image="set:emo_tolec image:unhappy" />
-	<Emotion name="sad" image="set:emo_tolec image:sad" />
-	<Emotion name="pain" image="set:emo_tolec image:pain" />
-	<Emotion name="sneer" image="set:emo_tolec image:sneer" />
-	<Emotion name="grin" image="set:emo_tolec image:grin" />
-	<Emotion name="offended" image="set:emo_tolec image:offended" />
-	<Emotion name="threaten" image="set:emo_tolec image:threaten" />
-	<Emotion name="angry" image="set:emo_tolec image:angry" />
-	<Emotion name="warcry" image="set:emo_tolec image:warcry" />
-	<Emotion name="injured" image="set:emo_tolec image:injured" />
-	<Emotion name="injured2" image="set:emo_tolec image:injured2" />
-	<Emotion name="injured3" image="set:emo_tolec image:injured3" />
-	<Emotion name="fear" image="set:emo_tolec image:fear" />
-	<Emotion name="panic" image="set:emo_tolec image:panic" />
-	<Emotion name="aloof" image="set:emo_tolec image:aloof" />
-	<Emotion name="disgust" image="set:emo_tolec image:disgust" />
+      default_image="emo_tolec/normal" >
+  <Emotion name="normal" image="emo_tolec/normal" />
+  <Emotion name="surprised" image="emo_tolec/surprised" />
+  <Emotion name="thoughtful" image="emo_tolec/thoughtful" />
+  <Emotion name="happy" image="emo_tolec/happy" />
+  <Emotion name="amused" image="emo_tolec/amused" />
+  <Emotion name="excited" image="emo_tolec/excited" />
+  <Emotion name="inlove" image="emo_tolec/inlove" />
+  <Emotion name="bored" image="emo_tolec/bored" />
+  <Emotion name="unhappy" image="emo_tolec/unhappy" />
+  <Emotion name="sad" image="emo_tolec/sad" />
+  <Emotion name="pain" image="emo_tolec/pain" />
+  <Emotion name="sneer" image="emo_tolec/sneer" />
+  <Emotion name="grin" image="emo_tolec/grin" />
+  <Emotion name="offended" image="emo_tolec/offended" />
+  <Emotion name="threaten" image="emo_tolec/threaten" />
+  <Emotion name="angry" image="emo_tolec/angry" />
+  <Emotion name="warcry" image="emo_tolec/warcry" />
+  <Emotion name="injured" image="emo_tolec/injured" />
+  <Emotion name="injured2" image="emo_tolec/injured2" />
+  <Emotion name="injured3" image="emo_tolec/injured3" />
+  <Emotion name="fear" image="emo_tolec/fear" />
+  <Emotion name="panic" image="emo_tolec/panic" />
+  <Emotion name="aloof" image="emo_tolec/aloof" />
+  <Emotion name="disgust" image="emo_tolec/disgust" />
 </EmotionSet>
 
 <EmotionSet name="warrior_emotion"
-			default_image="set:emo_warrior image:normal" >
-	<Emotion name="normal" image="set:emo_warrior image:normal" />
-	<Emotion name="surprised" image="set:emo_warrior image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_warrior image:thoughtful" />
-	<Emotion name="happy" image="set:emo_warrior image:happy" />
-	<Emotion name="amused" image="set:emo_warrior image:amused" />
-	<Emotion name="excited" image="set:emo_warrior image:excited" />
-	<Emotion name="inlove" image="set:emo_warrior image:inlove" />
-	<Emotion name="bored" image="set:emo_warrior image:bored" />
-	<Emotion name="unhappy" image="set:emo_warrior image:unhappy" />
-	<Emotion name="sad" image="set:emo_warrior image:sad" />
-	<Emotion name="pain" image="set:emo_warrior image:pain" />
-	<Emotion name="sneer" image="set:emo_warrior image:sneer" />
-	<Emotion name="grin" image="set:emo_warrior image:grin" />
-	<Emotion name="offended" image="set:emo_warrior image:offended" />
-	<Emotion name="threaten" image="set:emo_warrior image:threaten" />
-	<Emotion name="angry" image="set:emo_warrior image:angry" />
-	<Emotion name="warcry" image="set:emo_warrior image:warcry" />
-	<Emotion name="injured" image="set:emo_warrior image:injured" />
-	<Emotion name="injured2" image="set:emo_warrior image:injured2" />
-	<Emotion name="injured3" image="set:emo_warrior image:injured3" />
-	<Emotion name="fear" image="set:emo_warrior image:fear" />
-	<Emotion name="panic" image="set:emo_warrior image:panic" />
-	<Emotion name="aloof" image="set:emo_warrior image:aloof" />
-	<Emotion name="disgust" image="set:emo_warrior image:disgust" />
+      default_image="emo_warrior/normal" >
+  <Emotion name="normal" image="emo_warrior/normal" />
+  <Emotion name="surprised" image="emo_warrior/surprised" />
+  <Emotion name="thoughtful" image="emo_warrior/thoughtful" />
+  <Emotion name="happy" image="emo_warrior/happy" />
+  <Emotion name="amused" image="emo_warrior/amused" />
+  <Emotion name="excited" image="emo_warrior/excited" />
+  <Emotion name="inlove" image="emo_warrior/inlove" />
+  <Emotion name="bored" image="emo_warrior/bored" />
+  <Emotion name="unhappy" image="emo_warrior/unhappy" />
+  <Emotion name="sad" image="emo_warrior/sad" />
+  <Emotion name="pain" image="emo_warrior/pain" />
+  <Emotion name="sneer" image="emo_warrior/sneer" />
+  <Emotion name="grin" image="emo_warrior/grin" />
+  <Emotion name="offended" image="emo_warrior/offended" />
+  <Emotion name="threaten" image="emo_warrior/threaten" />
+  <Emotion name="angry" image="emo_warrior/angry" />
+  <Emotion name="warcry" image="emo_warrior/warcry" />
+  <Emotion name="injured" image="emo_warrior/injured" />
+  <Emotion name="injured2" image="emo_warrior/injured2" />
+  <Emotion name="injured3" image="emo_warrior/injured3" />
+  <Emotion name="fear" image="emo_warrior/fear" />
+  <Emotion name="panic" image="emo_warrior/panic" />
+  <Emotion name="aloof" image="emo_warrior/aloof" />
+  <Emotion name="disgust" image="emo_warrior/disgust" />
 </EmotionSet>
 
 <EmotionSet name="general_emotion"
-			default_image="set:emo_general image:normal" >
-	<Emotion name="normal" image="set:emo_general image:normal" />
-	<Emotion name="surprised" image="set:emo_general image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_general image:thoughtful" />
-	<Emotion name="happy" image="set:emo_general image:happy" />
-	<Emotion name="amused" image="set:emo_general image:amused" />
-	<Emotion name="excited" image="set:emo_general image:excited" />
-	<Emotion name="inlove" image="set:emo_general image:inlove" />
-	<Emotion name="bored" image="set:emo_general image:bored" />
-	<Emotion name="unhappy" image="set:emo_general image:unhappy" />
-	<Emotion name="sad" image="set:emo_general image:sad" />
-	<Emotion name="pain" image="set:emo_general image:pain" />
-	<Emotion name="sneer" image="set:emo_general image:sneer" />
-	<Emotion name="grin" image="set:emo_general image:grin" />
-	<Emotion name="offended" image="set:emo_general image:offended" />
-	<Emotion name="threaten" image="set:emo_general image:threaten" />
-	<Emotion name="angry" image="set:emo_general image:angry" />
-	<Emotion name="warcry" image="set:emo_general image:warcry" />
-	<Emotion name="injured" image="set:emo_general image:injured" />
-	<Emotion name="injured2" image="set:emo_general image:injured2" />
-	<Emotion name="injured3" image="set:emo_general image:injured3" />
-	<Emotion name="fear" image="set:emo_general image:fear" />
-	<Emotion name="panic" image="set:emo_general image:panic" />
-	<Emotion name="aloof" image="set:emo_general image:aloof" />
-	<Emotion name="disgust" image="set:emo_general image:disgust" />
+      default_image="emo_general/normal" >
+  <Emotion name="normal" image="emo_general/normal" />
+  <Emotion name="surprised" image="emo_general/surprised" />
+  <Emotion name="thoughtful" image="emo_general/thoughtful" />
+  <Emotion name="happy" image="emo_general/happy" />
+  <Emotion name="amused" image="emo_general/amused" />
+  <Emotion name="excited" image="emo_general/excited" />
+  <Emotion name="inlove" image="emo_general/inlove" />
+  <Emotion name="bored" image="emo_general/bored" />
+  <Emotion name="unhappy" image="emo_general/unhappy" />
+  <Emotion name="sad" image="emo_general/sad" />
+  <Emotion name="pain" image="emo_general/pain" />
+  <Emotion name="sneer" image="emo_general/sneer" />
+  <Emotion name="grin" image="emo_general/grin" />
+  <Emotion name="offended" image="emo_general/offended" />
+  <Emotion name="threaten" image="emo_general/threaten" />
+  <Emotion name="angry" image="emo_general/angry" />
+  <Emotion name="warcry" image="emo_general/warcry" />
+  <Emotion name="injured" image="emo_general/injured" />
+  <Emotion name="injured2" image="emo_general/injured2" />
+  <Emotion name="injured3" image="emo_general/injured3" />
+  <Emotion name="fear" image="emo_general/fear" />
+  <Emotion name="panic" image="emo_general/panic" />
+  <Emotion name="aloof" image="emo_general/aloof" />
+  <Emotion name="disgust" image="emo_general/disgust" />
 </EmotionSet>
 
 <EmotionSet name="ireana_emotion"
-			default_image="set:emo_ireana image:normal" >
-	<Emotion name="normal" image="set:emo_ireana image:normal" />
-	<Emotion name="surprised" image="set:emo_ireana image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_ireana image:thoughtful" />
-	<Emotion name="happy" image="set:emo_ireana image:happy" />
-	<Emotion name="amused" image="set:emo_ireana image:amused" />
-	<Emotion name="excited" image="set:emo_ireana image:excited" />
-	<Emotion name="inlove" image="set:emo_ireana image:inlove" />
-	<Emotion name="bored" image="set:emo_ireana image:bored" />
-	<Emotion name="unhappy" image="set:emo_ireana image:unhappy" />
-	<Emotion name="sad" image="set:emo_ireana image:sad" />
-	<Emotion name="pain" image="set:emo_ireana image:pain" />
-	<Emotion name="sneer" image="set:emo_ireana image:sneer" />
-	<Emotion name="grin" image="set:emo_ireana image:grin" />
-	<Emotion name="offended" image="set:emo_ireana image:offended" />
-	<Emotion name="threaten" image="set:emo_ireana image:threaten" />
-	<Emotion name="angry" image="set:emo_ireana image:angry" />
-	<Emotion name="warcry" image="set:emo_ireana image:warcry" />
-	<Emotion name="injured" image="set:emo_ireana image:injured" />
-	<Emotion name="injured2" image="set:emo_ireana image:injured2" />
-	<Emotion name="injured3" image="set:emo_ireana image:injured3" />
-	<Emotion name="fear" image="set:emo_ireana image:fear" />
-	<Emotion name="panic" image="set:emo_ireana image:panic" />
-	<Emotion name="aloof" image="set:emo_ireana image:aloof" />
-	<Emotion name="disgust" image="set:emo_ireana image:disgust" />
+      default_image="emo_ireana/normal" >
+  <Emotion name="normal" image="emo_ireana/normal" />
+  <Emotion name="surprised" image="emo_ireana/surprised" />
+  <Emotion name="thoughtful" image="emo_ireana/thoughtful" />
+  <Emotion name="happy" image="emo_ireana/happy" />
+  <Emotion name="amused" image="emo_ireana/amused" />
+  <Emotion name="excited" image="emo_ireana/excited" />
+  <Emotion name="inlove" image="emo_ireana/inlove" />
+  <Emotion name="bored" image="emo_ireana/bored" />
+  <Emotion name="unhappy" image="emo_ireana/unhappy" />
+  <Emotion name="sad" image="emo_ireana/sad" />
+  <Emotion name="pain" image="emo_ireana/pain" />
+  <Emotion name="sneer" image="emo_ireana/sneer" />
+  <Emotion name="grin" image="emo_ireana/grin" />
+  <Emotion name="offended" image="emo_ireana/offended" />
+  <Emotion name="threaten" image="emo_ireana/threaten" />
+  <Emotion name="angry" image="emo_ireana/angry" />
+  <Emotion name="warcry" image="emo_ireana/warcry" />
+  <Emotion name="injured" image="emo_ireana/injured" />
+  <Emotion name="injured2" image="emo_ireana/injured2" />
+  <Emotion name="injured3" image="emo_ireana/injured3" />
+  <Emotion name="fear" image="emo_ireana/fear" />
+  <Emotion name="panic" image="emo_ireana/panic" />
+  <Emotion name="aloof" image="emo_ireana/aloof" />
+  <Emotion name="disgust" image="emo_ireana/disgust" />
 </EmotionSet>
 
 <EmotionSet name="rogue_emotion"
-			default_image="set:emo_rogue image:normal" >
-	<Emotion name="normal" image="set:emo_rogue image:normal" />
-	<Emotion name="surprised" image="set:emo_rogue image:surprised" />
-	<Emotion name="thoughtful" image="set:emo_rogue image:thoughtful" />
-	<Emotion name="happy" image="set:emo_rogue image:happy" />
-	<Emotion name="amused" image="set:emo_rogue image:amused" />
-	<Emotion name="excited" image="set:emo_rogue image:excited" />
-	<Emotion name="inlove" image="set:emo_rogue image:inlove" />
-	<Emotion name="bored" image="set:emo_rogue image:bored" />
-	<Emotion name="unhappy" image="set:emo_rogue image:unhappy" />
-	<Emotion name="sad" image="set:emo_rogue image:sad" />
-	<Emotion name="pain" image="set:emo_rogue image:pain" />
-	<Emotion name="sneer" image="set:emo_rogue image:sneer" />
-	<Emotion name="grin" image="set:emo_rogue image:grin" />
-	<Emotion name="offended" image="set:emo_rogue image:offended" />
-	<Emotion name="threaten" image="set:emo_rogue image:threaten" />
-	<Emotion name="angry" image="set:emo_rogue image:angry" />
-	<Emotion name="warcry" image="set:emo_rogue image:warcry" />
-	<Emotion name="injured" image="set:emo_rogue image:injured" />
-	<Emotion name="injured2" image="set:emo_rogue image:injured2" />
-	<Emotion name="injured3" image="set:emo_rogue image:injured3" />
-	<Emotion name="fear" image="set:emo_rogue image:fear" />
-	<Emotion name="panic" image="set:emo_rogue image:panic" />
-	<Emotion name="aloof" image="set:emo_rogue image:aloof" />
-	<Emotion name="disgust" image="set:emo_rogue image:disgust" />
+      default_image="emo_rogue/normal" >
+  <Emotion name="normal" image="emo_rogue/normal" />
+  <Emotion name="surprised" image="emo_rogue/surprised" />
+  <Emotion name="thoughtful" image="emo_rogue/thoughtful" />
+  <Emotion name="happy" image="emo_rogue/happy" />
+  <Emotion name="amused" image="emo_rogue/amused" />
+  <Emotion name="excited" image="emo_rogue/excited" />
+  <Emotion name="inlove" image="emo_rogue/inlove" />
+  <Emotion name="bored" image="emo_rogue/bored" />
+  <Emotion name="unhappy" image="emo_rogue/unhappy" />
+  <Emotion name="sad" image="emo_rogue/sad" />
+  <Emotion name="pain" image="emo_rogue/pain" />
+  <Emotion name="sneer" image="emo_rogue/sneer" />
+  <Emotion name="grin" image="emo_rogue/grin" />
+  <Emotion name="offended" image="emo_rogue/offended" />
+  <Emotion name="threaten" image="emo_rogue/threaten" />
+  <Emotion name="angry" image="emo_rogue/angry" />
+  <Emotion name="warcry" image="emo_rogue/warcry" />
+  <Emotion name="injured" image="emo_rogue/injured" />
+  <Emotion name="injured2" image="emo_rogue/injured2" />
+  <Emotion name="injured3" image="emo_rogue/injured3" />
+  <Emotion name="fear" image="emo_rogue/fear" />
+  <Emotion name="panic" image="emo_rogue/panic" />
+  <Emotion name="aloof" image="emo_rogue/aloof" />
+  <Emotion name="disgust" image="emo_rogue/disgust" />
 </EmotionSet>
 
 
 
 <Monster type="NPC" subtype="peasant" name="Peasant" fraction="human" race="human" layer="NORMAL">
-	<Mesh file="peasant_m" />
-	<EmotionSet name="human_standard" />
-	<BasicAttributes
-					experience="0"
-					level="1"
-					max_health="100"
-					armor="10"
-					block="0"
-					attack="20"
-					strength="10"
-					dexterity="20"
-					magic_power="0"
-					willpower="10"
-					resistances_physical="0"
-					resistances_air="0"
-					resistances_ice="10"
-					resistances_fire="0"
-					resistances_cap_physical="50"
-					resistances_cap_air="50"
-					resistances_cap_ice="50"
-					resistances_cap_fire="50"
-					walk_speed="2500"
-					attack_speed="2000"
-					step_length="1.2"
-					attack_range="0.5"
-					>
-		
-		<Ability type="noaction"/>
-		<Ability type="walk"/>
-		<Ability type="die"/>
-		
-	</BasicAttributes>
-	
-	<Geometry radius="0.5" />
-	
-	<AI ai_sight_range="8" />
+  <Mesh file="peasant_m" />
+  <EmotionSet name="human_standard" />
+  <BasicAttributes
+          experience="0"
+          level="1"
+          max_health="100"
+          armor="10"
+          block="0"
+          attack="20"
+          strength="10"
+          dexterity="20"
+          magic_power="0"
+          willpower="10"
+          resistances_physical="0"
+          resistances_air="0"
+          resistances_ice="10"
+          resistances_fire="0"
+          resistances_cap_physical="50"
+          resistances_cap_air="50"
+          resistances_cap_ice="50"
+          resistances_cap_fire="50"
+          walk_speed="2500"
+          attack_speed="2000"
+          step_length="1.2"
+          attack_range="0.5"
+          >
+    
+    <Ability type="noaction"/>
+    <Ability type="walk"/>
+    <Ability type="die"/>
+    
+  </BasicAttributes>
+  
+  <Geometry radius="0.5" />
+  
+  <AI ai_sight_range="8" />
 </Monster>
 <Monster type="NPC" subtype="peasant2" name="Peasant" fraction="human" race="human" layer="NORMAL">
-	<Mesh file="peasant_m2" />
-	<EmotionSet name="human_standard" />
-	<BasicAttributes
-					experience="0"
-					level="1"
-					max_health="100"
-					armor="10"
-					block="0"
-					attack="20"
-					strength="10"
-					dexterity="20"
-					magic_power="0"
-					willpower="10"
-					resistances_physical="0"
-					resistances_air="0"
-					resistances_ice="10"
-					resistances_fire="0"
-					resistances_cap_physical="50"
-					resistances_cap_air="50"
-					resistances_cap_ice="50"
-					resistances_cap_fire="50"
-					walk_speed="2500"
-					attack_speed="2000"
-					step_length="1.2"
-					attack_range="0.5"
-					>
-		
-		<Ability type="noaction"/>
-		<Ability type="walk"/>
-		<Ability type="die"/>
-		
-	</BasicAttributes>
-	
-	<Geometry radius="0.5" />
-	
-	<AI ai_sight_range="8" />
+  <Mesh file="peasant_m2" />
+  <EmotionSet name="human_standard" />
+  <BasicAttributes
+          experience="0"
+          level="1"
+          max_health="100"
+          armor="10"
+          block="0"
+          attack="20"
+          strength="10"
+          dexterity="20"
+          magic_power="0"
+          willpower="10"
+          resistances_physical="0"
+          resistances_air="0"
+          resistances_ice="10"
+          resistances_fire="0"
+          resistances_cap_physical="50"
+          resistances_cap_air="50"
+          resistances_cap_ice="50"
+          resistances_cap_fire="50"
+          walk_speed="2500"
+          attack_speed="2000"
+          step_length="1.2"
+          attack_range="0.5"
+          >
+    
+    <Ability type="noaction"/>
+    <Ability type="walk"/>
+    <Ability type="die"/>
+    
+  </BasicAttributes>
+  
+  <Geometry radius="0.5" />
+  
+  <AI ai_sight_range="8" />
 </Monster>
 
 <Monster type="NPC" subtype="peasant_f" name="Peasant Woman" fraction="human" race="human" layer="NORMAL">
-	<Mesh file="peasant_f" />
-	<EmotionSet name="gertlinde_emotion" />
-	<BasicAttributes
-					experience="0"
-					level="1"
-					max_health="100"
-					armor="10"
-					block="0"
-					attack="20"
-					strength="10"
-					dexterity="20"
-					magic_power="0"
-					willpower="10"
-					resistances_physical="0"
-					resistances_air="0"
-					resistances_ice="10"
-					resistances_fire="0"
-					resistances_cap_physical="50"
-					resistances_cap_air="50"
-					resistances_cap_ice="50"
-					resistances_cap_fire="50"
-					walk_speed="2500"
-					attack_speed="2000"
-					step_length="1.2"
-					attack_range="0.5"
-					>
-		<Ability type="noaction"/>
-		<Ability type="walk"/>
-		<Ability type="die"/>
-		
-	</BasicAttributes>
-	
-	<Geometry radius="0.5" />
-	
-	<AI ai_sight_range="8" />
+  <Mesh file="peasant_f" />
+  <EmotionSet name="gertlinde_emotion" />
+  <BasicAttributes
+          experience="0"
+          level="1"
+          max_health="100"
+          armor="10"
+          block="0"
+          attack="20"
+          strength="10"
+          dexterity="20"
+          magic_power="0"
+          willpower="10"
+          resistances_physical="0"
+          resistances_air="0"
+          resistances_ice="10"
+          resistances_fire="0"
+          resistances_cap_physical="50"
+          resistances_cap_air="50"
+          resistances_cap_ice="50"
+          resistances_cap_fire="50"
+          walk_speed="2500"
+          attack_speed="2000"
+          step_length="1.2"
+          attack_range="0.5"
+          >
+    <Ability type="noaction"/>
+    <Ability type="walk"/>
+    <Ability type="die"/>
+    
+  </BasicAttributes>
+  
+  <Geometry radius="0.5" />
+  
+  <AI ai_sight_range="8" />
 </Monster>
 
 <Monster type="NPC" subtype="peasant_f2" name="Peasant Woman" fraction="human" race="human" layer="NORMAL">
-	<Mesh file="peasant_f2" />
-	<EmotionSet name="ireana_emotion" />
-	<BasicAttributes
-					experience="0"
-					level="1"
-					max_health="100"
-					armor="10"
-					block="0"
-					attack="20"
-					strength="10"
-					dexterity="20"
-					magic_power="0"
-					willpower="10"
-					resistances_physical="0"
-					resistances_air="0"
-					resistances_ice="10"
-					resistances_fire="0"
-					resistances_cap_physical="50"
-					resistances_cap_air="50"
-					resistances_cap_ice="50"
-					resistances_cap_fire="50"
-					walk_speed="2500"
-					attack_speed="2000"
-					step_length="1.2"
-					attack_range="0.5"
-					>
-		<Ability type="noaction"/>
-		<Ability type="walk"/>
-		<Ability type="die"/>
-		
-	</BasicAttributes>
-	
-	<Geometry radius="0.5" />
-	
-	<AI ai_sight_range="8" />
+  <Mesh file="peasant_f2" />
+  <EmotionSet name="ireana_emotion" />
+  <BasicAttributes
+          experience="0"
+          level="1"
+          max_health="100"
+          armor="10"
+          block="0"
+          attack="20"
+          strength="10"
+          dexterity="20"
+          magic_power="0"
+          willpower="10"
+          resistances_physical="0"
+          resistances_air="0"
+          resistances_ice="10"
+          resistances_fire="0"
+          resistances_cap_physical="50"
+          resistances_cap_air="50"
+          resistances_cap_ice="50"
+          resistances_cap_fire="50"
+          walk_speed="2500"
+          attack_speed="2000"
+          step_length="1.2"
+          attack_range="0.5"
+          >
+    <Ability type="noaction"/>
+    <Ability type="walk"/>
+    <Ability type="die"/>
+    
+  </BasicAttributes>
+  
+  <Geometry radius="0.5" />
+  
+  <AI ai_sight_range="8" />
 </Monster>
 
 <Monster type="NPC" subtype="theTrader" name="The Trader" fraction="neutral_to_all" race="human" layer="NORMAL">
-	<RenderInfo name="theTrader" />
-	<EmotionSet name="human_standard" />
-	<BasicAttributes
-					experience="1500"
-					level="85"
-					max_health="1340"
-					armor="120"
-					block="40"
-					attack="90"
-					strength="120"
-					dexterity="90"
-					magic_power="75"
-					willpower="200"
-					resistances_physical="30"
-					resistances_air="80"
-					resistances_ice="70"
-					resistances_fire="50"
-					resistances_cap_physical="100"
-					resistances_cap_air="100"
-					resistances_cap_ice="100"
-					resistances_cap_fire="100"
-					walk_speed="2500"
-					attack_speed="1000"
-					step_length="1.2"
-					attack_range="0.5"
-					>
-		
-		<Ability type="noaction"/>
-		<Ability type="walk"/>
-		<Ability type="die"/>
-		
-	</BasicAttributes>
-	
-	<Geometry radius="0.5" />
-	
-	<AI ai_sight_range="8" />
+  <RenderInfo name="theTrader" />
+  <EmotionSet name="human_standard" />
+  <BasicAttributes
+          experience="1500"
+          level="85"
+          max_health="1340"
+          armor="120"
+          block="40"
+          attack="90"
+          strength="120"
+          dexterity="90"
+          magic_power="75"
+          willpower="200"
+          resistances_physical="30"
+          resistances_air="80"
+          resistances_ice="70"
+          resistances_fire="50"
+          resistances_cap_physical="100"
+          resistances_cap_air="100"
+          resistances_cap_ice="100"
+          resistances_cap_fire="100"
+          walk_speed="2500"
+          attack_speed="1000"
+          step_length="1.2"
+          attack_range="0.5"
+          >
+    
+    <Ability type="noaction"/>
+    <Ability type="walk"/>
+    <Ability type="die"/>
+    
+  </BasicAttributes>
+  
+  <Geometry radius="0.5" />
+  
+  <AI ai_sight_range="8" />
 </Monster>
 
--- a/share/data/sound/player.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/sound/player.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -16,7 +16,7 @@
 
 
 <Sound name="teleport">
-<!--	<Soundfile source="inventory_sound_effects/sell_buy_item.wav"/> -->
+  <Soundfile source="inventory_sound_effects/teleport.wav"/>
 </Sound>
 
 <Sound name="use_potion">
@@ -25,7 +25,7 @@
 
 
 <Sound name="levelup">
-<!--	<Soundfile source="inventory_sound_effects/sell_buy_item.wav"/> -->
+  <Soundfile source="skill_sound_effects/hero_level_up.wav"/>
 </Sound>
 
 <Sound name="increase_attribute">
--- a/share/data/sound/skills.xml	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/data/sound/skills.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -3,4 +3,5 @@
   <!-- Augustin Preda, 2011.11.14: added trial sounds to use for heal/cure effects -->
 	<Soundfile source="skill_sound_effects/cure_1.wav"/>
 	<Soundfile source="skill_sound_effects/cure_2.wav"/>
+  <!--<Soundfile source="Mulchsound.wav" />-->
 </Sound>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/data/sound/ui.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<Sound name="main_menu_hover_item">
+	<Soundfile source="gui_sound_effects/menu_hover_item.wav"/>
+</Sound>
+<Sound name="main_menu_click_item">
+	<Soundfile source="gui_sound_effects/menu_click_item.wav"/>
+</Sound>
+<Sound name="main_menu_notification">
+	<Soundfile source="gui_sound_effects/menu_item_horn.wav"/>
+</Sound>
--- a/share/resources/emotionsets/emo_councilMage.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_councilMage" Imagefile="emo_councilMage.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_councilMageCrystal.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_councilMageCrystal" Imagefile="emo_councilMageCrystal.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_derred.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_derred" Imagefile="emo_derred.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_farmer.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_farmer" Imagefile="emo_farmer.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_general.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_general" Imagefile="emo_greif.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_gertlinde.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_gertlinde" Imagefile="emo_gertlinde.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_ireana.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_ireana" Imagefile="emo_ireana.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_rogue.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_rogue" Imagefile="emo_rogue.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_tolec.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_tolec" Imagefile="emo_tolec.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- a/share/resources/emotionsets/emo_warrior.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Imageset Name="emo_warrior" Imagefile="emo_warrior.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
-    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
-    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
-    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
-    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
-    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
-    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
-    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
-    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
-    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
-    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
-    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
-    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
-    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
-    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
-    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
-    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
-    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
-    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
-    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
-    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
-	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
-    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
-    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
-    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
-</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_councilMageCrystal.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_councilMageCrystal" Imagefile="emo_councilMageCrystal.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_derred.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_derred" Imagefile="emo_derred.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_farmer.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_farmer" Imagefile="emo_farmer.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_general.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_general" Imagefile="emo_greif.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_gertlinde.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_gertlinde" Imagefile="emo_gertlinde.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_ireana.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_ireana" Imagefile="emo_ireana.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_rogue.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_rogue" Imagefile="emo_rogue.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_tolec.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_tolec" Imagefile="emo_tolec.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/emotionsets/emo_warrior.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset Name="emo_warrior" Imagefile="emo_warrior.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" >
+    <Image Name="normal" XPos="1" YPos="1" Width="100" Height="100" />
+    <Image Name="surprised" XPos="102" YPos="1" Width="100" Height="100" />
+    <Image Name="thoughtful" XPos="203" YPos="1" Width="100" Height="100" />
+    <Image Name="happy" XPos="304" YPos="1" Width="100" Height="100" />
+    <Image Name="amused" XPos="405" YPos="1" Width="100" Height="100" />
+    <Image Name="excited" XPos="1" YPos="102" Width="100" Height="100" />
+    <Image Name="inlove" XPos="102" YPos="102" Width="100" Height="100" />
+    <Image Name="bored" XPos="203" YPos="102" Width="100" Height="100" />
+    <Image Name="unhappy" XPos="304" YPos="102" Width="100" Height="100" />
+    <Image Name="sad" XPos="405" YPos="102" Width="100" Height="100" />
+    <Image Name="pain" XPos="1" YPos="203" Width="100" Height="100" />
+    <Image Name="sneer" XPos="102" YPos="203" Width="100" Height="100" />
+    <Image Name="grin" XPos="203" YPos="203" Width="100" Height="100" />
+    <Image Name="offended" XPos="304" YPos="203" Width="100" Height="100" />
+    <Image Name="threaten" XPos="405" YPos="203" Width="100" Height="100" />
+    <Image Name="angry" XPos="1" YPos="304" Width="100" Height="100" />
+    <Image Name="warcry" XPos="102" YPos="304" Width="100" Height="100" />
+    <Image Name="injured" XPos="203" YPos="304" Width="100" Height="100" />
+    <Image Name="injured2" XPos="304" YPos="304" Width="100" Height="100" />
+    <Image Name="injured3" XPos="405" YPos="304" Width="100" Height="100" />
+	<Image Name="fear" XPos="1" YPos="405" Width="100" Height="100" />
+    <Image Name="panic" XPos="102" YPos="405" Width="100" Height="100" />
+    <Image Name="aloof" XPos="203" YPos="405" Width="100" Height="100" />
+    <Image Name="disgust" XPos="304" YPos="405" Width="100" Height="100" />
+</Imageset>
\ No newline at end of file
Binary file share/resources/gui/imagesets/CharacterScreen.png has changed
Binary file share/resources/gui/imagesets/ControlPanel.png has changed
Binary file share/resources/gui/imagesets/Inventory.png has changed
Binary file share/resources/gui/imagesets/OptionsWindow.png has changed
Binary file share/resources/gui/imagesets/Resummoned.png has changed
Binary file share/resources/gui/imagesets/ResummonedCursors.png has changed
Binary file share/resources/gui/imagesets/SWB.png has changed
Binary file share/resources/gui/imagesets/SWBCursors.png has changed
Binary file share/resources/gui/imagesets/SkillTree.png has changed
--- a/share/resources/gui/imagesets/SumWarsExtras.imageset	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/imagesets/SumWarsExtras.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -14,6 +14,9 @@
     TR = top right; R = right; BR = bottom right
   -->
 
+  <!-- Empty picture -->
+	<Image Name="EmptyPicture10px" XPos="64" YPos="64" Width="10" Height="10" />
+
   <!-- The symbol to be used for a Town Portal -->
   <Image Name="TownPortalSymbol" XPos="0" YPos="0" Width="48" Height="48" />
 
@@ -27,5 +30,25 @@
   <!-- Forward slash like -->
 	<Image Name="SkilltreeDiag2Connection" XPos="144" YPos="0" Width="48" Height="48" />
 
+  <!-- Additional empty pics -->
+	<Image Name="MiniHorzScrollThumbLeftNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollThumbRightNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollThumbMiddleNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollThumbLeftHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollThumbRightHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollThumbMiddleHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniHorzScrollBarSegment" XPos="64" YPos="64" Width="10" Height="10" />
+  
+	<Image Name="MiniVertScrollThumbTopNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollThumbBottomNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollThumbMiddleNormal" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollThumbTopHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollThumbBottomHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollThumbMiddleHover" XPos="64" YPos="64" Width="10" Height="10" />
+	<Image Name="MiniVertScrollBarSegment" XPos="64" YPos="64" Width="10" Height="10" />
+  
+  
+  
+  
 </Imageset>
 
Binary file share/resources/gui/imagesets/SumWarsExtras.png has changed
Binary file share/resources/gui/imagesets/SumWarsLogo.png has changed
Binary file share/resources/gui/imagesets/TaharezLook.tga has changed
Binary file share/resources/gui/imagesets/TradeWindow.png has changed
Binary file share/resources/gui/imagesets/main_menu.png has changed
Binary file share/resources/gui/imagesets/misc.png has changed
Binary file share/resources/gui/imagesets/portrait.png has changed
Binary file share/resources/gui/imagesets/skills.png has changed
Binary file share/resources/gui/imagesets/worldMap.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/004_003/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout >
+    <Window Type="SWB/StaticImage" Name="CreditsWindow_Holder" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.05,0},{0.85,0},{0.95,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Property Name="MousePassThroughEnabled" Value="True" />
+        <Property Name="Alpha" Value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/005_004/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout >
+    <Window Type="SWB/StaticImage" Name="CreditsWindow_Holder" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0.113,0},{0.05,0},{0.887,0},{0.95,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Property Name="MousePassThroughEnabled" Value="True" />
+        <Property Name="Alpha" Value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/016_009/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout >
+    <Window Type="SWB/StaticImage" Name="CreditsWindow_Holder" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0.2375,0},{0.05,0},{0.7625,0},{0.95,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Property Name="MousePassThroughEnabled" Value="True" />
+        <Property Name="Alpha" Value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/016_010/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout >
+    <Window Type="SWB/StaticImage" Name="CreditsWindow_Holder" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0.2085,0},{0.05,0},{0.7915,0},{0.95,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Property Name="MousePassThroughEnabled" Value="True" />
+        <Property Name="Alpha" Value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/common/creditsscreen.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,38 @@
+<GUILayout >
+    <Window Type="SWB/FrameWindow" Name="CreditsWindow" >
+        <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property Name="Text" Value="Credits" />
+        <Property Name="TitlebarFont" Value="DejaVuSerif-12" />
+        <Property Name="CloseButtonAlignment" Value="1" />
+        <Property Name="MousePassThroughEnabled" Value="True" />
+        <Property Name="SizingEnabled" Value="False" />
+        <Property Name="DragMovingEnabled" Value="False" />
+        <Property Name="CloseButtonEnabled" Value="True" />
+        <Property Name="RollUpEnabled" Value="False" />
+        <Property Name="FrameEnabled" Value="True" />
+        <Property Name="TitlebarEnabled" Value="True" />
+        <Property Name="CloseButtonEnabled" Value="False" />
+        <Property Name="Alpha" Value="1.0" />
+        <Property Name="InheritsAlpha" Value="False" />
+
+        <Window Type="SumWarsExtras/ScrollablePaneNoBar" Name="CreditsPane" >
+            <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="ContentPaneAutoSized" Value="True" />
+            <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+
+            <!-- The top side where the player picture, and main information are displayed -->
+            <Window Type="SWB/StaticText" Name="CreditsText" >
+                <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{5.0,0}}" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="Alpha" Value="1.0" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="BackgroundEnabled" Value="True" />
+                <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="Font" Value="DejaVuSerif-12" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/common/errordialogwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="TaharezLook/StaticImage" Name="ErrorDialogWindow" >
+        <Property Name="Image" Value="set:Misc image:QuestionDialog" />
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Window Type="TaharezLook/Button" Name="ErrorDialogConfirmButton" >
+            <Property Name="HoverImage" Value="set:MainMenu image:SPBtnHover" />
+            <Property Name="NormalImage" Value="set:MainMenu image:SPBtnNormal" />
+            <Property Name="PushedImage" Value="set:MainMenu image:SPBtnPushed" />
+            <Property Name="DisabledImage" Value="set:MainMenu image:SPBtnNormal" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6,0},{0.6,0},{0.75,0}}" />
+        </Window>
+        <Window Type="TaharezLook/StaticText" Name="ErrorDialogLabel" >
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedAreaRect" Value="{{0.120732,0},{0.327987,0},{0.889024,0},{0.439308,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- a/share/resources/gui/layouts/common/hostgamewindow.layout	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/layouts/common/hostgamewindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -1,9 +1,7 @@
 <GUILayout >
     <Window Type="SWB/FrameWindow" Name="HostGameWindow" >
-        <Property Name="Image" Value="set:OptionsWindow image:Background" />
         <Property Name="FrameEnabled" Value="True" />
         <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
-        <Property Name="BackgroundEnabled" Value="False" />
         <Property Name="Text" Value="Host game" />
         <Property Name="SizingEnabled" Value="False" />
         <Property Name="DragMovingEnabled" Value="False" />
--- a/share/resources/gui/layouts/common/joingamewindow.layout	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/layouts/common/joingamewindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -2,10 +2,8 @@
 
 <GUILayout >
     <Window Type="SWB/FrameWindow" Name="JoinGameWindow" >
-        <Property Name="Image" Value="set:OptionsWindow image:Background" />
         <Property Name="FrameEnabled" Value="True" />
         <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
-        <Property Name="BackgroundEnabled" Value="False" />
         <Property Name="SizingEnabled" Value="False" />
         <Property Name="DragMovingEnabled" Value="False" />
         <Property Name="CloseButtonEnabled" Value="True" />
--- a/share/resources/gui/layouts/common/messagequestionwindow.layout	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/layouts/common/messagequestionwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,6 @@
     <Window Type="SWB/FrameWindow" Name="QuestionInfoRoot" >
         <Property Name="FrameEnabled" Value="True" />
         <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
-        <Property Name="BackgroundEnabled" Value="False" />
         <Property Name="MousePassThroughEnabled" Value="True" />
         <Property Name="Text" Value="Confirm" />
         <Property Name="SizingEnabled" Value="False" />
--- a/share/resources/gui/layouts/common/minimapwindow.layout	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/layouts/common/minimapwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -2,7 +2,6 @@
     <Window Type="SWB/FrameWindow" Name="MinimapWindow" >
         <Property Name="FrameEnabled" Value="False" />
         <Property Name="UnifiedAreaRect" Value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
-        <Property Name="BackgroundEnabled" Value="False" />
         <Property Name="MousePassThroughEnabled" Value="True" />
         <Property Name="TitlebarEnabled" Value="False" />
         <Property Name="CloseButtonEnabled" Value="False" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui/layouts/common/saveitem.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,43 @@
+<GUILayout >
+    <Window Type="SWB/Button" Name="SaveItemRoot" >
+        <Property Name="Alpha" Value="0.5" />
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0.2,0}}" />
+
+        <Window Type="SWB/StaticText" Name="SaveItemRoot_Name" >
+            <Property Name="Text" Value="CharacterName" />
+            <Property Name="HorzExtent" Value="165" />
+            <Property Name="VertExtent" Value="23.8451" />
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedAreaRect" Value="{{0.293234,0},{0.0861111,0},{0.814916,0},{0.544444,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+        </Window>
+
+        <Window Type="SWB/StaticText" Name="SaveItemRoot_DecriptionLabel" >
+            <Property Name="Text" Value="Level 5 Fencer" />
+            <Property Name="HorzExtent" Value="140" />
+            <Property Name="VertExtent" Value="24.0283" />
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedAreaRect" Value="{{0.26,0},{0.559288,0},{0.83,0},{0.864844,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+        </Window>
+
+        <Window Type="SWB/StaticImage" Name="SaveItemRoot_Avatar" >
+            <Property Name="Image" Value="set:MainMenu image:Logo" />
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="UnifiedAreaRect" Value="{{0.041435,0},{0.102552,0},{0.239047,0},{0.924156,0}}" />
+        </Window>
+
+        <Window Type="SWB/ImageButton" Name="SaveItemRoot_DelChar" >
+            <Property Name="HoverImage" Value="set:MainMenu image:DelCharBtnHover" />
+            <Property Name="NormalImage" Value="set:MainMenu image:DelCharBtnNormal" />
+            <Property Name="PushedImage" Value="set:MainMenu image:DelCharBtnPushed" />
+            <Property Name="UnifiedAreaRect" Value="{{0.891602,0},{0.265625,0},{0.983398,0},{0.736981,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- a/share/resources/gui/layouts/mainmenu.layout	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/layouts/mainmenu.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -10,34 +10,29 @@
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.732617,0},{0.0434896,0},{0.986523,0},{0.100782,0}}" />
             <Property Name="Text" Value="Singleplayer" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
         </Window>
         
         <Window Type="SWB/Button" Name="ServerJoinButton" >
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.732812,0},{0.103906,0},{0.986718,0},{0.161198,0}}" />
             <Property Name="Text" Value="Join Game" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
         </Window>
         
         <Window Type="SWB/Button" Name="ServerHostButton" >
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.732031,0},{0.166927,0},{0.985937,0},{0.224219,0}}" />
             <Property Name="Text" Value="Host Game" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
         </Window>
         
         <Window Type="SWB/Button" Name="CreditsButton" >
             <Property Name="Text" Value="Credits" />
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.575,0},{0.913542,0},{0.766406,0},{0.955209,0}}" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
         </Window>
         
         <Window Type="SWB/Button" Name="MainOptionsButton" >
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.380859,0},{0.914062,0},{0.572265,0},{0.955728,0}}" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
             <Property Name="Text" Value="Options" />
         </Window>
         
@@ -45,13 +40,14 @@
             <Property Name="Text" Value="Quit" />
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.769531,0},{0.914062,0},{0.960937,0},{0.955729,0}}" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
         </Window>
-	<Window Type="SWB/Button" Name="LoginButton" >
+        
+        <Window Type="SWB/Button" Name="LoginButton" >
             <Property Name="Text" Value="Login" />
             <Property Name="InheritsAlpha" Value="False" />
             <Property Name="UnifiedAreaRect" Value="{{0.25531,0},{0.914062,0},{0.37,0},{0.955729,0}}" />
         </Window>
+        
         <Window Type="SWB/StaticText" Name="SumwarsVersionLabel" >
             <Property Name="Text" Value="VersionLabel" />
             <Property Name="Alpha" Value="0.7" />
@@ -60,7 +56,8 @@
             <Property Name="UnifiedAreaRect" Value="{{0.583594,0},{0.96901,0},{0.958594,0},{0.992448,0}}" />
             <Property Name="BackgroundEnabled" Value="False" />
         </Window>
-	<Window Type="SWB/StaticText" Name="SumwarsOnlineIndicatorLabel" >
+        
+        <Window Type="SWB/StaticText" Name="SumwarsOnlineIndicatorLabel" >
             <Property Name="Text" Value="Not logged in." />
             <Property Name="Alpha" Value="0.7" />
             <Property Name="HorzExtent" Value="100" />
--- a/share/resources/gui/layouts/saveitem.layout	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-<GUILayout >
-    <Window Type="SWB/Button" Name="SaveItemRoot" >
-        <Property Name="Alpha" Value="0.5" />
-        <Property Name="InheritsAlpha" Value="False" />
-        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0.2,0}}" />
-
-        <Window Type="SWB/StaticText" Name="SaveItemRoot/Name" >
-            <Property Name="Text" Value="CharacterName" />
-            <Property Name="HorzExtent" Value="165" />
-            <Property Name="VertExtent" Value="23.8451" />
-            <Property Name="FrameEnabled" Value="False" />
-            <Property Name="InheritsAlpha" Value="False" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
-            <Property Name="UnifiedAreaRect" Value="{{0.293234,0},{0.0861111,0},{0.814916,0},{0.544444,0}}" />
-            <Property Name="BackgroundEnabled" Value="False" />
-        </Window>
-
-        <Window Type="SWB/StaticText" Name="SaveItemRoot/DecriptionLabel" >
-            <Property Name="Text" Value="Level 5 Fencer" />
-            <Property Name="HorzExtent" Value="140" />
-            <Property Name="VertExtent" Value="24.0283" />
-            <Property Name="FrameEnabled" Value="False" />
-            <Property Name="InheritsAlpha" Value="False" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
-            <Property Name="UnifiedAreaRect" Value="{{0.26,0},{0.559288,0},{0.83,0},{0.864844,0}}" />
-            <Property Name="BackgroundEnabled" Value="False" />
-        </Window>
-
-        <Window Type="SWB/StaticImage" Name="SaveItemRoot/Avatar" >
-            <Property Name="Image" Value="set:MainMenu image:Logo" />
-            <Property Name="FrameEnabled" Value="False" />
-            <Property Name="InheritsAlpha" Value="False" />
-            <Property Name="UnifiedAreaRect" Value="{{0.041435,0},{0.102552,0},{0.239047,0},{0.924156,0}}" />
-        </Window>
-
-        <Window Type="SWB/ImageButton" Name="SaveItemRoot/DelChar" >
-            <Property Name="HoverImage" Value="set:MainMenu image:DelCharBtnHover" />
-            <Property Name="NormalImage" Value="set:MainMenu image:DelCharBtnNormal" />
-            <Property Name="PushedImage" Value="set:MainMenu image:DelCharBtnPushed" />
-            <Property Name="UnifiedAreaRect" Value="{{0.891602,0},{0.265625,0},{0.983398,0},{0.736981,0}}" />
-        </Window>
-    </Window>
-</GUILayout>
--- a/share/resources/gui/looknfeel/Resummoned.looknfeel	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/looknfeel/Resummoned.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -4732,91 +4732,6 @@
         <StateImagery name="Disabled" />
     </WidgetLook>
 
- <!--
-    ***************************************************
-        Resummoned/ScrollablePaneNoBar
-    ***************************************************
-    -->
-    <WidgetLook name="Resummoned/ScrollablePaneNoBar">
-        <NamedArea name="ViewableArea">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <Child  type="Resummoned/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
-                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
-            </Area>
-            <VertAlignment type="BottomAligned" />
-        </Child>
-        <Child  type="Resummoned/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
-            </Area>
-            <HorzAlignment type="RightAligned" />
-        </Child>
-        <StateImagery name="Enabled" />
-        <StateImagery name="Disabled" />
-    </WidgetLook>
-
-
     <!--
     ***************************************************
         Resummoned/TabButton
--- a/share/resources/gui/looknfeel/SWB.looknfeel	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/looknfeel/SWB.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -3731,91 +3731,6 @@
         <StateImagery name="Disabled" />
     </WidgetLook>
 
- <!--
-    ***************************************************
-        SWB/ScrollablePaneNoBar
-    ***************************************************
-    -->
-    <WidgetLook name="SWB/ScrollablePaneNoBar">
-        <NamedArea name="ViewableArea">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
-                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
-            </Area>
-            <VertAlignment type="BottomAligned" />
-        </Child>
-        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
-            </Area>
-            <HorzAlignment type="RightAligned" />
-        </Child>
-        <StateImagery name="Enabled" />
-        <StateImagery name="Disabled" />
-    </WidgetLook>
-
-
 
     <!--
     ***************************************************
--- a/share/resources/gui/looknfeel/SumWarsExtras.looknfeel	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/looknfeel/SumWarsExtras.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -124,5 +124,468 @@
         <StateImagery name="DisabledProgress" />
     </WidgetLook>
 
+
+    <!--
+    ***************************************************
+        SumWarsExtras/ScrollablePaneNoBar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/ScrollablePaneNoBar">
+        <NamedArea name="ViewableArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <UnifiedDim scale="1" type="BottomEdge">
+                        <DimOperator op="Subtract">
+                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <UnifiedDim scale="1" type="RightEdge">
+                        <DimOperator op="Subtract">
+                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <UnifiedDim scale="1" type="RightEdge">
+                        <DimOperator op="Subtract">
+                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <UnifiedDim scale="1" type="BottomEdge">
+                        <DimOperator op="Subtract">
+                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SumWarsExtras/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HorizontalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HorizontalScrollbarThumb">
+        <Property name="HorzFree" value="True" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image type="LeftEdge" imageset="SumWarsExtras" image="MiniHorzScrollThumbLeftNormal" />
+                <Image type="RightEdge" imageset="SumWarsExtras" image="MiniHorzScrollThumbRightNormal" />
+                <Image type="Background" imageset="SumWarsExtras" image="MiniHorzScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image type="LeftEdge" imageset="SumWarsExtras" image="MiniHorzScrollThumbLeftHover" />
+                <Image type="RightEdge" imageset="SumWarsExtras" image="MiniHorzScrollThumbRightHover" />
+                <Image type="Background" imageset="SumWarsExtras" image="MiniHorzScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HorizontalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HorizontalScrollbar">
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <UnifiedDim scale="1.0" type="RightEdge">
+                        <DimOperator op="Subtract">
+                            <AbsoluteDim value="9" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="set:SumWarsExtras image:MiniHorzScrollRightNormal" />
+            <Property name="HoverImage" value="set:SumWarsExtras image:MiniHorzScrollRightHover" />
+            <Property name="PushedImage" value="set:SumWarsExtras image:MiniHorzScrollRightNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="set:SumWarsExtras image:MiniHorzScrollLeftNormal" />
+            <Property name="HoverImage" value="set:SumWarsExtras image:MiniHorzScrollLeftHover" />
+            <Property name="PushedImage" value="set:SumWarsExtras image:MiniHorzScrollLeftNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="UnifiedMinSize" value="{{0,25},{0,0}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="9" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" >
+                        <UnifiedDim scale="1.0" type="RightEdge">
+                            <DimOperator op="Subtract">
+                                <AbsoluteDim value="9" />
+                            </DimOperator>
+                        </UnifiedDim>
+                    </Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image imageset="SumWarsExtras" image="MiniHorzScrollBarSegment" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/VerticalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/VerticalScrollbarThumb">
+        <Property name="VertFree" value="True" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image type="TopEdge" imageset="SumWarsExtras" image="MiniVertScrollThumbTopNormal" />
+                <Image type="BottomEdge" imageset="SumWarsExtras" image="MiniVertScrollThumbBottomNormal" />
+                <Image type="Background" imageset="SumWarsExtras" image="MiniVertScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image type="TopEdge" imageset="SumWarsExtras" image="MiniVertScrollThumbTopHover" />
+                <Image type="BottomEdge" imageset="SumWarsExtras" image="MiniVertScrollThumbBottomHover" />
+                <Image type="Background" imageset="SumWarsExtras" image="MiniVertScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/VerticalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/VerticalScrollbar">
+        <Property name="VerticalScrollbar" value="True" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <UnifiedDim scale="1.0" type="BottomEdge">
+                        <DimOperator op="Subtract">
+                            <AbsoluteDim value="9" />
+                        </DimOperator>
+                    </UnifiedDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="9" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NormalImage" value="set:SumWarsExtras image:MiniVertScrollDownNormal" />
+            <Property name="HoverImage" value="set:SumWarsExtras image:MiniVertScrollDownHover" />
+            <Property name="PushedImage" value="set:SumWarsExtras image:MiniVertScrollDownNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="9" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="set:SumWarsExtras image:MiniVertScrollUpNormal" />
+            <Property name="HoverImage" value="set:SumWarsExtras image:MiniVertScrollUpHover" />
+            <Property name="PushedImage" value="set:SumWarsExtras image:MiniVertScrollUpNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/VerticalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.1" type="Height" /></Dim>
+            </Area>
+            <Property name="UnifiedMinSize" value="{{0,0},{0,25}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="9" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <UnifiedDim scale="1.0" type="BottomEdge">
+                            <DimOperator op="Subtract">
+                                <AbsoluteDim value="9" />
+                            </DimOperator>
+                        </UnifiedDim>
+                    </Dim>
+                </Area>
+                <Image imageset="SumWarsExtras" image="MiniVertScrollBarSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="CentreAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/ImageButton
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/ImageButton">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="pushed">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="PushedImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="disabled">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="DisabledImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
 </Falagard>
 
--- a/share/resources/gui/looknfeel/TaharezLook.looknfeel	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/looknfeel/TaharezLook.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -3353,90 +3353,6 @@
         <StateImagery name="Disabled" />
     </WidgetLook>
 
- <!--
-    ***************************************************
-        TaharezLook/ScrollablePaneNoBar
-    ***************************************************
-    -->
-    <WidgetLook name="TaharezLook/ScrollablePaneNoBar">
-        <NamedArea name="ViewableArea">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
-            </Area>
-        </NamedArea>
-        <NamedArea name="ViewableAreaHVScroll">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="RightEdge" >
-                    <UnifiedDim scale="1" type="RightEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-                <Dim type="BottomEdge" >
-                    <UnifiedDim scale="1" type="BottomEdge">
-                        <DimOperator op="Subtract">
-                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
-                        </DimOperator>
-                    </UnifiedDim>
-                </Dim>
-            </Area>
-        </NamedArea>
-        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
-                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
-            </Area>
-            <VertAlignment type="BottomAligned" />
-        </Child>
-        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
-            <Area>
-                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
-                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
-            </Area>
-            <HorzAlignment type="RightAligned" />
-        </Child>
-        <StateImagery name="Enabled" />
-        <StateImagery name="Disabled" />
-    </WidgetLook>
-
 
     <!--
     ***************************************************
@@ -3657,181 +3573,6 @@
 
     <!--
     ***************************************************
-        TaharezLook/brownTabButton
-    ***************************************************
-    -->
-    <WidgetLook name="TaharezLook/brownTabButton">
-        <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" />
-        <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
-        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
-        <PropertyDefinition name="SelectedTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
-        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
-        <ImagerySection name="label">
-            <TextComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <VertFormat type="CentreAligned" />
-                <HorzFormat type="CentreAligned" />
-            </TextComponent>
-        </ImagerySection>
-        <ImagerySection name="top_normal">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonNormal" />
-            </FrameComponent>
-        </ImagerySection>
-        <ImagerySection name="bot_normal">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonNormal" />
-            </FrameComponent>
-        </ImagerySection>
-        <ImagerySection name="top_hover">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonNormal" />
-            </FrameComponent>
-        </ImagerySection>
-        <ImagerySection name="bot_hover">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonNormal" />
-            </FrameComponent>
-        </ImagerySection>
-        <ImagerySection name="top_selected">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonSelected" />
-            </FrameComponent>
-        </ImagerySection>
-        <ImagerySection name="bot_selected">
-            <FrameComponent>
-                <Area>
-                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
-                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
-                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
-                </Area>
-                <Image type="Background" imageset="SkillTree" image="TabButtonSelected" />
-            </FrameComponent>
-        </ImagerySection>
-        <StateImagery name="TopNormal">
-            <Layer>
-                <Section section="top_normal" />
-                <Section section="label">
-                    <ColourProperty name="NormalTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="BottomNormal">
-            <Layer>
-                <Section section="bot_normal" />
-                <Section section="label">
-                    <ColourProperty name="NormalTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="TopHover">
-            <Layer>
-                <Section section="top_hover" />
-                <Section section="label">
-                    <ColourProperty name="HoverTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="BottomHover">
-            <Layer>
-                <Section section="bot_hover" />
-                <Section section="label">
-                    <ColourProperty name="HoverTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="TopSelected">
-            <Layer>
-                <Section section="top_selected" />
-                <Section section="label">
-                    <ColourProperty name="SelectedTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="BottomSelected">
-            <Layer>
-                <Section section="bot_selected" />
-                <Section section="label">
-                    <ColourProperty name="SelectedTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="TopPushed">
-            <Layer>
-                <Section section="top_normal" />
-                <Section section="label">
-                    <ColourProperty name="PushedTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="BottomPushed">
-            <Layer>
-                <Section section="bot_normal" />
-                <Section section="label">
-                    <ColourProperty name="PushedTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="TopDisabled">
-            <Layer>
-                <Section section="top_normal">
-                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
-                </Section>
-                <Section section="label">
-                    <ColourProperty name="DisabledTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-        <StateImagery name="BottomDisabled">
-            <Layer>
-                <Section section="bot_normal">
-                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
-                </Section>
-                <Section section="label">
-                    <ColourProperty name="DisabledTextColour" />
-                </Section>
-            </Layer>
-        </StateImagery>
-    </WidgetLook>
-    
-    <!--
-    ***************************************************
         TaharezLook/TabContentPane
     ***************************************************
     -->
--- a/share/resources/gui/schemes/Resummoned.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/Resummoned.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -89,7 +89,6 @@
   <FalagardMapping WindowType="Resummoned/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="Resummoned/StaticImage" />
   <FalagardMapping WindowType="Resummoned/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="Resummoned/StaticText" />
   <FalagardMapping WindowType="Resummoned/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="Resummoned/ScrollablePane" />
-  <FalagardMapping WindowType="Resummoned/ScrollablePaneNoBar" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="Resummoned/ScrollablePaneNoBar" />
   <FalagardMapping WindowType="Resummoned/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="Resummoned/ItemListbox" />
   <FalagardMapping WindowType="Resummoned/ListboxItem" TargetType="CEGUI/ItemEntry"   Renderer="Falagard/ItemEntry"   LookNFeel="Resummoned/ListboxItem" />
   <FalagardMapping WindowType="Resummoned/GroupBox" TargetType="CEGUI/GroupBox"   Renderer="Falagard/Default"   LookNFeel="Resummoned/GroupBox" />
--- a/share/resources/gui/schemes/SWB.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/SWB.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -46,7 +46,6 @@
   <FalagardMapping WindowType="SWB/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="SWB/Checkbox" />
   <FalagardMapping WindowType="SWB/RoundedPanelFrame"      TargetType="DefaultWindow"  Renderer="Falagard/Button"       LookNFeel="SWB/RoundedPanelFrame" />
   <FalagardMapping WindowType="SWB/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="SWB/ScrollablePane" />
-  <FalagardMapping WindowType="SWB/ScrollablePaneNoBar" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="SWB/ScrollablePaneNoBar" />
   <FalagardMapping WindowType="SWB/SimplePanelFrame"      TargetType="DefaultWindow"  Renderer="Falagard/Button"       LookNFeel="SWB/SimplePanelFrame" />
   <FalagardMapping WindowType="SWB/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="SWB/Spinner" />
   <FalagardMapping WindowType="SWB/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="SWB/StaticImage" />
--- a/share/resources/gui/schemes/SumWarsExtras.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/SumWarsExtras.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -14,5 +14,11 @@
   
 	<FalagardMapping WindowType="SumWarsExtras/HPProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="SumWarsExtras/HPProgressBar" />
 	<FalagardMapping WindowType="SumWarsExtras/HPProgressOrbHighlight" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="SumWarsExtras/HPProgressOrbHighlight" />
+	<FalagardMapping WindowType="SumWarsExtras/ScrollablePaneNoBar" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="SumWarsExtras/ScrollablePaneNoBar" />
+	<FalagardMapping WindowType="SumWarsExtras/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="SumWarsExtras/VerticalScrollbar" />
+	<FalagardMapping WindowType="SumWarsExtras/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="SumWarsExtras/HorizontalScrollbar" />
+	<FalagardMapping WindowType="SumWarsExtras/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="SumWarsExtras/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="SumWarsExtras/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="SumWarsExtras/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="SumWarsExtras/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="SumWarsExtras/ImageButton" />
 
 </GUIScheme>
--- a/share/resources/gui/schemes/TaharezLook.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/TaharezLook.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -42,7 +42,6 @@
 	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
 	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
 	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
-	<FalagardMapping WindowType="TaharezLook/brownTabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/brownTabButton" />
 	<FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
 	<FalagardMapping WindowType="TaharezLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabContentPane" />
 	<FalagardMapping WindowType="TaharezLook/TabButtonPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabButtonPane" />
@@ -56,7 +55,6 @@
 	<FalagardMapping WindowType="TaharezLook/Slider"      TargetType="CEGUI/Slider"      Renderer="Falagard/Slider"  LookNFeel="TaharezLook/Slider" />
 	<FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button"  LookNFeel="TaharezLook/SliderThumb" />
 	<FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
-	<FalagardMapping WindowType="TaharezLook/ScrollablePaneNoBar" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePaneNoBar" />
 	<FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
 	<FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
 	<FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
--- a/share/resources/gui/schemes/TaharezLookWidgetAliases.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/TaharezLookWidgetAliases.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -25,7 +25,6 @@
 	<WindowAlias Alias="Taharez StaticImage" Target="TaharezLook/StaticImage" />
 	<WindowAlias Alias="Taharez StaticText" Target="TaharezLook/StaticText" />
 	<WindowAlias Alias="Taharez Tab Button" Target="TaharezLook/TabButton" />
-	<WindowAlias Alias="Taharez Brown Tab Button" Target="TaharezLook/brownTabButton" />
 	<WindowAlias Alias="Taharez Tab Pane" Target="TaharezLook/TabPane" />
 	<WindowAlias Alias="Taharez Tab Control" Target="TaharezLook/TabControl" />
 	<WindowAlias Alias="Taharez Titlebar" Target="TaharezLook/Titlebar" />
--- a/share/resources/gui/schemes/TaharezLookWidgets.scheme	Sat Jan 25 11:22:23 2014 +0100
+++ b/share/resources/gui/schemes/TaharezLookWidgets.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -23,7 +23,6 @@
 	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
 	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
 	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
-	<FalagardMapping WindowType="TaharezLook/brownTabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/brownTabButton" />
 	<FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
 	<FalagardMapping WindowType="TaharezLook/TabPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabPane" />
 	<FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/animations/Animation.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,69 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Animations" type="animAnimationsType" />
+	<xsd:complexType name="animAnimationsType">
+        <xsd:sequence>
+            <xsd:element name="AnimationDefinition" type="animAnimationDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="animAnimationDefinitionType">
+        <xsd:sequence>
+            <xsd:element name="Affector" type="animAffectorType" minOccurs="1" maxOccurs="unbounded" />
+            <xsd:element name="Subscription" type="animSubscriptionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="duration" type="xsd:decimal" use="required" />
+		<xsd:attribute name="replayMode" type="animReplayModeEnum" use="optional" default="loop" />
+		<xsd:attribute name="autoStart" type="xsd:boolean" use="optional" default="false" />
+	</xsd:complexType>
+	<xsd:complexType name="animAffectorType">
+        <xsd:sequence>
+            <xsd:element name="KeyFrame" type="animKeyFrameType" minOccurs="1" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="applicationMethod" type="animApplicationMethodEnum" use="optional" default="absolute" />
+		<xsd:attribute name="property" type="xsd:string" use="required" />
+		<xsd:attribute name="interpolator" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="animKeyFrameType">
+		<xsd:attribute name="position" type="xsd:decimal" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="progression" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="sourceProperty" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+	<xsd:complexType name="animSubscriptionType">
+		<xsd:attribute name="event" type="xsd:string" use="required" />
+		<xsd:attribute name="action" type="animActionEnum" use="required" />
+	</xsd:complexType>
+    <xsd:simpleType name="animReplayModeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="once" />
+            <xsd:enumeration value="loop" />
+            <xsd:enumeration value="bounce" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animApplicationMethodEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="absolute" />
+            <xsd:enumeration value="relative" />
+            <xsd:enumeration value="relative multiply" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animProgressionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="linear" />
+            <xsd:enumeration value="discrete" />
+            <xsd:enumeration value="quadratic accelerating" />
+            <xsd:enumeration value="quadratic decelerating" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animActionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Start" />
+            <xsd:enumeration value="Stop" />
+            <xsd:enumeration value="Pause" />
+            <xsd:enumeration value="Unpause" />
+            <xsd:enumeration value="TogglePause" />
+        </xsd:restriction>
+    </xsd:simpleType>
+</xsd:schema>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/animations/ControlPanelAnimations.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,21 @@
+<Animations>
+    <AnimationDefinition name="HealthbarAnimation" duration="12.42" replayMode="loop">
+      <Affector property="HighlightModifier" interpolator="Colour">
+          <!--<KeyFrame position="0.0" value="1.0" />
+          <KeyFrame position="0.4" value="0.5" />-->
+          <KeyFrame position="0" value="FFBBA075" />
+          <KeyFrame position="6" value="AABBA075" />
+          <KeyFrame position="12.42" value="FFBBA075" />
+      </Affector>
+      <!--
+      <Affector property="HighlightRotation" interpolator="float">
+          <KeyFrame position="0.0" value="360" />
+          <KeyFrame position="2" value="340" />
+          <KeyFrame position="5" value="260" />
+          <KeyFrame position="8" value="100" />
+          <KeyFrame position="11" value="10" />
+          <KeyFrame position="12.42" value="0" />
+      </Affector>
+      -->
+    </AnimationDefinition>
+</Animations>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/animations/InventoryAnimations.xml	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,14 @@
+<Animations>
+  <AnimationDefinition name="SlotFadeIn" duration="0.3" replayMode="once">
+    <Affector property="Alpha" interpolator="float">
+      <KeyFrame position="0.0" value="0.0" />
+      <KeyFrame position="0.3" value="1.0" />
+    </Affector>
+  </AnimationDefinition>
+  <AnimationDefinition name="SlotFadeOut" duration="0.3" replayMode="once">
+    <Affector property="Alpha" interpolator="float">
+      <KeyFrame position="0.0" value="1.0" />
+      <KeyFrame position="0.3" value="0.0" />
+    </Affector>
+  </AnimationDefinition>
+</Animations>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/configs/CEGUIConfig.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+    <xsd:element name="CEGUIConfig" type="CEGUIConfigType"/>
+
+    <xsd:complexType name="CEGUIConfigType">
+        <xsd:sequence>
+            <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                <xsd:element name="Logging" type="loggingType" />
+                <xsd:element name="AutoLoad" type="autoLoadType" />
+                <xsd:element name="ResourceDirectory" type="resourceDirectoryType" />
+                <xsd:element name="DefaultResourceGroup" type="defaultResourceGroupType" />
+                <xsd:element name="Scripting" type="scriptingType" />
+                <xsd:element name="DefaultXMLParser" type="defaultObjectType" />
+                <xsd:element name="DefaultImageCodec" type="defaultObjectType" />
+                <xsd:element name="DefaultFont" type="defaultObjectType" />
+                <xsd:element name="DefaultMouseCursor" type="defaultMouseCursorType" />
+                <xsd:element name="DefaultTooltip" type="defaultObjectType" />
+                <xsd:element name="DefaultGUISheet" type="defaultObjectType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="loggingType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="filename" type="xsd:string" use="optional" default="CEGUI.log" />
+                <xsd:attribute name="level" type="logLevel" use="optional" default="Standard" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="autoLoadType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="type" type="resourceType" use="required" />
+                <xsd:attribute name="group" type="xsd:string" use="optional" default="" />
+                <xsd:attribute name="pattern" type="xsd:string" use="optional" default="*" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="resourceDirectoryType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="group" type="xsd:string" use="required" />
+                <xsd:attribute name="directory" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultResourceGroupType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="type" type="resourceType" use="optional" default="Default" />
+                <xsd:attribute name="group" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="scriptingType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="initScript" type="xsd:string" use="optional" default="" />
+                <xsd:attribute name="terminateScript" type="xsd:string" use="optional" default="" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultObjectType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultMouseCursorType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="imageset" type="xsd:string" use="required" />
+                <xsd:attribute name="image" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:simpleType name="logLevel">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Errors"/>
+            <xsd:enumeration value="Standard"/>
+            <xsd:enumeration value="Informative"/>
+            <xsd:enumeration value="Insane"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:simpleType name="resourceType">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Imageset"/>
+            <xsd:enumeration value="Font"/>
+            <xsd:enumeration value="Scheme"/>
+            <xsd:enumeration value="LookNFeel"/>
+            <xsd:enumeration value="Layout"/>
+            <xsd:enumeration value="Script"/>
+            <xsd:enumeration value="XMLSchema"/>
+            <xsd:enumeration value="Default"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_councilMage.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_councilMage" imagefile="emo_councilMage.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_councilMageCrystal.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_councilMageCrystal" imagefile="emo_councilMageCrystal.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_derred.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_derred" imagefile="emo_derred.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_farmer.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_farmer" imagefile="emo_farmer.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_general.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_general" imagefile="emo_greif.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_gertlinde.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_gertlinde" imagefile="emo_gertlinde.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_ireana.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_ireana" imagefile="emo_ireana.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_rogue.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_rogue" imagefile="emo_rogue.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_tolec.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_tolec" imagefile="emo_tolec.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+	<Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/emotionsets/emo_warrior.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="emo_warrior" imagefile="emo_warrior.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="normal" xPos="1" yPos="1" width="100" height="100" />
+    <Image name="surprised" xPos="102" yPos="1" width="100" height="100" />
+    <Image name="thoughtful" xPos="203" yPos="1" width="100" height="100" />
+    <Image name="happy" xPos="304" yPos="1" width="100" height="100" />
+    <Image name="amused" xPos="405" yPos="1" width="100" height="100" />
+    <Image name="excited" xPos="1" yPos="102" width="100" height="100" />
+    <Image name="inlove" xPos="102" yPos="102" width="100" height="100" />
+    <Image name="bored" xPos="203" yPos="102" width="100" height="100" />
+    <Image name="unhappy" xPos="304" yPos="102" width="100" height="100" />
+    <Image name="sad" xPos="405" yPos="102" width="100" height="100" />
+    <Image name="pain" xPos="1" yPos="203" width="100" height="100" />
+    <Image name="sneer" xPos="102" yPos="203" width="100" height="100" />
+    <Image name="grin" xPos="203" yPos="203" width="100" height="100" />
+    <Image name="offended" xPos="304" yPos="203" width="100" height="100" />
+    <Image name="threaten" xPos="405" yPos="203" width="100" height="100" />
+    <Image name="angry" xPos="1" yPos="304" width="100" height="100" />
+    <Image name="warcry" xPos="102" yPos="304" width="100" height="100" />
+    <Image name="injured" xPos="203" yPos="304" width="100" height="100" />
+    <Image name="injured2" xPos="304" yPos="304" width="100" height="100" />
+    <Image name="injured3" xPos="405" yPos="304" width="100" height="100" />
+    <Image name="fear" xPos="1" yPos="405" width="100" height="100" />
+    <Image name="panic" xPos="102" yPos="405" width="100" height="100" />
+    <Image name="aloof" xPos="203" yPos="405" width="100" height="100" />
+    <Image name="disgust" xPos="304" yPos="405" width="100" height="100" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSans-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-10" filename="DejaVuSans.ttf" type="FreeType" size="10" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSans-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-12" filename="DejaVuSans.ttf" type="FreeType" size="12" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSerif-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-10" filename="DejaVuSerif.ttf" type="FreeType" size="10" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSerif-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-12" filename="DejaVuSerif.ttf" type="FreeType" size="12" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSerif-16.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-16" filename="DejaVuSerif.ttf" type="FreeType" size="16" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/004_003/DejaVuSerif-8.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-8" filename="DejaVuSerif.ttf" type="FreeType" size="8" nativeHorzRes="1024" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSans-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-10" filename="DejaVuSans.ttf" type="FreeType" size="10" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSans-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-12" filename="DejaVuSans.ttf" type="FreeType" size="12" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSerif-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-10" filename="DejaVuSerif.ttf" type="FreeType" size="10" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSerif-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-12" filename="DejaVuSerif.ttf" type="FreeType" size="12" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSerif-16.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-16" filename="DejaVuSerif.ttf" type="FreeType" size="16" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/005_004/DejaVuSerif-8.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-8" filename="DejaVuSerif.ttf" type="FreeType" size="8" nativeHorzRes="960" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSans-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-10" filename="DejaVuSans.ttf" type="FreeType" size="10" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSans-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-12" filename="DejaVuSans.ttf" type="FreeType" size="12" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSerif-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-10" filename="DejaVuSerif.ttf" type="FreeType" size="10" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSerif-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-12" filename="DejaVuSerif.ttf" type="FreeType" size="12" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSerif-16.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-16" filename="DejaVuSerif.ttf" type="FreeType" size="16" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_009/DejaVuSerif-8.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-8" filename="DejaVuSerif.ttf" type="FreeType" size="8" nativeHorzRes="1366" nativeVertRes="768" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSans-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-10" filename="DejaVuSans.ttf" type="FreeType" size="10" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSans-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSans-12" filename="DejaVuSans.ttf" type="FreeType" size="12" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSerif-10.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-10" filename="DejaVuSerif.ttf" type="FreeType" size="10" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSerif-12.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-12" filename="DejaVuSerif.ttf" type="FreeType" size="12" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSerif-16.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-16" filename="DejaVuSerif.ttf" type="FreeType" size="16" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/016_010/DejaVuSerif-8.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="DejaVuSerif-8" filename="DejaVuSerif.ttf" type="FreeType" size="8" nativeHorzRes="1280" nativeVertRes="800" autoScaled="vertical"/>
Binary file share/resources/gui_0.8/fonts/DejaVuSans.ttf has changed
Binary file share/resources/gui_0.8/fonts/DejaVuSerif.ttf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/Fell Types License.txt	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,1 @@
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/Font.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Font" type="FontType" />
+
+	<xsd:complexType name="FontType">
+		<xsd:sequence>
+			<xsd:element name="Mapping" type="MapType" maxOccurs="unbounded" minOccurs="0" />
+		</xsd:sequence>
+		<xsd:attributeGroup ref="FontAttrs" />
+	</xsd:complexType>
+	<xsd:complexType name="MapType">
+		<xsd:attribute name="codepoint" type="xsd:nonNegativeInteger" use="required" />
+		<xsd:attribute name="image" type="xsd:string" use="required" />
+		<xsd:attribute name="horzAdvance" type="xsd:integer" use="optional" default="-1" />
+	</xsd:complexType>
+	<xsd:attributeGroup name="FontAttrs">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="type" use="required">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="FreeType" />
+					<xsd:enumeration value="Pixmap" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="size" type="xsd:nonNegativeInteger" use="optional" default="12" />
+		<xsd:attribute name="nativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="nativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="autoScaled" default="false">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="false" />
+					<xsd:enumeration value="vertical" />
+					<xsd:enumeration value="horizontal" />
+					<xsd:enumeration value="min" />
+					<xsd:enumeration value="max" />
+					<xsd:enumeration value="true" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="antiAlias" type="xsd:boolean" use="optional" default="true" />
+		<xsd:attribute name="lineSpacing" type="xsd:decimal" use="optional" default="0" />
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:attributeGroup>
+</xsd:schema>
Binary file share/resources/gui_0.8/fonts/IMFeENrm29P.ttf has changed
Binary file share/resources/gui_0.8/fonts/IMFeGPsc29P.ttf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/Legal.txt	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,17 @@
+================================================================================
+
+DejaVuSans.ttf is a international TrueType font from the excellent DejaVu font
+package, which is distributed under the conditions of the Bitstream Vera Fonts
+Copyright, which can be found in the DejaVu package.
+
+DejaVu fonts 2.2 (c)2004-2006 Stepan Roh and DejaVu fonts team
+--------------------------------------------------------------
+
+The DejaVu fonts are a font family based on the Bitstream Vera Fonts
+(http://gnome.org/fonts/). Its purpose is to provide a wider range of
+characters (see status.txt for more information) while maintaining the
+original look and feel.
+
+DejaVu fonts are based on Bitstream Vera fonts version 1.10.
+
+================================================================================
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/SWB-L.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="SWB-L" filename="IMFeGPsc29P.ttf" type="FreeType" size="12" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/SWB-M.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="SWB-M" filename="IMFeENrm29P.ttf" type="FreeType" size="10" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/SWB-S.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="SWB-S" filename="IMFeENrm29P.ttf" type="FreeType" size="9" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/SWB-XL.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="SWB-XL" filename="IMFeENrm29P.ttf" type="FreeType" size="14" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/fonts/SWB-XS.font	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<Font version="3" name="SWB-XS" filename="IMFeENrm29P.ttf" type="FreeType" size="8" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="vertical"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/CharacterScreen.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,5 @@
+<Imageset version="2" autoScaled="false" imagefile="CharacterScreen.png" name="CharScreen" nativeHorzRes="800" nativeVertRes="600">
+    <Image height="826" name="Background" width="538" xPos="0" yPos="0" />
+    <Image height="64" name="PlusBtnReleased" width="88" xPos="559" yPos="0" />
+    <Image height="64" name="PlusBtnPressed" width="87" xPos="649" yPos="0" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/ControlPanel.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,29 @@
+<Imageset version="2" autoScaled="false" imagefile="ControlPanel.png" name="ControlPanel" nativeHorzRes="1024" nativeVertRes="768">
+	<Image name="Belt" xPos="10" yPos="10" width="1010" height="123" />
+	<Image height="27" name="SlotNumbers" width="290" xPos="68" yPos="378" />
+
+	<Image name="OptionsButton" xPos="951" yPos="185" width="37" height="37" />
+	<Image name="SaveExitButton" xPos="993" yPos="145" width="37" height="37" />
+	<Image name="OptionsButton_Hover" xPos="951" yPos="364" width="37" height="37" />
+	<Image name="SaveExitButton_Hover" xPos="993" yPos="324" width="37" height="37" />
+
+	<Image name="CharInfoButton_Hover" xPos="866" yPos="324" width="37" height="37" />
+	<Image name="ChatOpenButton_Hover" xPos="866" yPos="364" width="37" height="37" />
+	<Image name="QuestInfoButton_Hover" xPos="909" yPos="324" width="37" height="37" />
+	<Image name="SkillTreeButton_Hover" xPos="909" yPos="364" width="37" height="37" />
+	<Image name="InventoryButton_Hover" xPos="951" yPos="324" width="37" height="37" />
+	<Image name="PartyButton_Hover" xPos="993" yPos="364" width="37" height="37" />
+
+	<Image name="CharInfoButton" xPos="866" yPos="145" width="37" height="37" />
+	<Image name="ChatOpenButton" xPos="866" yPos="185" width="37" height="37" />
+	<Image name="QuestInfoButton" xPos="909" yPos="145" width="37" height="37" />
+	<Image name="SkillTreeButton" xPos="909" yPos="185" width="37" height="37" />
+	<Image name="InventoryButton" xPos="951" yPos="145" width="37" height="37" />
+	<Image name="PartyButton" xPos="993" yPos="185" width="37" height="37" />
+  
+	<Image name="HPHighlight" xPos="164" yPos="146" width="185" height="184" />
+	<Image name="HPBackground" xPos="608" yPos="149" width="185" height="184" />
+	<Image name="HPForeground" xPos="397" yPos="227" width="185" height="184" />
+  
+	<Image name="ProgressBarDimSegment" xPos="220" yPos="409" width="21" height="42" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/Imageset.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="Imageset" type="ImagesetType"/>
+	
+	<xsd:complexType name="ImagesetType">
+		<xsd:sequence>
+			<xsd:element name="Image" type="ImageType" maxOccurs="unbounded"/>
+		</xsd:sequence>
+		<xsd:attribute name="imagefile" type="xsd:string" use="required"/>
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="nativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="nativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="autoScaled" default="false">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="false" />
+					<xsd:enumeration value="vertical" />
+					<xsd:enumeration value="horizontal" />
+					<xsd:enumeration value="min" />
+					<xsd:enumeration value="max" />
+					<xsd:enumeration value="true" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	
+	<xsd:complexType name="ImageType">
+        <xsd:sequence>
+            <xsd:any minOccurs="0" processContents="skip" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="type" type="xsd:string" use="optional" default="BasicImage" />
+		<xsd:anyAttribute processContents="skip" />
+	</xsd:complexType>
+
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/Inventory.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,10 @@
+<Imageset version="2" autoScaled="true" imagefile="Inventory.png" name="Inventory" nativeHorzRes="304" nativeVertRes="424">
+    <Image height="826" name="InvBackground" width="538" xPos="0" yPos="0" />
+    <Image height="1" name="BorderHorz" width="122" xPos="554" yPos="149" />
+    <Image height="144" name="BigSlotBack" width="483" xPos="551" yPos="0" />
+    <Image height="144" name="MediumSlotBack" width="483" xPos="551" yPos="156" />
+    <Image height="142" name="SmallSlotBack" width="481" xPos="554" yPos="313" />
+    <Image height="16" name="GoldPile" width="26" xPos="554" yPos="460" />
+    <Image height="24" name="WeaponSwitchState1" width="93" xPos="583" yPos="460" />
+    <Image height="24" name="WeaponSwitchState2" width="93" xPos="679" yPos="460" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/License.txt	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,64 @@
+*** GUI Imageset license file ***
+This file contains all license information for artwork located in the gui/imageset directory
+
+
+If not declared otherwise, all artwork is released under the authors default license.
+
+
+Artwork provided by: CrazyEddie's GUI (CEGUI) library
+License: MIT
+Visit http://www.cegui.org.uk for more information
+Files:
+	TaharezLook.tga  (Original)
+
+Artwork provided by: Michael Kempf (kemic)
+Default License: CC-BY-SA
+Files:
+	TaharezLook.tga 
+	
+Artwork provided by: Andreas Schönefeld
+Default License: CC-BY-SA
+Files:
+	startscreen.png
+
+Artwork provided by: Andreas Schönefeld, Michael Kempf (kemic), Francesco (hal9000)
+Default License: CC-BY-SA
+Files:
+	skills.png
+	
+Artwork provided by: Psycho
+Default License: CC-BY-SA
+Files:
+	worldMap.png
+
+Artwork provided by: Jorge Avila
+Default License: LGLP 3.0 (also available under CC-BY)
+Files:
+	CharacterScreen.png
+  ControlPanel.png
+  Inventory.png
+  main_menu.png
+  misc.png
+  OptionsWindow.png
+  portrait.png
+  SkillTree.png
+  SumWarsLogo.png
+  TradeWindow.png
+
+Artwork provided by: Augustin Preda (dezGusty)
+Default License: LGPL 3.0 (also available under CC-BY)
+Files:
+  ControlPanel.png
+  Resummoned.png
+  ResummonedCursors.png
+  SumWarsExtras.png
+  SumWarsLogo.png
+	SWB.png
+  SWBCursors.png 
+
+Artwork provided by: J. W. Bjerk
+Default License: GPL 3.0
+For additional details, please visit http://opengameart.org/content/painterly-spell-icons-part-1
+Files:
+	skills.png
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/MainMenu.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<Imageset version="2" autoScaled="false" imagefile="main_menu.png" name="MainMenu" nativeHorzRes="800" nativeVertRes="600">
+    <Image height="234" name="Logo" width="631" xPos="260" yPos="0" />
+    <Image height="49" name="SPBtnNormal" width="255" xPos="2" yPos="1" />
+    <Image height="49" name="SPBtnHover" width="255" xPos="3" yPos="52" />
+    <Image height="49" name="SPBtnPushed" width="255" xPos="3" yPos="102" />
+    <Image height="67" name="DelCharBtnNormal" width="64" xPos="915" yPos="0" />
+    <Image height="67" name="DelCharBtnHover" width="62" xPos="916" yPos="73" />
+    <Image height="67" name="DelCharBtnPushed" width="62" xPos="916" yPos="150" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/OptionsWindow.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,3 @@
+<Imageset version="2" autoScaled="false" imagefile="OptionsWindow.png" name="OptionsWindow" nativeHorzRes="800" nativeVertRes="600">
+    <Image height="745" name="Background" width="798" xPos="0" yPos="0" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/SWB.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,482 @@
+<!--
+SWB - SumWarsBase
+SWB is licensed under the terms of the LGPL license.
+-->
+<!--
+version:      0.1
+Last change:  $LastChangedDate: 2013-01-26 01:26:14 +0200 (S, 26 ian. 2013) $
+-->
+<Imageset version="2" name="SWB" imagefile="SWB.png" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="false" >
+
+  <!-- Suffix Legend: 
+    TL = top left; L = left; BL = bottom left; 
+    T = top; M = middle; B = bottom; 
+    TR = top right; R = right; BR = bottom right
+  -->
+
+  <!-- Simple Panel border --> <!-- note: shared with WindowTopLeft -->
+  <Image name="PanelHeader_L" xPos="0" yPos="0" width="180" height="95" />
+  <Image name="PanelHeader_M" xPos="180" yPos="0" width="178" height="95" />
+  <Image name="PanelHeader_R" xPos="358" yPos="0" width="180" height="95" />
+
+  <Image name="PanelBody_TL" xPos="0" yPos="95" width="25" height="20" />
+  <Image name="PanelBody_L" xPos="0" yPos="115" width="25" height="170" />
+  <Image name="PanelBody_BL" xPos="0" yPos="285" width="25" height="34" />
+  <Image name="PanelBody_T" xPos="25" yPos="95" width="488" height="10" />
+  <Image name="PanelBody_M" xPos="25" yPos="115" width="488" height="170" />
+  <Image name="PanelBody_B" xPos="25" yPos="285" width="488" height="34" />
+  <Image name="PanelBody_TR" xPos="513" yPos="95" width="25" height="10" />
+  <Image name="PanelBody_R" xPos="513" yPos="115" width="25" height="170" />
+  <Image name="PanelBody_BR" xPos="513" yPos="285" width="25" height="34" />
+  
+  <!-- Image depicting the part of the panel titlebar drawn over the basic top part. This part will contain the colour information-->
+  <Image name="PanelTitleOverlay_Calc" xPos="280" yPos="320" width="256" height="62" />
+  <Image name="PanelTitleOverlay_L" xPos="280" yPos="320" width="39" height="62" />
+  <Image name="PanelTitleOverlay_M" xPos="319" yPos="320" width="178" height="62" />
+  <Image name="PanelTitleOverlay_R" xPos="497" yPos="320" width="39" height="62" />
+  <!-- Image depicting the part of the panel titlebar drawn behind the basic top part. Used in calculations mostly-->
+  <Image name="PanelTitleUnderlay" xPos="141" yPos="8" width="256" height="62" />
+
+  <Image name="PanelCloseButton_On" xPos="560" yPos="0" width="31" height="31" />
+  <Image name="PanelCloseButton_Off" xPos="560" yPos="31" width="31" height="31" />
+  
+  <!-- A button with background content -->
+  <Image name="Button_BackgroundOnly" xPos="550" yPos="305" width="128" height="128" />
+   
+  <Image name="Button_Background_TL" xPos="550" yPos="305" width="15" height="15" /> 
+  <Image name="Button_Background_L" xPos="550" yPos="320" width="15" height="98" /> 
+  <Image name="Button_Background_BL" xPos="550" yPos="418" width="15" height="15" /> 
+  <Image name="Button_Background_T" xPos="565" yPos="305" width="98" height="15" /> 
+  <Image name="Button_Background_M" xPos="565" yPos="320" width="98" height="98" /> 
+  <Image name="Button_Background_B" xPos="565" yPos="418" width="98" height="15" /> 
+  <Image name="Button_Background_TR" xPos="663" yPos="305" width="15" height="15" /> 
+  <Image name="Button_Background_R" xPos="663" yPos="320" width="15" height="98" /> 
+  <Image name="Button_Background_BR" xPos="663" yPos="418" width="15" height="15" /> 
+
+  <Image name="Rounded_Small_Border_TL" xPos="600" yPos="84" width="8" height="8" /> 
+  <Image name="Rounded_Small_Border_L" xPos="600" yPos="92" width="8" height="26" /> 
+  <Image name="Rounded_Small_Border_BL" xPos="600" yPos="118" width="8" height="8" /> 
+  <Image name="Rounded_Small_Border_T" xPos="608" yPos="84" width="26" height="8" /> 
+  <Image name="Rounded_Small_Border_M" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="Rounded_Small_Border_B" xPos="608" yPos="118" width="26" height="8" /> 
+  <Image name="Rounded_Small_Border_TR" xPos="634" yPos="84" width="8" height="8" /> 
+  <Image name="Rounded_Small_Border_R" xPos="634" yPos="92" width="8" height="26" /> 
+  <Image name="Rounded_Small_Border_BR" xPos="634" yPos="118" width="8" height="8" /> 
+
+  <!-- Static text borders --> <!-- TODO: bring to standardized suffix format -->
+  <Image name="StaticTopLeft" xPos="600" yPos="0" width="5" height="5" /> 
+  <Image name="StaticLeft" xPos="600" yPos="5" width="5" height="32" /> 
+  <Image name="StaticBottomLeft" xPos="600" yPos="37" width="5" height="5" /> 
+  <Image name="StaticTop" xPos="605" yPos="0" width="32" height="5" /> 
+  <Image name="StaticBackdrop" xPos="605" yPos="5" width="32" height="32" />
+  <Image name="StaticBottom" xPos="605" yPos="37" width="32" height="5" /> 
+  <Image name="StaticTopRight" xPos="637" yPos="0" width="5" height="5" /> 
+  <Image name="StaticRight" xPos="637" yPos="5" width="5" height="32" /> 
+  <Image name="StaticBottomRight" xPos="637" yPos="37" width="5" height="5" /> 
+
+
+  <Image name="Static_TL" xPos="600" yPos="84" width="8" height="8" /> 
+  <Image name="Static_L" xPos="600" yPos="92" width="8" height="26" /> 
+  <Image name="Static_BL" xPos="600" yPos="118" width="8" height="8" /> 
+  <Image name="Static_T" xPos="608" yPos="84" width="26" height="8" /> 
+  <Image name="Static_M" xPos="788" yPos="92" width="26" height="26" />
+<!--  <Image name="Static_M" xPos="608" yPos="92" width="26" height="26" />-->
+  <Image name="Static_B" xPos="608" yPos="118" width="26" height="8" /> 
+  <Image name="Static_TR" xPos="634" yPos="84" width="8" height="8" /> 
+  <Image name="Static_R" xPos="634" yPos="92" width="8" height="26" /> 
+  <Image name="Static_BR" xPos="634" yPos="118" width="8" height="8" /> 
+
+
+  <!-- Edit Box --> <!-- same as combo-edit box-->
+  <Image name="EditBox_TL" xPos="600" yPos="84" width="8" height="8" /> 
+  <Image name="EditBox_L" xPos="600" yPos="92" width="8" height="26" /> 
+  <Image name="EditBox_BL" xPos="600" yPos="118" width="8" height="8" /> 
+  <Image name="EditBox_T" xPos="608" yPos="84" width="26" height="8" /> 
+  <Image name="EditBox_M" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="EditBox_B" xPos="608" yPos="118" width="26" height="8" /> 
+  <Image name="EditBox_TR" xPos="634" yPos="84" width="8" height="8" /> 
+  <Image name="EditBox_R" xPos="634" yPos="92" width="8" height="26" /> 
+  <Image name="EditBox_BR" xPos="634" yPos="118" width="8" height="8" /> 
+
+  <Image name="EditBoxCarat" xPos="595" yPos="85" width="3" height="30" />
+
+  <!--Horizontal scrollbar thumb border -->
+  <Image name="HorzScrollThumbBorder_TL" xPos="780" yPos="0" width="8" height="8" /> 
+  <Image name="HorzScrollThumbBorder_L" xPos="780" yPos="8" width="8" height="26" /> 
+  <Image name="HorzScrollThumbBorder_BL" xPos="780" yPos="34" width="8" height="8" /> 
+  <Image name="HorzScrollThumbBorder_T" xPos="788" yPos="0" width="26" height="8" /> 
+  <Image name="HorzScrollThumbBorder_M" xPos="788" yPos="8" width="26" height="26" />
+  <Image name="HorzScrollThumbBorder_B" xPos="788" yPos="34" width="26" height="8" /> 
+  <Image name="HorzScrollThumbBorder_TR" xPos="814" yPos="0" width="8" height="8" /> 
+  <Image name="HorzScrollThumbBorder_R" xPos="814" yPos="8" width="8" height="26" /> 
+  <Image name="HorzScrollThumbBorder_BR" xPos="814" yPos="34" width="8" height="8" /> 
+
+  <Image name="HorzScrollThumb_Background" xPos="1000" yPos="0" width="5" height="5" />
+
+  
+  <Image name="GlyphArrowLeft" xPos="803" yPos="179" width="48" height="48" />
+  <Image name="GlyphArrowRight" xPos="851" yPos="179" width="48" height="48" />
+  <Image name="GlyphArrowDown" xPos="851" yPos="227" width="48" height="48" />
+  <Image name="GlyphArrowUp" xPos="803" yPos="227" width="48" height="48" />
+
+  <Image name="EmptyGlyph24" xPos="1000" yPos="0" width="24" height="24" />
+
+  <!-- Rounded square border with darker inner section-->
+  <Image name="Rounded_Square_Small_TL" xPos="825" yPos="0" width="16" height="16" /> 
+  <Image name="Rounded_Square_Small_L" xPos="825" yPos="16" width="16" height="32" /> 
+  <Image name="Rounded_Square_Small_BL" xPos="825" yPos="48" width="16" height="16" /> 
+  <Image name="Rounded_Square_Small_T" xPos="841" yPos="0" width="32" height="16" /> 
+  <Image name="Rounded_Square_Small_M" xPos="841" yPos="16" width="32" height="32" /> 
+  <Image name="Rounded_Square_Small_B" xPos="841" yPos="48" width="32" height="16" /> 
+  <Image name="Rounded_Square_Small_TR" xPos="873" yPos="0" width="16" height="16" /> 
+  <Image name="Rounded_Square_Small_R" xPos="873" yPos="16" width="16" height="32" /> 
+  <Image name="Rounded_Square_Small_BR" xPos="873" yPos="48" width="16" height="16" /> 
+  
+  <Image name="Rounded_Square_Small_Calc_L" xPos="825" yPos="0" width="6" height="6" />
+  <Image name="Rounded_Square_Small_Calc_T" xPos="841" yPos="0" width="6" height="6" /> 
+
+  
+  <!-- scrolls - 16 pixels sized-->
+  <Image name="MiniHorzScrollLeftNormal" xPos="1000" yPos="0" width="5" height="5" />
+  <Image name="MiniHorzScrollRightNormal" xPos="1000" yPos="0" width="5" height="5" />
+  <Image name="MiniHorzScrollBarSegment" xPos="803" yPos="275" width="60" height="14" />
+  <Image name="MiniVertScrollBarSegment" xPos="787" yPos="278" width="14" height="60" />
+  
+  <!-- Vertical scrollbar thumb border -->  
+  <Image name="VertScrollThumbBorder_TL" xPos="780" yPos="0" width="8" height="8" /> 
+  <Image name="VertScrollThumbBorder_L" xPos="780" yPos="8" width="8" height="26" /> 
+  <Image name="VertScrollThumbBorder_BL" xPos="780" yPos="34" width="8" height="8" /> 
+  <Image name="VertScrollThumbBorder_T" xPos="788" yPos="0" width="26" height="8" /> 
+  <Image name="VertScrollThumbBorder_M" xPos="788" yPos="8" width="26" height="26" />
+  <Image name="VertScrollThumbBorder_B" xPos="788" yPos="34" width="26" height="8" /> 
+  <Image name="VertScrollThumbBorder_TR" xPos="814" yPos="0" width="8" height="8" /> 
+  <Image name="VertScrollThumbBorder_R" xPos="814" yPos="8" width="8" height="26" /> 
+  <Image name="VertScrollThumbBorder_BR" xPos="814" yPos="34" width="8" height="8" /> 
+
+  <Image name="VertScrollThumb_Background" xPos="1000" yPos="0" width="5" height="5" />
+  
+  
+  <Image name="MiniButton_TL" xPos="600" yPos="0" width="4" height="4" /> 
+  <Image name="MiniButton_L" xPos="600" yPos="4" width="4" height="34" /> 
+  <Image name="MiniButton_BL" xPos="600" yPos="38" width="4" height="4" /> 
+  <Image name="MiniButton_T" xPos="604" yPos="0" width="34" height="4" /> 
+  <Image name="MiniButton_M" xPos="604" yPos="4" width="34" height="34" />
+  <Image name="MiniButton_B" xPos="604" yPos="38" width="34" height="4" /> 
+  <Image name="MiniButton_TR" xPos="638" yPos="0" width="4" height="4" /> 
+  <Image name="MiniButton_R" xPos="638" yPos="4" width="4" height="34" /> 
+  <Image name="MiniButton_BR" xPos="638" yPos="38" width="4" height="4" /> 
+  
+  <Image name="MiniButton_Background" xPos="604" yPos="4" width="34" height="34" />
+  <Image name="MiniButton_BackgHighlight" xPos="1000" yPos="0" width="5" height="5" />
+
+  <Image name="PanelTitleArea_Calc" xPos="180" yPos="27" width="181" height="28" />
+  
+  <Image name="BtnWideNormal_TL" xPos="550" yPos="130" width="8" height="8" /> 
+  <Image name="BtnWideNormal_L" xPos="550" yPos="138" width="8" height="31" /> 
+  <Image name="BtnWideNormal_BL" xPos="550" yPos="169" width="8" height="8" /> 
+  <Image name="BtnWideNormal_T" xPos="558" yPos="130" width="237" height="8" /> 
+  <Image name="BtnWideNormal_M" xPos="558" yPos="138" width="237" height="31" />
+  <Image name="BtnWideNormal_B" xPos="558" yPos="169" width="237" height="8" /> 
+  <Image name="BtnWideNormal_TR" xPos="795" yPos="130" width="8" height="8" /> 
+  <Image name="BtnWideNormal_R" xPos="795" yPos="138" width="8" height="31" /> 
+  <Image name="BtnWideNormal_BR" xPos="795" yPos="169" width="8" height="8" /> 
+
+  <Image name="BtnWideHover_TL" xPos="550" yPos="180" width="8" height="8" /> 
+  <Image name="BtnWideHover_L" xPos="550" yPos="188" width="8" height="31" /> 
+  <Image name="BtnWideHover_BL" xPos="550" yPos="219" width="8" height="8" /> 
+  <Image name="BtnWideHover_T" xPos="558" yPos="180" width="237" height="8" /> 
+  <Image name="BtnWideHover_M" xPos="558" yPos="188" width="237" height="31" />
+  <Image name="BtnWideHover_B" xPos="558" yPos="219" width="237" height="8" /> 
+  <Image name="BtnWideHover_TR" xPos="795" yPos="180" width="8" height="8" /> 
+  <Image name="BtnWideHover_R" xPos="795" yPos="188" width="8" height="31" /> 
+  <Image name="BtnWideHover_BR" xPos="795" yPos="219" width="8" height="8" /> 
+  
+  <Image name="BtnWidePushed_TL" xPos="550" yPos="230" width="8" height="8" /> 
+  <Image name="BtnWidePushed_L" xPos="550" yPos="238" width="8" height="31" /> 
+  <Image name="BtnWidePushed_BL" xPos="550" yPos="269" width="8" height="8" /> 
+  <Image name="BtnWidePushed_T" xPos="558" yPos="230" width="237" height="8" /> 
+  <Image name="BtnWidePushed_M" xPos="558" yPos="238" width="237" height="31" />
+  <Image name="BtnWidePushed_B" xPos="558" yPos="269" width="237" height="8" /> 
+  <Image name="BtnWidePushed_TR" xPos="795" yPos="230" width="8" height="8" /> 
+  <Image name="BtnWidePushed_R" xPos="795" yPos="238" width="8" height="31" /> 
+  <Image name="BtnWidePushed_BR" xPos="795" yPos="269" width="8" height="8" /> 
+  
+  <Image name="WeaponSwitchState1" xPos="550" yPos="280" width="93" height="24" /> 
+  <Image name="WeaponSwitchState2" xPos="646" yPos="280" width="93" height="24" /> 
+
+  <!-- A generic simple rounded border -->
+  <Image name="GenericRoundedBorder_TL" xPos="780" yPos="42" width="8" height="8" /> 
+  <Image name="GenericRoundedBorder_L" xPos="780" yPos="50" width="8" height="26" /> 
+  <Image name="GenericRoundedBorder_BL" xPos="780" yPos="76" width="8" height="8" /> 
+  <Image name="GenericRoundedBorder_T" xPos="788" yPos="42" width="26" height="8" /> 
+  <Image name="GenericRoundedBorder_M" xPos="788" yPos="50" width="26" height="26" />
+  <Image name="GenericRoundedBorder_B" xPos="788" yPos="76" width="26" height="8" /> 
+  <Image name="GenericRoundedBorder_TR" xPos="814" yPos="42" width="8" height="8" /> 
+  <Image name="GenericRoundedBorder_R" xPos="814" yPos="50" width="8" height="26" /> 
+  <Image name="GenericRoundedBorder_BR" xPos="814" yPos="76" width="8" height="8" /> 
+
+  <Image name="FilledRoundedBorder_TL" xPos="780" yPos="84" width="8" height="8" /> 
+  <Image name="FilledRoundedBorder_L" xPos="780" yPos="92" width="8" height="26" /> 
+  <Image name="FilledRoundedBorder_BL" xPos="780" yPos="118" width="8" height="8" /> 
+  <Image name="FilledRoundedBorder_T" xPos="788" yPos="84" width="26" height="8" /> 
+  <Image name="FilledRoundedBorder_M" xPos="788" yPos="92" width="26" height="26" />
+  <Image name="FilledRoundedBorder_B" xPos="788" yPos="118" width="26" height="8" /> 
+  <Image name="FilledRoundedBorder_TR" xPos="814" yPos="84" width="8" height="8" /> 
+  <Image name="FilledRoundedBorder_R" xPos="814" yPos="92" width="8" height="26" /> 
+  <Image name="FilledRoundedBorder_BR" xPos="814" yPos="118" width="8" height="8" /> 
+  
+  
+  <!-- A generic Tab button border -->
+  <Image name="TabButtonBorder_TL" xPos="780" yPos="0" width="8" height="8" /> 
+  <Image name="TabButtonBorder_L" xPos="780" yPos="8" width="8" height="26" /> 
+  <Image name="TabButtonBorder_BL" xPos="780" yPos="34" width="8" height="8" /> 
+  <Image name="TabButtonBorder_T" xPos="788" yPos="0" width="26" height="8" /> 
+  <Image name="TabButtonBorder_M" xPos="788" yPos="8" width="26" height="26" />
+  <Image name="TabButtonBorder_B" xPos="788" yPos="34" width="26" height="8" /> 
+  <Image name="TabButtonBorder_TR" xPos="814" yPos="0" width="8" height="8" /> 
+  <Image name="TabButtonBorder_R" xPos="814" yPos="8" width="8" height="26" /> 
+  <Image name="TabButtonBorder_BR" xPos="814" yPos="34" width="8" height="8" /> 
+
+<!--  
+  <Image name="TabButton_Background" xPos="386" yPos="126" width="52" height="52" />
+  <Image name="TabButton_Backghighlight" xPos="466" yPos="126" width="52" height="52" />
+-->
+
+  <!-- Progress bar frame -->
+  <Image name="ProgressBar_HD_TL" xPos="0" yPos="420" width="33" height="4" />
+  <Image name="ProgressBar_HD_L" xPos="0" yPos="424" width="33" height="40" />
+  <Image name="ProgressBar_HD_BL" xPos="0" yPos="464" width="33" height="4" />
+  <Image name="ProgressBar_HD_T" xPos="33" yPos="420" width="158" height="4" />
+  <Image name="ProgressBar_HD_M" xPos="33" yPos="424" width="158" height="40" />
+  <Image name="ProgressBar_HD_B" xPos="33" yPos="464" width="158" height="4" />
+  <Image name="ProgressBar_HD_TR" xPos="191" yPos="420" width="33" height="4" />
+  <Image name="ProgressBar_HD_R" xPos="191" yPos="424" width="33" height="40" />
+  <Image name="ProgressBar_HD_BR" xPos="191" yPos="464" width="33" height="4" />
+
+  <Image name="ProgressBar_Non_Fill_Calc" xPos="0" yPos="420" width="22" height="4" />
+  
+  <!-- A progress bar with cut edges -->
+  <Image name="ProgressBar_HD_TL_Redux" xPos="22" yPos="420" width="11" height="4" />
+  <Image name="ProgressBar_HD_L_Redux" xPos="22" yPos="424" width="11" height="40" />
+  <Image name="ProgressBar_HD_BL_Redux" xPos="22" yPos="464" width="11" height="4" />
+  
+  <Image name="ProgressBar_HD_TR_Redux" xPos="191" yPos="420" width="11" height="4" />
+  <Image name="ProgressBar_HD_R_Redux" xPos="191" yPos="424" width="11" height="40" />
+  <Image name="ProgressBar_HD_BR_Redux" xPos="191" yPos="464" width="11" height="4" />
+
+  <!-- Progress bar - the sections for Dim and Lit filling. Only 1 used ATM -->
+  <Image name="ProgressBarLitSegment" xPos="270" yPos="385" width="128" height="32" />
+  <Image name="ProgressBarGraySegment" xPos="270" yPos="417" width="128" height="32" />
+
+
+  <Image name="PlainGray" xPos="555" yPos="90" width="32" height="32" />
+
+  <!-- Progress bar background -->
+  <!-- Progress bar background with cut edges -->
+<!--
+  <Image name="ProgressBar_Bck_TL" xPos="0" yPos="468" width="33" height="4" />
+  <Image name="ProgressBar_Bck_L" xPos="0" yPos="472" width="33" height="40" />
+  <Image name="ProgressBar_Bck_BL" xPos="0" yPos="512" width="33" height="4" />
+  <Image name="ProgressBar_Bck_T" xPos="33" yPos="468" width="158" height="4" />
+  <Image name="ProgressBar_Bck_M" xPos="33" yPos="472" width="158" height="40" />
+  <Image name="ProgressBar_Bck_B" xPos="33" yPos="512" width="158" height="4" />
+  <Image name="ProgressBar_Bck_TR" xPos="191" yPos="468" width="33" height="4" />
+  <Image name="ProgressBar_Bck_R" xPos="191" yPos="472" width="33" height="40" />
+  <Image name="ProgressBar_Bck_BR" xPos="191" yPos="512" width="33" height="4" />
+
+  <Image name="ProgressBar_Bck_TL_Redux" xPos="22" yPos="468" width="11" height="4" />
+  <Image name="ProgressBar_Bck_L_Redux" xPos="22" yPos="472" width="11" height="40" />
+  <Image name="ProgressBar_Bck_BL_Redux" xPos="22" yPos="512" width="11" height="4" />
+  <Image name="ProgressBar_Bck_TR_Redux" xPos="191" yPos="468" width="11" height="4" />
+  <Image name="ProgressBar_Bck_R_Redux" xPos="191" yPos="472" width="11" height="40" />
+  <Image name="ProgressBar_Bck_BR_Redux" xPos="191" yPos="512" width="11" height="4" />
+-->
+
+  <Image name="ProgressBar_Bck_TL_Redux" xPos="22" yPos="516" width="23" height="4" />
+  <Image name="ProgressBar_Bck_L_Redux" xPos="22" yPos="520" width="23" height="40" />
+  <Image name="ProgressBar_Bck_BL_Redux" xPos="22" yPos="560" width="23" height="4" />
+  <Image name="ProgressBar_Bck_TR_Redux" xPos="175" yPos="516" width="23" height="4" />
+  <Image name="ProgressBar_Bck_R_Redux" xPos="175" yPos="520" width="23" height="40" />
+  <Image name="ProgressBar_Bck_BR_Redux" xPos="175" yPos="560" width="23" height="4" />
+
+  <Image name="ProgressBar_Bck_TL" xPos="0" yPos="516" width="45" height="4" />
+  <Image name="ProgressBar_Bck_L" xPos="0" yPos="520" width="45" height="40" />
+  <Image name="ProgressBar_Bck_BL" xPos="0" yPos="560" width="45" height="4" />
+  <Image name="ProgressBar_Bck_T" xPos="45" yPos="516" width="130" height="4" />
+  <Image name="ProgressBar_Bck_M" xPos="45" yPos="520" width="130" height="40" />
+  <Image name="ProgressBar_Bck_B" xPos="45" yPos="560" width="130" height="4" />
+  <Image name="ProgressBar_Bck_TR" xPos="175" yPos="516" width="49" height="4" />
+  <Image name="ProgressBar_Bck_R" xPos="175" yPos="520" width="49" height="40" />
+  <Image name="ProgressBar_Bck_BR" xPos="175" yPos="560" width="49" height="4" />
+
+
+  <!-- Tool-tip images -->
+	<Image name="TooltipTopLeft" xPos="780" yPos="84" width="8" height="8" />
+	<Image name="TooltipLeftEdge" xPos="780" yPos="92" width="8" height="26" />
+	<Image name="TooltipBottomLeft" xPos="780" yPos="118" width="8" height="8" />
+	<Image name="TooltipTopEdge" xPos="788" yPos="84" width="26" height="8" />
+	<Image name="TooltipMiddle" xPos="788" yPos="92" width="26" height="26" />
+	<Image name="TooltipBottomEdge" xPos="788" yPos="118" width="26" height="8" />
+	<Image name="TooltipTopRight" xPos="814" yPos="84" width="8" height="8" />
+	<Image name="TooltipRightEdge" xPos="814" yPos="92" width="8" height="26" />
+	<Image name="TooltipBottomRight" xPos="814" yPos="118" width="8" height="8" />
+
+
+<!--
+  <Image name="PanelBody_TL" xPos="0" yPos="95" width="25" height="20" />
+  <Image name="PanelBody_L" xPos="0" yPos="115" width="25" height="170" />
+  <Image name="PanelBody_BL" xPos="0" yPos="285" width="25" height="34" />
+  <Image name="PanelBody_T" xPos="25" yPos="95" width="488" height="10" />
+  <Image name="PanelBody_M" xPos="25" yPos="115" width="488" height="170" />
+  <Image name="PanelBody_B" xPos="25" yPos="285" width="488" height="34" />
+  <Image name="PanelBody_TR" xPos="513" yPos="95" width="25" height="10" />
+  <Image name="PanelBody_R" xPos="513" yPos="115" width="25" height="170" />
+  <Image name="PanelBody_BR" xPos="513" yPos="285" width="25" height="34" />
+
+-->
+	<Image name="WindowTopLeft" xPos="0" yPos="95" width="25" height="10" />
+	<Image name="WindowLeftEdge" xPos="0" yPos="115" width="25" height="170" />
+	<Image name="WindowBottomLeft" xPos="0" yPos="285" width="25" height="34" />
+	<Image name="WindowTopEdge" xPos="25" yPos="95" width="488" height="10" />
+	<Image name="WindowMid" xPos="25" yPos="115" width="488" height="170" />
+	<Image name="WindowBottomEdge" xPos="25" yPos="285" width="488" height="34" />
+	<Image name="WindowTopRight" xPos="513" yPos="95" width="25" height="10" />
+	<Image name="WindowRightEdge" xPos="513" yPos="115" width="25" height="170" />
+	<Image name="WindowBottomRight" xPos="513" yPos="285" width="25" height="34" />
+
+	<Image name="WindowCenter_Calc" xPos="23" yPos="103" width="495" height="189" />
+	<Image name="WindowAll_Calc" xPos="0" yPos="0" width="538" height="320" />
+	<Image name="WindowPanel_Calc" xPos="0" yPos="95" width="538" height="225" />
+
+
+	<Image name="ComboboxSelectionBrush" xPos="0" yPos="320" width="192" height="48" /> <!-- shared -->
+	<Image name="MultiListSelectionBrush" xPos="0" yPos="320" width="192" height="48" /> <!-- shared -->
+	<Image name="TextSelectionBrush" xPos="0" yPos="320" width="192" height="48" /> <!-- shared -->
+	<Image name="ListboxSelectionBrush" xPos="0" yPos="320" width="192" height="48" /> <!-- shared -->
+	<Image name="MultiLineEditboxSelectionBrush" xPos="0" yPos="320" width="192" height="48" /> <!-- shared -->
+
+
+  <!-- TODO: bring to standardized suffix format --> <!-- TODO: check if removal is recommended (tooltip duplicate) -->
+	<Image name="ComboboxListTopLeft" xPos="780" yPos="84" width="8" height="8" />
+	<Image name="ComboboxListLeft" xPos="780" yPos="92" width="8" height="26" />
+	<Image name="ComboboxListBottomLeft" xPos="780" yPos="118" width="8" height="8" />
+	<Image name="ComboboxListTop" xPos="788" yPos="84" width="26" height="8" />
+	<Image name="ComboboxListBackdrop" xPos="788" yPos="92" width="26" height="26" />
+	<Image name="ComboboxListBottom" xPos="788" yPos="118" width="26" height="8" />
+	<Image name="ComboboxListTopRight" xPos="814" yPos="84" width="8" height="8" />
+	<Image name="ComboboxListRight" xPos="814" yPos="92" width="8" height="26" />
+	<Image name="ComboboxListBottomRight" xPos="814" yPos="118" width="8" height="8" />
+
+  <!-- multilist borders - shared -->
+  <!-- TODO: bring to standardized suffix format --> <!-- TODO: check if removal is recommended (static duplicate) -->
+  <Image name="MultiListTopLeft" xPos="600" yPos="84" width="8" height="8" />
+  <Image name="MultiListLeft" xPos="600" yPos="92" width="8" height="26" />
+  <Image name="MultiListBottomLeft" xPos="600" yPos="118" width="8" height="8" />
+  <Image name="MultiListTop" xPos="608" yPos="84" width="26" height="8" />
+  <Image name="MultiListBackdrop" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="MultiListBottom" xPos="608" yPos="118" width="26" height="8" />
+  <Image name="MultiListTopRight" xPos="634" yPos="84" width="8" height="8" />
+  <Image name="MultiListRight" xPos="634" yPos="92" width="8" height="26" />
+  <Image name="MultiListBottomRight" xPos="634" yPos="118" width="8" height="8" />
+
+  <!-- Shared pictures at the moment -->
+  <!-- TODO: bring to standardized suffix format --> <!-- TODO: check if removal is recommended (static duplicate) -->
+  <Image name="ListboxTopLeft" xPos="600" yPos="84" width="8" height="8" />
+  <Image name="ListboxLeft" xPos="600" yPos="92" width="8" height="26" />
+  <Image name="ListboxBottomLeft" xPos="600" yPos="118" width="8" height="8" />
+  <Image name="ListboxTop" xPos="608" yPos="84" width="26" height="8" />
+  <Image name="ListboxBackdrop" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="ListboxBottom" xPos="608" yPos="118" width="26" height="8" />
+  <Image name="ListboxTopRight" xPos="634" yPos="84" width="8" height="8" />
+  <Image name="ListboxRight" xPos="634" yPos="92" width="8" height="26" />
+  <Image name="ListboxBottomRight" xPos="634" yPos="118" width="8" height="8" />
+
+  <!-- Multi-line edit-box content borders; same as static text borders -->
+  <!-- TODO: bring to standardized suffix format --> <!-- TODO: check if removal is recommended (static duplicate) -->
+  <Image name="MultiLineEditboxTopLeft" xPos="600" yPos="84" width="8" height="8" />
+  <Image name="MultiLineEditboxLeft" xPos="600" yPos="92" width="8" height="26" />
+  <Image name="MultiLineEditboxBottomLeft" xPos="600" yPos="118" width="8" height="8" />
+  <Image name="MultiLineEditboxTop" xPos="608" yPos="84" width="26" height="8" />
+  <Image name="MultiLineEditboxBackdrop" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="MultiLineEditboxBottom" xPos="608" yPos="118" width="26" height="8" />
+  <Image name="MultiLineEditboxTopRight" xPos="634" yPos="84" width="8" height="8" />
+  <Image name="MultiLineEditboxRight" xPos="634" yPos="92" width="8" height="26" />
+  <Image name="MultiLineEditboxBottomRight" xPos="634" yPos="118" width="8" height="8" />
+
+  <!-- Tab content borders; same as static text borders -->
+  <!-- TODO: bring to standardized suffix format --> <!-- TODO: check if removal is recommended (static duplicate) -->
+  <Image name="TabContentPaneUpperLeft" xPos="600" yPos="84" width="8" height="8" />
+  <Image name="TabContentPaneLeft" xPos="600" yPos="92" width="8" height="26" />
+  <Image name="TabContentPaneLowerLeft" xPos="600" yPos="118" width="8" height="8" />
+  <Image name="TabContentPaneUpper" xPos="608" yPos="84" width="26" height="8" />
+  <Image name="TabContentPaneMiddle" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="TabContentPaneLower" xPos="608" yPos="118" width="26" height="8" />
+  <Image name="TabContentPaneUpperRight" xPos="634" yPos="84" width="8" height="8" />
+  <Image name="TabContentPaneRight" xPos="634" yPos="92" width="8" height="26" />
+  <Image name="TabContentPaneLowerRight" xPos="634" yPos="118" width="8" height="8" />
+
+  <!-- Check Box -->
+  <Image name="CheckboxMark" xPos="825" yPos="64" width="64" height="64" />
+
+  <!-- Shared images (also used in the tab button border-->
+  <Image name="CheckboxBck_TL" xPos="780" yPos="0" width="8" height="8" /> 
+  <Image name="CheckboxBck_L" xPos="780" yPos="8" width="8" height="26" /> 
+  <Image name="CheckboxBck_BL" xPos="780" yPos="34" width="8" height="8" /> 
+  <Image name="CheckboxBck_T" xPos="788" yPos="0" width="26" height="8" /> 
+  <Image name="CheckboxBck_M" xPos="788" yPos="8" width="26" height="26" />
+  <Image name="CheckboxBck_B" xPos="788" yPos="34" width="26" height="8" /> 
+  <Image name="CheckboxBck_TR" xPos="814" yPos="0" width="8" height="8" /> 
+  <Image name="CheckboxBck_R" xPos="814" yPos="8" width="8" height="26" /> 
+  <Image name="CheckboxBck_BR" xPos="814" yPos="34" width="8" height="8" /> 
+
+  <Image name="CheckboxBorder_TL" xPos="600" yPos="84" width="8" height="8" /> 
+  <Image name="CheckboxBorder_L" xPos="600" yPos="92" width="8" height="26" /> 
+  <Image name="CheckboxBorder_BL" xPos="600" yPos="118" width="8" height="8" /> 
+  <Image name="CheckboxBorder_T" xPos="608" yPos="84" width="26" height="8" /> 
+  <Image name="CheckboxBorder_M" xPos="608" yPos="92" width="26" height="26" />
+  <Image name="CheckboxBorder_B" xPos="608" yPos="118" width="26" height="8" /> 
+  <Image name="CheckboxBorder_TR" xPos="634" yPos="84" width="8" height="8" /> 
+  <Image name="CheckboxBorder_R" xPos="634" yPos="92" width="8" height="26" /> 
+  <Image name="CheckboxBorder_BR" xPos="634" yPos="118" width="8" height="8" /> 
+
+
+  <!-- Combo-box button borders -->
+  <Image name="ComboboxButtonBorder_TL" xPos="780" yPos="0" width="8" height="8" /> 
+  <Image name="ComboboxButtonBorder_L" xPos="780" yPos="8" width="8" height="26" /> 
+  <Image name="ComboboxButtonBorder_BL" xPos="780" yPos="34" width="8" height="8" /> 
+  <Image name="ComboboxButtonBorder_T" xPos="788" yPos="0" width="26" height="8" /> 
+  <Image name="ComboboxButtonBorder_M" xPos="788" yPos="8" width="26" height="26" />
+  <Image name="ComboboxButtonBorder_B" xPos="788" yPos="34" width="26" height="8" /> 
+  <Image name="ComboboxButtonBorder_TR" xPos="814" yPos="0" width="8" height="8" /> 
+  <Image name="ComboboxButtonBorder_R" xPos="814" yPos="8" width="8" height="26" /> 
+  <Image name="ComboboxButtonBorder_BR" xPos="814" yPos="34" width="8" height="8" /> 
+
+  <Image name="ComboboxButtonGlyph" xPos="835" yPos="128" width="43" height="33" />
+
+  <!-- Titlebar border -->
+  <Image name="TitlebarBorder_TL" xPos="5" yPos="820" width="8" height="8" />
+  <Image name="TitlebarBorder_L" xPos="5" yPos="828" width="8" height="48" />
+  <Image name="TitlebarBorder_BL" xPos="5" yPos="876" width="8" height="8" />
+  <Image name="TitlebarBorder_T" xPos="13" yPos="820" width="240" height="8" />
+  <Image name="TitlebarBorder_M" xPos="13" yPos="828" width="240" height="48" />
+  <Image name="TitlebarBorder_B" xPos="13" yPos="876" width="240" height="8" /> 
+  <Image name="TitlebarBorder_TR" xPos="253" yPos="820" width="8" height="8" /> 
+  <Image name="TitlebarBorder_R" xPos="253" yPos="828" width="8" height="48" /> 
+  <Image name="TitlebarBorder_BR" xPos="253" yPos="876" width="8" height="8" /> 
+
+  <Image name="TitlebarBackground" xPos="600" yPos="42" width="42" height="42" /> 
+
+  <Image name="WindowBck_TL" xPos="600" yPos="0" width="4" height="4" /> 
+  <Image name="WindowBck_L" xPos="600" yPos="4" width="4" height="34" /> 
+  <Image name="WindowBck_BL" xPos="600" yPos="38" width="4" height="4" /> 
+  <Image name="WindowBck_T" xPos="604" yPos="0" width="34" height="4" /> 
+  <Image name="WindowBck_M" xPos="604" yPos="4" width="34" height="34" />
+  <Image name="WindowBck_B" xPos="604" yPos="38" width="34" height="4" /> 
+  <Image name="WindowBck_TR" xPos="638" yPos="0" width="4" height="4" /> 
+  <Image name="WindowBck_R" xPos="638" yPos="4" width="4" height="34" /> 
+  <Image name="WindowBck_BR" xPos="638" yPos="38" width="4" height="4" /> 
+
+  <Image name="ProgressBarTimerSegment" xPos="805" yPos="128" width="22" height="31" />
+
+</Imageset>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/SWBCursors.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,26 @@
+<!--
+SWB - SumWarsBase
+SWB is licensed under the terms of the LGPL license.
+-->
+<!--
+version:      0.1
+Last change:	$LastChangedDate: 2012-11-15 00:31:48 +0200 (J, 15 nov. 2012) $
+-->
+<Imageset version="2" name="SWBCursors" imagefile="SWBCursors.png" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="false" >
+
+  <!-- Mouse Cursors -->
+	<Image name="MouseArrow" xPos="5" yPos="5" width="32" height="32" XOffset="-1" YOffset="-1" />
+	<Image name="MouseArrowLarge" xPos="0" yPos="150" width="64" height="64" XOffset="-1" YOffset="-1" />
+
+	<Image name="MouseMoveCursor" xPos="50" yPos="5" width="32" height="32" XOffset="-16" YOffset="-16" />
+
+	<Image name="MouseEsWeCursor" xPos="150" yPos="5" width="32" height="32" XOffset="-16" YOffset="-16" />
+	<Image name="MouseNoSoCursor" xPos="200" yPos="5" width="32" height="32" XOffset="-16" YOffset="-16" />
+	<Image name="MouseNeSwCursor" xPos="250" yPos="5" width="32" height="32" XOffset="-16" YOffset="-16" />
+	<Image name="MouseNwSeCursor" xPos="300" yPos="5" width="32" height="32" XOffset="-16" YOffset="-16" />
+  
+  <!-- TODO: set to different content; duplicated at the moment -->
+
+	<Image name="MouseTextBar" xPos="5" yPos="5" width="32" height="32" XOffset="-1" YOffset="-1" />
+  
+</Imageset>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/SkillTree.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,6 @@
+<Imageset version="2" autoScaled="true" imagefile="SkillTree.png" name="SkillTree" nativeHorzRes="304" nativeVertRes="424">
+	<Image height="826" name="SkillTreeBg" width="538" xPos="0" yPos="0" />
+	<Image height="69" name="SkillBg" width="69" xPos="550" yPos="156" />
+	<Image height="33" name="TabButtonNormal" width="163" xPos="546" yPos="27" />
+	<Image height="33" name="TabButtonSelected" width="163" xPos="546" yPos="88" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/SumWarsExtras.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,51 @@
+<!--
+SWB - SumWarsBase
+SWB is licensed under the terms of the LGPL license.
+-->
+<!--
+version:      0.1
+Last change:  $LastChangedDate: 2013-01-26 01:26:14 +0200 (S, 26 ian. 2013) $
+-->
+<Imageset version="2" name="SumWarsExtras" imagefile="SumWarsExtras.png" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="false" >
+
+  <!-- Suffix Legend: 
+    TL = top left; L = left; BL = bottom left; 
+    T = top; M = middle; B = bottom; 
+    TR = top right; R = right; BR = bottom right
+  -->
+
+  <!-- Empty picture -->
+	<Image name="EmptyPicture10px" xPos="64" yPos="64" width="10" height="10" />
+
+  <!-- The symbol to be used for a Town Portal -->
+  <Image name="TownPortalSymbol" xPos="0" yPos="0" width="48" height="48" />
+
+  <!-- The symbol to be used for a waypoint -->
+	<Image name="WaypointMark" xPos="0" yPos="48" width="48" height="48" />
+
+  <!-- The symbol to be used for the skill tree connectors-->
+  <Image name="SkilltreeVertConnection" xPos="48" yPos="0" width="48" height="48" />
+  <!-- Backslash like -->
+	<Image name="SkilltreeDiagConnection" xPos="96" yPos="0" width="48" height="48" />
+  <!-- Forward slash like -->
+	<Image name="SkilltreeDiag2Connection" xPos="144" yPos="0" width="48" height="48" />
+
+  <!-- Additional empty pics -->
+	<Image name="MiniHorzScrollThumbLeftNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollThumbRightNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollThumbMiddleNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollThumbLeftHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollThumbRightHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollThumbMiddleHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniHorzScrollBarSegment" xPos="64" yPos="64" width="10" height="10" />
+  
+	<Image name="MiniVertScrollThumbTopNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollThumbBottomNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollThumbMiddleNormal" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollThumbTopHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollThumbBottomHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollThumbMiddleHover" xPos="64" yPos="64" width="10" height="10" />
+	<Image name="MiniVertScrollBarSegment" xPos="64" yPos="64" width="10" height="10" />
+
+</Imageset>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/TaharezLook.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,244 @@
+<Imageset autoScaled="vertical" imagefile="TaharezLook.png" name="TaharezLook" nativeHorzRes="1280" nativeVertRes="720" version="2">
+    <Image height="64" name="ClientBrush" width="64" xPos="2" yPos="2" />
+    <Image height="1" name="GenericBrush" width="1" xPos="9" yPos="71" />
+    <Image height="22" name="WindowLeftEdge" width="1" xOffset="4" xPos="6" yOffset="0" yPos="95" />
+    <Image height="22" name="WindowRightEdge" width="1" xOffset="-4" xPos="34" yOffset="0" yPos="95" />
+    <Image height="1" name="WindowTopEdge" width="23" xPos="9" yPos="68" />
+    <Image height="1" name="WindowBottomEdge" width="23" xPos="9" yPos="143" />
+    <Image height="24" name="WindowTopLeft" width="5" xPos="2" yPos="68" />
+    <Image height="24" name="WindowTopRight" width="5" xPos="34" yPos="68" />
+    <Image height="24" name="WindowBottomLeft" width="5" xPos="2" yPos="120" />
+    <Image height="24" name="WindowBottomRight" width="5" xPos="34" yPos="120" />
+    <Image height="16" name="ButtonLeftNormal" width="12" xPos="68" yPos="20" />
+    <Image height="16" name="ButtonMiddleNormal" width="12" xPos="82" yPos="20" />
+    <Image height="16" name="ButtonRightNormal" width="12" xPos="96" yPos="20" />
+    <Image height="16" name="ButtonLeftPushed" width="12" xPos="68" yPos="38" />
+    <Image height="16" name="ButtonMiddlePushed" width="12" xPos="82" yPos="38" />
+    <Image height="16" name="ButtonRightPushed" width="12" xPos="96" yPos="38" />
+    <Image height="16" name="ButtonLeftHighlight" width="12" xPos="68" yPos="56" />
+    <Image height="16" name="ButtonMiddleHighlight" width="12" xPos="82" yPos="56" />
+    <Image height="16" name="ButtonRightHighlight" width="12" xPos="96" yPos="56" />
+    <Image height="12" name="CheckboxNormal" width="12" xPos="110" yPos="2" />
+    <Image height="12" name="CheckboxHover" width="12" xPos="110" yPos="30" />
+    <Image height="12" name="CheckboxMark" width="12" xPos="110" yPos="16" />
+    <Image height="12" name="RadioButtonNormal" width="12" xPos="124" yPos="2" />
+    <Image height="12" name="RadioButtonHover" width="12" xPos="124" yPos="30" />
+    <Image height="12" name="RadioButtonMark" width="12" xPos="124" yPos="16" />
+    <Image height="16" name="TitlebarLeft" width="8" xPos="68" yPos="2" />
+    <Image height="16" name="TitlebarMiddle" width="8" xPos="78" yPos="2" />
+    <Image height="16" name="TitlebarRight" width="8" xPos="88" yPos="2" />
+    <Image height="16" name="NewTitlebarLeft" width="13" xPos="61" yPos="127" />
+    <Image height="16" name="NewTitlebarMiddle" width="12" xPos="77" yPos="127" />
+    <Image height="16" name="NewTitlebarRight" width="12" xPos="92" yPos="127" />
+    <Image height="16" name="SysAreaMiddle" width="12" xPos="107" yPos="127" />
+    <Image height="16" name="SysAreaRight" width="13" xPos="122" yPos="127" />
+    <Image height="6" name="StaticLeft" width="6" xPos="41" yPos="89" />
+    <Image height="6" name="StaticRight" width="6" xPos="63" yPos="89" />
+    <Image height="6" name="StaticTop" width="6" xPos="52" yPos="78" />
+    <Image height="6" name="StaticBottom" width="6" xPos="52" yPos="100" />
+    <Image height="6" name="StaticTopLeft" width="6" xPos="41" yPos="78" />
+    <Image height="6" name="StaticTopRight" width="6" xPos="63" yPos="78" />
+    <Image height="6" name="StaticBottomLeft" width="6" xPos="41" yPos="100" />
+    <Image height="6" name="StaticBottomRight" width="6" xPos="63" yPos="100" />
+    <Image height="6" name="StaticBackdrop" width="6" xPos="52" yPos="89" />
+    <Image height="12" name="ProgressBarLeft" width="7" xPos="71" yPos="74" />
+    <Image height="12" name="ProgressBarMiddle" width="6" xPos="80" yPos="74" />
+    <Image height="12" name="ProgressBarRight" width="6" xPos="88" yPos="74" />
+    <Image height="12" name="ProgressBarDimSegment" width="8" xPos="96" yPos="74" />
+    <Image height="12" name="ProgressBarLitSegment" width="8" xPos="106" yPos="74" />
+    <Image height="18" name="EditBoxLeft" width="4" xPos="41" yPos="108" />
+    <Image height="18" name="EditBoxMiddle" width="4" xPos="47" yPos="108" />
+    <Image height="18" name="EditBoxRight" width="4" xPos="53" yPos="108" />
+    <Image height="18" name="EditBoxCaret" width="4" xPos="60" yPos="108" />
+    <Image height="6" name="SpinnerUpNormal" width="10" xPos="68" yPos="110" />
+    <Image height="6" name="SpinnerDownNormal" width="10" xPos="68" yPos="118" />
+    <Image height="6" name="SpinnerUpHover" width="10" xPos="82" yPos="110" />
+    <Image height="6" name="SpinnerDownHover" width="10" xPos="82" yPos="118" />
+    <Image height="16" name="TextSelectionBrush" width="16" xPos="8" yPos="70" />
+    <Image height="8" name="VertScrollTop" width="20" xPos="182" yPos="2" />
+    <Image height="8" name="VertScrollMiddle" width="20" xPos="182" yPos="12" />
+    <Image height="8" name="VertScrollBottom" width="20" xPos="182" yPos="22" />
+    <Image height="10" name="VertScrollBarSegment" width="4" xPos="206" yPos="2" />
+    <Image height="24" name="VertScrollThumbNormal" width="8" xPos="214" yPos="2" />
+    <Image height="24" name="VertScrollThumbHover" width="8" xPos="224" yPos="2" />
+    <Image height="12" name="VertScrollUpNormal" width="12" xPos="196" yPos="32" />
+    <Image height="12" name="VertScrollDownNormal" width="12" xPos="182" yPos="32" />
+    <Image height="12" name="VertScrollUpHover" width="12" xPos="196" yPos="46" />
+    <Image height="12" name="VertScrollDownHover" width="12" xPos="182" yPos="46" />
+    <Image height="10" name="MiniVertScrollBarSegment" width="4" xPos="207" yPos="60" />
+    <Image height="22" name="MiniVertScrollThumbNormal" width="7" xPos="214" yPos="59" />
+    <Image height="5" name="MiniVertScrollThumbTopNormal" width="7" xPos="214" yPos="59" />
+    <Image height="5" name="MiniVertScrollThumbMiddleNormal" width="7" xPos="214" yPos="65" />
+    <Image height="5" name="MiniVertScrollThumbBottomNormal" width="7" xPos="214" yPos="76" />
+    <Image height="5" name="MiniVertScrollThumbTopHover" width="7" xPos="223" yPos="59" />
+    <Image height="5" name="MiniVertScrollThumbMiddleHover" width="7" xPos="223" yPos="65" />
+    <Image height="5" name="MiniVertScrollThumbBottomHover" width="7" xPos="223" yPos="76" />
+    <Image height="22" name="MiniVertScrollThumbHover" width="7" xPos="223" yPos="59" />
+    <Image height="9" name="MiniVertScrollUpNormal" width="10" xPos="194" yPos="60" />
+    <Image height="9" name="MiniVertScrollDownNormal" width="10" xPos="182" yPos="59" />
+    <Image height="9" name="MiniVertScrollUpHover" width="10" xPos="194" yPos="70" />
+    <Image height="9" name="MiniVertScrollDownHover" width="10" xPos="182" yPos="69" />
+    <Image height="48" name="VertSliderBody" width="9" xPos="234" yPos="2" />
+    <Image height="6" name="VertSliderThumbNormal" width="15" xPos="217" yPos="28" />
+    <Image height="6" name="VertSliderThumbHover" width="15" xPos="217" yPos="36" />
+    <Image height="4" name="MiniHorzScrollBarSegment" width="10" xPos="244" yPos="80" />
+    <Image height="7" name="MiniHorzScrollThumbNormal" width="22" xPos="233" yPos="87" />
+    <Image height="7" name="MiniHorzScrollThumbLeftNormal" width="5" xPos="233" yPos="87" />
+    <Image height="7" name="MiniHorzScrollThumbMiddleNormal" width="5" xPos="239" yPos="87" />
+    <Image height="7" name="MiniHorzScrollThumbRightNormal" width="5" xPos="250" yPos="87" />
+    <Image height="7" name="MiniHorzScrollThumbHover" width="22" xPos="233" yPos="96" />
+    <Image height="7" name="MiniHorzScrollThumbLeftHover" width="5" xPos="233" yPos="96" />
+    <Image height="7" name="MiniHorzScrollThumbMiddleHover" width="5" xPos="239" yPos="96" />
+    <Image height="7" name="MiniHorzScrollThumbRightHover" width="5" xPos="250" yPos="96" />
+    <Image height="10" name="MiniHorzScrollLeftNormal" width="9" xPos="246" yPos="55" />
+    <Image height="10" name="MiniHorzScrollRightNormal" width="9" xPos="245" yPos="67" />
+    <Image height="10" name="MiniHorzScrollLeftHover" width="9" xPos="236" yPos="55" />
+    <Image height="10" name="MiniHorzScrollRightHover" width="9" xPos="235" yPos="67" />
+    <Image height="6" name="ListboxLeft" width="7" xPos="41" yPos="89" />
+    <Image height="6" name="ListboxRight" width="7" xPos="62" yPos="89" />
+    <Image height="7" name="ListboxTop" width="6" xPos="52" yPos="78" />
+    <Image height="7" name="ListboxBottom" width="6" xPos="52" yPos="99" />
+    <Image height="7" name="ListboxTopLeft" width="7" xPos="41" yPos="78" />
+    <Image height="7" name="ListboxTopRight" width="7" xPos="62" yPos="78" />
+    <Image height="7" name="ListboxBottomLeft" width="7" xPos="41" yPos="99" />
+    <Image height="7" name="ListboxBottomRight" width="7" xPos="62" yPos="99" />
+    <Image height="6" name="ListboxBackdrop" width="6" xPos="52" yPos="89" />
+    <Image height="16" name="ListboxSelectionBrush" width="16" xPos="8" yPos="70" />
+    <Image height="16" name="ComboboxEditLeft" width="8" xPos="138" yPos="2" />
+    <Image height="16" name="ComboboxEditMiddle" width="8" xPos="148" yPos="2" />
+    <Image height="16" name="ComboboxListButtonNormal" width="16" xPos="158" yPos="2" />
+    <Image height="16" name="ComboboxListButtonHover" width="16" xPos="158" yPos="20" />
+    <Image height="8" name="ComboboxListLeft" width="8" xPos="138" yPos="48" />
+    <Image height="8" name="ComboboxListRight" width="8" xPos="158" yPos="48" />
+    <Image height="8" name="ComboboxListTop" width="8" xPos="148" yPos="48" />
+    <Image height="8" name="ComboboxListBottom" width="8" xPos="148" yPos="58" />
+    <Image height="8" name="ComboboxListTopLeft" width="8" xPos="138" yPos="38" />
+    <Image height="8" name="ComboboxListTopRight" width="8" xPos="158" yPos="38" />
+    <Image height="8" name="ComboboxListBottomLeft" width="8" xPos="138" yPos="58" />
+    <Image height="8" name="ComboboxListBottomRight" width="8" xPos="158" yPos="58" />
+    <Image height="8" name="ComboboxListBackdrop" width="8" xPos="148" yPos="48" />
+    <Image height="16" name="ComboboxSelectionBrush" width="16" xPos="8" yPos="70" />
+    <Image height="1" name="ComboboxDividerLeft" width="14" xPos="138" yPos="68" />
+    <Image height="1" name="ComboboxDividerMiddle" width="8" xPos="154" yPos="68" />
+    <Image height="1" name="ComboboxDividerRight" width="14" xPos="164" yPos="68" />
+    <Image height="12" name="HeaderBarBackdropNormal" width="10" xPos="230" yPos="163" />
+    <Image height="12" name="HeaderBarBackdropHover" width="10" xPos="230" yPos="163" />
+    <Image height="16" name="HeaderBarSplitterNormal" width="3" xPos="225" yPos="92" />
+    <Image height="16" name="HeaderBarSplitterHover" width="3" xPos="200" yPos="92" />
+    <Image height="8" name="HeaderBarSortUp" width="8" xPos="233" yPos="178" />
+    <Image height="8" name="HeaderBarSortDown" width="8" xPos="244" yPos="178" />
+    <Image height="6" name="MultiListLeft" width="7" xPos="170" yPos="92" />
+    <Image height="6" name="MultiListRight" width="7" xPos="191" yPos="92" />
+    <Image height="7" name="MultiListTop" width="6" xPos="181" yPos="81" />
+    <Image height="7" name="MultiListBottom" width="6" xPos="181" yPos="102" />
+    <Image height="7" name="MultiListTopLeft" width="7" xPos="170" yPos="81" />
+    <Image height="7" name="MultiListTopRight" width="7" xPos="191" yPos="81" />
+    <Image height="7" name="MultiListBottomLeft" width="7" xPos="170" yPos="102" />
+    <Image height="7" name="MultiListBottomRight" width="7" xPos="191" yPos="102" />
+    <Image height="6" name="MultiListBackdrop" width="6" xPos="181" yPos="92" />
+    <Image height="14" name="MultiListSelectionBrush" width="14" xPos="9" yPos="71" />
+    <Image height="12" name="AltProgressLeft" width="8" xPos="71" yPos="88" />
+    <Image height="12" name="AltProgressMiddle" width="8" xPos="81" yPos="88" />
+    <Image height="12" name="AltProgressRight" width="8" xPos="91" yPos="88" />
+    <Image height="4" name="AltProgressQuarter" width="3" xPos="102" yPos="89" />
+    <Image height="5" name="AltProgressHalf" width="4" xPos="109" yPos="89" />
+    <Image height="8" name="AltProgressLight1" width="4" xPos="100" yPos="97" />
+    <Image height="8" name="AltProgressLight2" width="4" xPos="106" yPos="97" />
+    <Image height="8" name="AltProgressLight3" width="4" xPos="112" yPos="97" />
+    <Image height="8" name="AltProgressLight4" width="4" xPos="118" yPos="97" />
+    <Image height="8" name="AltProgressLight5" width="4" xPos="124" yPos="97" />
+    <Image height="8" name="AltProgressLight6" width="4" xPos="130" yPos="97" />
+    <Image height="8" name="AltProgressLight7" width="4" xPos="136" yPos="97" />
+    <Image height="8" name="AltProgressLight8" width="4" xPos="142" yPos="97" />
+    <Image height="8" name="AltProgressLight9" width="4" xPos="148" yPos="97" />
+    <Image height="8" name="AltProgressLight10" width="4" xPos="154" yPos="97" />
+    <Image height="16" name="CloseButtonNormal" width="16" xPos="41" yPos="128" />
+    <Image height="16" name="CloseButtonHover" width="16" xPos="41" yPos="146" />
+    <Image height="16" name="CloseButtonPressed" width="16" xPos="41" yPos="164" />
+    <Image height="10" name="NewCloseButtonNormal" width="10" xPos="90" yPos="146" />
+    <Image height="10" name="NewCloseButtonHover" width="10" xPos="90" yPos="146" />
+    <Image height="10" name="NewCloseButtonPressed" width="10" xPos="90" yPos="146" />
+    <Image height="6" name="MultiLineEditboxLeft" width="6" xPos="41" yPos="89" />
+    <Image height="6" name="MultiLineEditboxRight" width="6" xPos="63" yPos="89" />
+    <Image height="6" name="MultiLineEditboxTop" width="6" xPos="52" yPos="78" />
+    <Image height="6" name="MultiLineEditboxBottom" width="6" xPos="52" yPos="100" />
+    <Image height="6" name="MultiLineEditboxTopLeft" width="6" xPos="41" yPos="78" />
+    <Image height="6" name="MultiLineEditboxTopRight" width="6" xPos="63" yPos="78" />
+    <Image height="6" name="MultiLineEditboxBottomLeft" width="6" xPos="41" yPos="100" />
+    <Image height="6" name="MultiLineEditboxBottomRight" width="6" xPos="63" yPos="100" />
+    <Image height="6" name="MultiLineEditboxBackdrop" width="6" xPos="52" yPos="89" />
+    <Image height="14" name="MultiLineEditboxSelectionBrush" width="14" xPos="9" yPos="71" />
+    <Image height="17" name="MouseTarget" width="17" xOffset="-8" xPos="182" yOffset="-8" yPos="127" />
+    <Image height="25" name="MouseArrow" width="31" xPos="138" yPos="127" />
+    <Image height="18" name="MouseMoveCursor" width="18" xOffset="-8" xPos="201" yOffset="-8" yPos="127" />
+    <Image height="18" name="MouseNoSoCursor" width="8" xOffset="-3" xPos="221" yOffset="-8" yPos="127" />
+    <Image height="8" name="MouseEsWeCursor" width="18" xOffset="-8" xPos="182" yOffset="-3" yPos="150" />
+    <Image height="14" name="MouseNeSwCursor" width="14" xOffset="-7" xPos="201" yOffset="-7" yPos="147" />
+    <Image height="14" name="MouseNwSeCursor" width="14" xOffset="-7" xPos="230" yOffset="-7" yPos="126" />
+    <Image height="18" name="MouseTextBar" width="7" xOffset="-2" xPos="173" yOffset="-9" yPos="127" />
+    <Image height="1" name="TabHorizontalFiller" width="7" xPos="197" yPos="201" />
+    <Image height="7" name="TabContentPaneUpperLeft" width="7" xPos="41" yPos="78" />
+    <Image height="7" name="TabContentPaneUpper" width="6" xPos="52" yPos="78" />
+    <Image height="7" name="TabContentPaneUpperRight" width="7" xPos="62" yPos="78" />
+    <Image height="6" name="TabContentPaneLeft" width="7" xPos="41" yPos="89" />
+    <Image height="6" name="TabContentPaneRight" width="7" xPos="62" yPos="89" />
+    <Image height="7" name="TabContentPaneLower" width="6" xPos="52" yPos="99" />
+    <Image height="7" name="TabContentPaneLowerLeft" width="7" xPos="41" yPos="99" />
+    <Image height="7" name="TabContentPaneLowerRight" width="7" xPos="62" yPos="99" />
+    <Image height="6" name="TabContentPaneMiddle" width="6" xPos="52" yPos="89" />
+    <Image height="17" name="TabButtonScrollLeftNormal" width="16" xPos="97" yPos="108" />
+    <Image height="17" name="TabButtonScrollRightNormal" width="16" xPos="112" yPos="108" />
+    <Image height="17" name="TabButtonScrollLeftHover" width="16" xPos="127" yPos="108" />
+    <Image height="17" name="TabButtonScrollRightHover" width="16" xPos="142" yPos="108" />
+    <Image height="6" name="TabButtonLeftNormal" width="7" xPos="41" yPos="89" />
+    <Image height="6" name="TabButtonRightNormal" width="7" xPos="62" yPos="89" />
+    <Image height="7" name="TabButtonUpperNormal" width="6" xPos="52" yPos="78" />
+    <Image height="7" name="TabButtonLowerNormal" width="6" xPos="52" yPos="99" />
+    <Image height="7" name="TabButtonUpperLeftNormal" width="7" xPos="41" yPos="78" />
+    <Image height="7" name="TabButtonUpperLeft2Normal" width="7" xPos="186" yPos="164" />
+    <Image height="7" name="TabButtonUpperRightNormal" width="7" xPos="62" yPos="78" />
+    <Image height="7" name="TabButtonLowerLeftNormal" width="7" xPos="41" yPos="99" />
+    <Image height="7" name="TabButtonLowerRightNormal" width="7" xPos="62" yPos="99" />
+    <Image height="7" name="TabButtonLowerRight2Normal" width="7" xPos="187" yPos="195" />
+    <Image height="6" name="TabButtonMiddleNormal" width="6" xPos="52" yPos="89" />
+    <Image height="6" name="TabButtonLeftSelected" width="7" xPos="41" yPos="89" />
+    <Image height="6" name="TabButtonRightSelected" width="7" xPos="62" yPos="89" />
+    <Image height="7" name="TabButtonUpperSelected" width="6" xPos="52" yPos="78" />
+    <Image height="6" name="TabButtonLowerSelected" width="6" xPos="52" yPos="89" />
+    <Image height="7" name="TabButtonUpperLeftSelected" width="7" xPos="41" yPos="78" />
+    <Image height="7" name="TabButtonUpperRightSelected" width="7" xPos="62" yPos="78" />
+    <Image height="7" name="TabButtonLowerLeftSelected" width="7" xPos="41" yPos="99" />
+    <Image height="7" name="TabButtonLowerRightSelected" width="7" xPos="62" yPos="99" />
+    <Image height="6" name="TabButtonMiddleSelected" width="6" xPos="52" yPos="89" />
+    <Image height="4" name="TooltipTopLeft" width="4" xPos="61" yPos="160" />
+    <Image height="4" name="TooltipTopRight" width="5" xPos="85" yPos="160" />
+    <Image height="5" name="TooltipBottomLeft" width="4" xPos="61" yPos="184" />
+    <Image height="5" name="TooltipBottomRight" width="5" xPos="85" yPos="184" />
+    <Image height="6" name="TooltipLeftEdge" width="4" xPos="61" yPos="171" />
+    <Image height="6" name="TooltipRightEdge" width="5" xPos="85" yPos="171" />
+    <Image height="4" name="TooltipTopEdge" width="6" xPos="72" yPos="160" />
+    <Image height="5" name="TooltipBottomEdge" width="6" xPos="72" yPos="184" />
+    <Image height="6" name="TooltipMiddle" width="6" xPos="72" yPos="171" />
+    <Image height="2" name="MenuTopLeft" width="2" xPos="166" yPos="204" />
+    <Image height="2" name="MenuTopRight" width="3" xPos="175" yPos="204" />
+    <Image height="3" name="MenuBottomLeft" width="2" xPos="166" yPos="213" />
+    <Image height="3" name="MenuBottomRight" width="3" xPos="175" yPos="213" />
+    <Image height="1" name="MenuLeft" width="2" xPos="166" yPos="209" />
+    <Image height="1" name="MenuRight" width="3" xPos="175" yPos="209" />
+    <Image height="2" name="MenuTop" width="1" xPos="171" yPos="204" />
+    <Image height="3" name="MenuBottom" width="1" xPos="171" yPos="213" />
+    <Image height="1" name="MenuMiddle" width="1" xPos="171" yPos="209" />
+    <Image height="2" name="PopupMenuFrameTopLeft" width="2" xPos="186" yPos="204" />
+    <Image height="2" name="PopupMenuFrameTopRight" width="4" xPos="195" yPos="204" />
+    <Image height="4" name="PopupMenuFrameBottomLeft" width="2" xPos="186" yPos="213" />
+    <Image height="4" name="PopupMenuFrameBottomRight" width="4" xPos="195" yPos="213" />
+    <Image height="1" name="PopupMenuFrameLeft" width="2" xPos="186" yPos="209" />
+    <Image height="1" name="PopupMenuFrameRight" width="4" xPos="195" yPos="209" />
+    <Image height="2" name="PopupMenuFrameTop" width="1" xPos="191" yPos="204" />
+    <Image height="4" name="PopupMenuFrameBottom" width="1" xPos="191" yPos="213" />
+    <Image height="1" name="PopupMenuMiddle" width="1" xPos="191" yPos="209" />
+    <Image height="5" name="PopupMenuArrowRight" width="5" xPos="179" yPos="204" />
+    <Image height="5" name="PopupMenuArrowLeft" width="5" xPos="179" yPos="210" />
+    <Image height="11" name="TreeListClosed" width="7" xPos="175" yPos="111" />
+    <Image height="7" name="TreeListOpened" width="11" xPos="164" yPos="111" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/TradeWindow.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,7 @@
+<Imageset version="2" autoScaled="false" imagefile="TradeWindow.png" name="TradeWindow" nativeHorzRes="800" nativeVertRes="600">
+	<Image height="826" name="Background" width="538" xPos="0" yPos="0" />
+	<Image height="163" name="BtnUp" width="33" xPos="628" yPos="225" />
+	<Image height="163" name="BtnUpHover" width="33" xPos="689" yPos="225" />
+	<Image height="163" name="BtnDown" width="33" xPos="628" yPos="413" />
+	<Image height="163" name="BtnDownHover" width="33" xPos="689" yPos="413" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/misc.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,12 @@
+<Imageset version="2" autoScaled="false" imagefile="misc.png" name="Misc" nativeHorzRes="800" nativeVertRes="600">
+    <Image height="195" name="QuestionDialog" width="361" xPos="0" yPos="258" />
+    <Image height="42" name="ProgressBarLeft" width="7" xPos="29" yPos="117" />
+    <Image height="42" name="ProgressBarMiddle" width="7" xPos="35" yPos="117" />
+    <Image height="42" name="ProgressBarRight" width="6" xPos="89" yPos="117" />
+    <Image height="42" name="ProgressBarDimSegment" width="21" xPos="114" yPos="117" />
+    <Image height="42" name="ProgressBarLitSegment" width="21" xPos="159" yPos="117" />
+    <Image height="30" name="ProgressBarTimerSegment" width="21" xPos="203" yPos="124" />
+    <Image height="30" name="CloseBtnReleased" width="30" xPos="90" yPos="55" />
+    <Image height="30" name="CloseBtnPressed" width="30" xPos="196" yPos="55" />
+    <Image height="30" name="CloseBtnHovered" width="30" xPos="143" yPos="55" />
+</Imageset>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/portrait.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,3 @@
+<Imageset version="2" autoScaled="false" imagefile="portrait.png" name="Portrait" nativeHorzRes="800" nativeVertRes="600">
+	<Image height="105" name="Portrait" width="94" xPos="0" yPos="0" />
+</Imageset>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/imagesets/skills.imageset	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Imageset version="2" name="skills" imagefile="skills.png" nativeHorzRes="1024" nativeVertRes="768" autoScaled="true" >
+    <Image name="bash" xPos="2" yPos="2" width="90" height="90" />
+    <Image name="hammer_bash" xPos="94" yPos="2" width="90" height="90" />
+    <Image name="around_blow" xPos="186" yPos="2" width="90" height="90" />
+    <Image name="whirl_blow" xPos="278" yPos="2" width="90" height="90" />
+    <Image name="smash" xPos="370" yPos="2" width="90" height="90" />
+    <Image name="hate_mage" xPos="2" yPos="94" width="90" height="90" />
+    <Image name="charge" xPos="94" yPos="94" width="90" height="90" />
+    <Image name="storm_charge" xPos="186" yPos="94" width="90" height="90" />
+    <Image name="decoy" xPos="278" yPos="94" width="90" height="90" />
+    <Image name="scare" xPos="370" yPos="94" width="90" height="90" />
+    <Image name="firesword" xPos="2" yPos="186" width="90" height="90" />
+    <Image name="flamesword" xPos="94" yPos="186" width="90" height="90" />
+    <Image name="flamearmor" xPos="186" yPos="186" width="90" height="90" />
+    <Image name="battle_cry" xPos="278" yPos="186" width="90" height="90" />
+    <Image name="warcry" xPos="370" yPos="186" width="90" height="90" />
+    <Image name="regenerate" xPos="2" yPos="278" width="90" height="90" />
+    <Image name="anger" xPos="94" yPos="278" width="90" height="90" />
+    <Image name="fury" xPos="186" yPos="278" width="90" height="90" />
+    <Image name="steadfast" xPos="278" yPos="278" width="90" height="90" />
+    <Image name="block" xPos="370" yPos="278" width="90" height="90" />
+    <Image name="weaponmaster" xPos="2" yPos="370" width="90" height="90" />
+    <Image name="monster_hunter" xPos="94" yPos="370" width="90" height="90" />
+    <Image name="monster_slayer" xPos="186" yPos="370" width="90" height="90" />
+    <Image name="endurance" xPos="278" yPos="370" width="90" height="90" />
+    <Image name="attack" xPos="370" yPos="370" width="90" height="90" />
+    
+    <Image name="holy_light" xPos="554" yPos="2" width="90" height="90" />
+    <Image name="holy_fire" xPos="646" yPos="2" width="90" height="90" />
+    <Image name="burning_rage" xPos="738" yPos="2" width="90" height="90" />
+    <Image name="dmgreduce_undead" xPos="830" yPos="2" width="90" height="90" />
+    <Image name="cure_blind_mute_party" xPos="922" yPos="2" width="90" height="90" />
+    <Image name="blazing_shield" xPos="554" yPos="94" width="90" height="90" />
+    <Image name="light_beam" xPos="646" yPos="94" width="90" height="90" />
+    <Image name="burning_sun" xPos="738" yPos="94" width="90" height="90" />
+    <Image name="break_binding" xPos="830" yPos="94" width="90" height="90" />
+    <Image name="disrupt_binding" xPos="922" yPos="94" width="90" height="90" />
+    <Image name="magic_shield" xPos="554" yPos="186" width="90" height="90" />
+    <Image name="dmgreduce_demon" xPos="646" yPos="186" width="90" height="90" />
+    <Image name="cure_pois_burn_party" xPos="738" yPos="186" width="90" height="90" />
+    <Image name="acid" xPos="830" yPos="186" width="90" height="90" />
+    <Image name="heal" xPos="922" yPos="186" width="90" height="90" />
+    <Image name="heal_party" xPos="554" yPos="278" width="90" height="90" />
+    <Image name="divine_wind" xPos="646" yPos="278" width="90" height="90" />
+    <Image name="divine_storm" xPos="738" yPos="278" width="90" height="90" />
+    <Image name="blade_storm" xPos="830" yPos="278" width="90" height="90" />
+    <Image name="dmgreduce_elemental" xPos="922" yPos="278" width="90" height="90" />
+    <Image name="cure_conf_bsrk_party" xPos="554" yPos="370" width="90" height="90" />
+    <Image name="hypnosis" xPos="646" yPos="370" width="90" height="90" />
+    <Image name="hypnosis2" xPos="738" yPos="370" width="90" height="90" />
+    <Image name="keen_mind" xPos="830" yPos="370" width="90" height="90" />
+    <Image name="holy_attack" xPos="922" yPos="370" width="90" height="90" />
+    
+    <Image name="triple_shot" xPos="2" yPos="554" width="90" height="90" />
+    <Image name="guided_triple_shot" xPos="94" yPos="554" width="90" height="90" />
+    <Image name="multishot" xPos="186" yPos="554" width="90" height="90" />
+    <Image name="volley_shot" xPos="278" yPos="554" width="90" height="90" />
+    <Image name="pierce" xPos="370" yPos="554" width="90" height="90" />
+    <Image name="weak_point" xPos="2" yPos="646" width="90" height="90" />
+    <Image name="blind_rage" xPos="94" yPos="646" width="90" height="90" />
+    <Image name="vacuum" xPos="186" yPos="646" width="90" height="90" />
+    <Image name="death_roulette" xPos="278" yPos="646" width="90" height="90" />
+    <Image name="exploding_arrow" xPos="370" yPos="646" width="90" height="90" />
+    <Image name="exploding_cascade" xPos="2" yPos="738" width="90" height="90" />
+    <Image name="aimed_shot" xPos="94" yPos="738" width="90" height="90" />
+    <Image name="bow_spirit" xPos="186" yPos="738" width="90" height="90" />
+    <Image name="ice_arrows" xPos="278" yPos="738" width="90" height="90" />
+    <Image name="freezing_arrows" xPos="370" yPos="738" width="90" height="90" />
+    <Image name="wind_arrows" xPos="2" yPos="830" width="90" height="90" />
+    <Image name="storm_arrows" xPos="94" yPos="830" width="90" height="90" />
+    <Image name="wind_walk" xPos="186" yPos="830" width="90" height="90" />
+    <Image name="evade" xPos="278" yPos="830" width="90" height="90" />
+    <Image name="critical_strike" xPos="370" yPos="830" width="90" height="90" />
+    <Image name="concentration" xPos="2" yPos="922" width="90" height="90" />
+    <Image name="mental_wall" xPos="94" yPos="922" width="90" height="90" />
+    <Image name="resist_ice" xPos="186" yPos="922" width="90" height="90" />
+    <Image name="resist_air" xPos="278" yPos="922" width="90" height="90" />
+    <Image name="range_attack" xPos="370" yPos="922" width="90" height="90" />
+    
+    <Image name="fire_bolt" xPos="554" yPos="554" width="90" height="90" />
+    <Image name="fire_strike" xPos="646" yPos="554" width="90" height="90" />
+    <Image name="fire_wave" xPos="738" yPos="554" width="90" height="90" />
+    <Image name="fire_storm" xPos="830" yPos="554" width="90" height="90" />
+    <Image name="fire_ball" xPos="922" yPos="554" width="90" height="90" />
+    <Image name="inferno_ball" xPos="554" yPos="646" width="90" height="90" />
+    <Image name="fire_wall" xPos="646" yPos="646" width="90" height="90" />
+    <Image name="inflame" xPos="738" yPos="646" width="90" height="90" />
+    <Image name="ice_bolt" xPos="830" yPos="646" width="90" height="90" />
+    <Image name="ice_spike" xPos="922" yPos="646" width="90" height="90" />
+    <Image name="snow_storm" xPos="554" yPos="738" width="90" height="90" />
+    <Image name="blizzard" xPos="646" yPos="738" width="90" height="90" />
+    <Image name="ice_ring" xPos="738" yPos="738" width="90" height="90" />
+    <Image name="frost_ring" xPos="830" yPos="738" width="90" height="90" />
+    <Image name="freeze" xPos="922" yPos="738" width="90" height="90" />
+    <Image name="chill" xPos="554" yPos="830" width="90" height="90" />
+    <Image name="lightning" xPos="646" yPos="830" width="90" height="90" />
+    <Image name="lightning_strike" xPos="738" yPos="830" width="90" height="90" />
+    <Image name="thunderstorm" xPos="830" yPos="830" width="90" height="90" />
+    <Image name="thunderstorm2" xPos="922" yPos="830" width="90" height="90" />
+    <Image name="chain_lightning" xPos="554" yPos="922" width="90" height="90" />
+    <Image name="chain_lightning2" xPos="646" yPos="922" width="90" height="90" />
+    <Image name="static_shield" xPos="738" yPos="922" width="90" height="90" />
+    <Image name="ionisation" xPos="830" yPos="922" width="90" height="90" />
+    <Image name="magic_attack" xPos="922" yPos="922" width="90" height="90" />
+</Imageset>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/characterscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CharInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.463,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/controlpanel_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ControlPanel_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.08236,0},{0.798348,0},{0.9176,0},{1,0}}" /> <!-- 0,69606 * 1,15 = 0,835272 -->
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CreditsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.15,0},{0.05,0},{0.85,0},{0.95,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/dialogwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="DialogWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/hostgamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="HostGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/inventory_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Inventory_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.537,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/joingamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="JoinGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/mainmenu_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MainMenu_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/minimapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MinimapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.15,0},{0.05,0},{0.85,0},{0.85,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/options_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="OptionsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.075,0},{0.1,0},{0.925,0},{0.9,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/questinfo_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="QuestInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.463,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/skilltree_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Skilltree_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.537,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/tradewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="TradeWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.463,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/004_003/worldmapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,17 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="WorldmapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Alpha" value="0.33" />
+        <Property name="Image" value="SWB/PlainGray" />
+        <Property name="Visible" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="OverlayColour" value="FF000000" />
+
+        <Window type="SWB/StaticImage" name="WorldmapWindow_Holder_aux" >
+            <Property name="FrameEnabled" value="True" />
+            <Property name="Area" value="{{0.151,0},{0.05,0},{0.849,0},{0.95,0}}" />
+            <Property name="BackgroundEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/characterscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CharInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.50,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/controlpanel_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ControlPanel_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0368,0},{0.798348,0},{0.9632,0},{1,0}}" /> <!-- 0,772 * 1,2 = 0,9264 -->
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CreditsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.113,0},{0.05,0},{0.887,0},{0.95,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/dialogwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="DialogWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/hostgamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="HostGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/inventory_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Inventory_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.50,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/joingamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="JoinGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/mainmenu_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MainMenu_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/minimapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MinimapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.113,0},{0.05,0},{0.887,0},{0.85,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/options_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="OptionsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.05,0},{0.1,0},{0.95,0},{0.9,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/questinfo_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="QuestInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.50,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/skilltree_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Skilltree_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.50,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/tradewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="TradeWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.50,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/005_004/worldmapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,17 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="WorldmapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Alpha" value="0.33" />
+        <Property name="Image" value="SWB/PlainGray" />
+        <Property name="Visible" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="OverlayColour" value="FF000000" />
+
+        <Window type="SWB/StaticImage" name="WorldmapWindow_Holder_aux" >
+            <Property name="FrameEnabled" value="True" />
+            <Property name="Area" value="{{0.113,0},{0.05,0},{0.887,0},{0.95,0}}" />
+            <Property name="BackgroundEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/characterscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CharInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.352,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/controlpanel_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ControlPanel_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.1862,0},{0.798348,0},{0.8138,0},{1,0}}" /> <!-- 0,523 * 1,2 = 0,6276 -->
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CreditsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.2375,0},{0.05,0},{0.7625,0},{0.95,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/dialogwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="DialogWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/hostgamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="HostGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/inventory_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Inventory_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.648,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/joingamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="JoinGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/mainmenu_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,11 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MainMenu_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="1.0" />
+        <Property name="Visible" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/minimapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MinimapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.2375,0},{0.05,0},{0.7625,0},{0.85,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/options_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="OptionsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.18,0},{0.1,0},{0.82,0},{0.9,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/questinfo_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="QuestInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.352,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/skilltree_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Skilltree_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.648,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/tradewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="TradeWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.352,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_009/worldmapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,17 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="WorldmapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Alpha" value="0.33" />
+        <Property name="Image" value="SWB/PlainGray" />
+        <Property name="Visible" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="OverlayColour" value="FF000000" />
+
+        <Window type="SWB/StaticImage" name="WorldmapWindow_Holder_aux" >
+            <Property name="FrameEnabled" value="True" />
+            <Property name="Area" value="{{0.2375,0},{0.05,0},{0.7625,0},{0.95,0}}" />
+            <Property name="BackgroundEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/characterscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CharInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.394,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/controlpanel_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ControlPanel_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.1532,0},{0.798348,0},{0.8468,0},{1,0}}" /> <!-- 0,578 * 1,2 = 0,6936 -->
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/creditsscreen_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CreditsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.2085,0},{0.05,0},{0.7915,0},{0.95,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/dialogwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="DialogWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/hostgamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="HostGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/inventory_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Inventory_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.606,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/joingamewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="JoinGameWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.25,0},{0.16,0},{0.75,0},{0.72,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/mainmenu_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,10 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MainMenu_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/minimapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MinimapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.2085,0},{0.05,0},{0.7915,0},{0.85,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Alpha" value="0" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/options_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,9 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="OptionsWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.145,0},{0.1,0},{0.855,0},{0.9,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/questinfo_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="QuestInfo_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.394,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/skilltree_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="Skilltree_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.606,0},{0.0,0},{1.0,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/tradewindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,8 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="TradeWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{0.394,0},{0.86,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="Alpha" value="1" />
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/016_010/worldmapwindow_holder.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,17 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="WorldmapWindow_Holder" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Alpha" value="0.33" />
+        <Property name="Image" value="SWB/PlainGray" />
+        <Property name="Visible" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="OverlayColour" value="FF000000" />
+
+        <Window type="SWB/StaticImage" name="WorldmapWindow_Holder_aux" >
+            <Property name="FrameEnabled" value="True" />
+            <Property name="Area" value="{{0.2085,0},{0.05,0},{0.7915,0},{0.95,0}}" />
+            <Property name="BackgroundEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/GUILayout.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="GUILayout" type="GUILayoutType"/>
+	
+	<xsd:complexType name="GUILayoutType">
+		<xsd:sequence>
+			<xsd:element name="Window" type="WindowType" />
+		</xsd:sequence>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	
+	<xsd:complexType name="WindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="UserString" type="UserStringType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="type" type="xsd:string" use="required"/>
+		<xsd:attribute name="name" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="AutoWindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="namePath" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="PropertyType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="name" type="xsd:string" use="required"/>
+				<xsd:attribute name="value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+	
+	<xsd:complexType name="UserStringType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="name" type="xsd:string" use="required"/>
+				<xsd:attribute name="value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+	
+	<xsd:complexType name="LayoutImportType">
+		<xsd:attribute name="filename" type="xsd:string" use="required"/>
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="EventType">
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="function" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+</xsd:schema>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/LoginDialog.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,41 @@
+<GUILayout>
+    <Window name="LoginDialog" type="TaharezLook/FrameWindow">
+        <Property name="Area" value="{{0,268},{0,108},{0,728},{0,476}}" />
+        <Window name="LoginDialog/StaticText" type="TaharezLook/StaticText">
+            <Property name="Area" value="{{-0.0720721,1.5},{0.00882872,37},{0.927928,-319.5},{1.00883,-262}}" />
+            <Property name="Text" value="Login" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorizontalAlignment" value="Centre" />
+        </Window>
+        <Window name="LoginDialog/PasswordEditbox" type="TaharezLook/Editbox">
+            <Property name="Area" value="{{0.268734,9.87598},{0.50618,-2},{0.268734,300.682},{0.50618,48}}" />
+            <Property name="MaskText" value="True" />
+        </Window>
+        <Window name="LoginDialog/StaticText2" type="TaharezLook/StaticText">
+            <Property name="Area" value="{{-0.0416667,-136},{0,110},{0.829955,-408},{1,-189}}" />
+            <Property name="Text" value="Username:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorizontalAlignment" value="Centre" />
+        </Window>
+        <Window name="LoginDialog/StaticText22" type="TaharezLook/StaticText">
+            <Property name="Area" value="{{-0.0641892,-126},{0,175},{0.807432,-398},{1,-124}}" />
+            <Property name="Text" value="Password:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorizontalAlignment" value="Centre" />
+        </Window>
+        <Window name="LoginDialog/LoginButton" type="TaharezLook/Button">
+            <Property name="Area" value="{{0,20},{0,265},{0,190},{0,320}}" />
+            <Property name="Text" value="Login" />
+        </Window>
+        <Window name="LoginDialog/UsernameEditbox" type="TaharezLook/Editbox">
+            <Property name="Area" value="{{0.271318,9.53488},{0.332549,-8},{0.271318,300.349},{0.332549,42}}" />
+        </Window>
+        <Window name="LoginDialog/CancelButton" type="TaharezLook/Button">
+            <Property name="Area" value="{{0,245},{0,265},{0,420},{0,320}}" />
+            <Property name="Text" value="Cancel" />
+        </Window>
+    </Window>
+</GUILayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/benchmarktab.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,102 @@
+
+
+<GUILayout version="4" >
+    <Window type="DefaultWindow" name="BenchmarkTab" >
+        <Property name="Area" value="{{0.209961,0},{0.175781,0},{0.81543,0},{0.761719,0}}" />
+        <Window type="TaharezLook/Button" name="BenchmarkTab/StartButton" >
+            <Property name="Text" value="Start Benchmark" />
+            <Property name="Area" value="{{0.0235144,0},{0.861905,0},{0.34983,0},{0.973016,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="BenchmarkTab/CPULabel" >
+            <Property name="Text" value="CPU:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0210526,0},{0.0428571,1},{0.0939728,2},{0.120635,1}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <AutoWindow NameSuffix="__auto_hscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+            <AutoWindow NameSuffix="__auto_vscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+        </Window>
+        <Window type="TaharezLook/StaticText" name="BenchmarkTab/GPULabel2" >
+            <Property name="Text" value="GPU:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0210526,0},{0.136508,-1},{0.0939727,2},{0.214286,-1}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <AutoWindow NameSuffix="__auto_hscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+            <AutoWindow NameSuffix="__auto_vscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+        </Window>
+        <Window type="TaharezLook/MultiLineEditbox" name="BenchmarkTab/ResultsEditbox" >
+            <Property name="Text" >
+</Property>
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0241935,0},{0.233333,0},{0.983871,0},{0.844445,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+            <AutoWindow NameSuffix="__auto_hscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+            <AutoWindow NameSuffix="__auto_vscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+        </Window>
+        <Window type="TaharezLook/Button" name="BenchmarkTab/Button" >
+            <Property name="Text" value="Save Results" />
+            <Property name="Disabled" value="True" />
+            <Property name="Area" value="{{0.362903,0},{0.866667,0},{0.66129,0},{0.966667,0}}" />
+        </Window>
+        <Window type="TaharezLook/Button" name="BenchmarkTab/Button2" >
+            <Property name="Text" value="Send by Email" />
+            <Property name="Disabled" value="True" />
+            <Property name="Area" value="{{0.677419,0},{0.866667,0},{0.983871,0},{0.966667,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="BenchmarkTab/CPULabel2" >
+            <Property name="Text" value="OS:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.545246,2},{0.0428571,1},{0.610102,2},{0.120635,1}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <AutoWindow NameSuffix="__auto_hscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+            <AutoWindow NameSuffix="__auto_vscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+        </Window>
+        <Window type="TaharezLook/StaticText" name="BenchmarkTab/GPULabel22" >
+            <Property name="Text" value="Driver:" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.496859,2},{0.136508,-1},{0.585908,2},{0.214285,-1}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <AutoWindow NameSuffix="__auto_hscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+            <AutoWindow NameSuffix="__auto_vscrollbar__" >
+                <AutoWindow NameSuffix="__auto_incbtn__" />
+            </AutoWindow>
+        </Window>
+        <Window type="TaharezLook/Editbox" name="BenchmarkTab/CPUBox" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0967742,0},{0.0444444,0},{0.483871,0},{0.122222,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="BenchmarkTab/GPUBox" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0967742,0},{0.133333,0},{0.483871,0},{0.211111,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="BenchmarkTab/OSBox" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.596774,0},{0.0444447,0},{0.983871,0},{0.122222,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="BenchmarkTab/DriverBox" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.596774,0},{0.133334,0},{0.983871,0},{0.211111,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/characterscreen.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,351 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="CharInfo" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Text" value="Inventory" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <Window type="SWB/StaticImage" name="charinfo_aux" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+
+            <!-- The top side where the player picture, and main information are displayed -->
+            <Window type="SWB/GroupBox" name="Playerinfo" >
+                <Property name="Text" value="Player info" />
+                <Property name="Area" value="{{0.0,0},{0.01,0},{1.0,0},{0.32,0}}" />
+                
+                <Window type="SWB/StaticImage" name="Portrait" >
+                    <Property name="Image" value="Portrait/Portrait" />
+                    <Property name="FrameEnabled" value="True" />
+                    <Property name="Area" value="{{0.01,0},{0.04,0},{0.335,0},{0.95,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+
+                <Window type="SWB/StaticText" name="ClassLabel" >
+                    <Property name="Text" value="Class" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.340,0},{0.068,0},{0.630,0},{0.266,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ClassValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.650,0},{0.068,0},{0.990,0},{0.266,0}}" />
+                     <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="LevelLabel" >
+                    <Property name="Text" value="Level" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.340,0},{0.268,0},{0.630,0},{0.466,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="LevelValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.650,0},{0.268,0},{0.990,0},{0.466,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ExperienceLabel" >
+                    <Property name="Text" value="Experience" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.340,0},{0.468,0},{0.630,0},{0.666,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ExperienceValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.650,0},{0.468,0},{0.990,0},{0.666,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="HitpointsLabel" >
+                    <Property name="Text" value="Hitpoints" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.340,0},{0.688,0},{0.630,0},{0.868,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="HitpointsValueLabel" >
+                     <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.650,0},{0.688,0},{0.990,0},{0.868,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+            </Window>
+            
+            <!-- The area where the attributes (strength, dexterity, etc) are displayed -->
+            <Window type="SWB/GroupBox" name="Attributes" >
+                <Property name="Text" value="Attributes" />
+                <Property name="Area" value="{{0.0,0},{0.340,0},{1.0,0},{0.560,0}}" />
+                
+                <!-- Strength -->
+                <Window type="SWB/StaticText" name="StrengthLabel" >
+                    <Property name="Text" value="Strength" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.053,0},{0.337,0},{0.294,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="StrengthValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.338,0},{0.053,0},{0.438,0},{0.294,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="StrengthAddButton" >
+                    <Property name="Position" value="{{0.438,0},{0.060,0}}" />
+                    <Property name="Size" value="{{0.061,0},{0.228,0}}" />
+                    <Property name="NormalImage" value="CharScreen/PlusBtnReleased" />
+                    <Property name="HoverImage" value="CharScreen/PlusBtnReleased"  />
+                    <Property name="PushedImage" value="CharScreen/PlusBtnPressed" />
+                </Window>
+                
+                <!-- Dexterity -->
+                <Window type="SWB/StaticText" name="DexterityLabel" >
+                    <Property name="Text" value="Dexterity" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.353,0},{0.337,0},{0.594,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="DexterityValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.338,0},{0.353,0},{0.438,0},{0.594,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="DexterityAddButton" >
+                    <Property name="Position" value="{{0.438,0},{0.360,0}}" />
+                    <Property name="Size" value="{{0.061,0},{0.228,0}}" />
+                    <Property name="NormalImage" value="CharScreen/PlusBtnReleased" />
+                    <Property name="HoverImage" value="CharScreen/PlusBtnReleased"  />
+                    <Property name="PushedImage" value="CharScreen/PlusBtnPressed" />
+                </Window>
+                
+                <!-- Willpower -->
+                <Window type="SWB/StaticText" name="WillpowerLabel" >
+                    <Property name="Text" value="Willpower" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.50,0},{0.053,0},{0.837,0},{0.294,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="WillpowerValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.838,0},{0.053,0},{0.938,0},{0.294,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="WillpowerAddButton" >
+                    <Property name="Position" value="{{0.938,0},{0.060,0}}" />
+                    <Property name="Size" value="{{0.061,0},{0.228,0}}" />
+                    <Property name="NormalImage" value="CharScreen/PlusBtnReleased" />
+                    <Property name="HoverImage" value="CharScreen/PlusBtnReleased"  />
+                    <Property name="PushedImage" value="CharScreen/PlusBtnPressed" />
+                </Window>
+                
+                <!-- Magic power -->
+                <Window type="SWB/StaticText" name="MagicpowerLabel" >
+                    <Property name="Text" value="Magic power" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.50,0},{0.353,0},{0.837,0},{0.594,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="MagicpowerValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.838,0},{0.353,0},{0.938,0},{0.594,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="MagicpowerAddButton" >
+                    <Property name="Position" value="{{0.938,0},{0.360,0}}" />
+                    <Property name="Size" value="{{0.061,0},{0.228,0}}" />
+                    <Property name="NormalImage" value="CharScreen/PlusBtnReleased" />
+                    <Property name="HoverImage" value="CharScreen/PlusBtnReleased"  />
+                    <Property name="PushedImage" value="CharScreen/PlusBtnPressed" />
+                </Window>
+                
+                <Window type="SWB/StaticText" name="AttrPointsValueLabel" >
+                    <Property name="TextColours" value="tl:FF0AC92B tr:FF0AC92B bl:FF0AC92Bbr:FF0AC92B" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.10,0},{0.750,0},{0.95,0},{0.995,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+            </Window>
+   
+            
+            <Window type="SWB/GroupBox" name="Offense" >
+                <Property name="Text" value="Offense" />
+                <Property name="Area" value="{{0.0,0},{0.570,0},{0.540,0},{1.0,0}}" />
+                    
+                <Window type="SWB/StaticText" name="AttackLabel" >
+                    <Property name="Text" value="Attack" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.02,0},{0.60,0},{0.16,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="AttackValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.02,0},{0.99,0},{0.16,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="AttackSpeedLabel" >
+                    <Property name="Text" value="Attacks/s" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.16,0},{0.60,0},{0.30,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="AttackSpeedValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.16,0},{0.99,0},{0.30,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="RangeLabel" >
+                    <Property name="Text" value="Range" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.30,0},{0.60,0},{0.44,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="RangeValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.30,0},{0.99,0},{0.44,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="PowerLabel" >
+                    <Property name="Text" value="Power" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.44,0},{0.60,0},{0.58,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="PowerValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.44,0},{0.99,0},{0.58,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="BaseDmgLabel" >
+                    <Property name="Text" value="" />
+                    <Property name="TextColours" value="tl:FF4F94CD tr:FF4F94CD bl:FF4F94CD br:FF4F94CD" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.58,0},{0.60,0},{0.72,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="BaseDmgValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.58,0},{0.99,0},{0.72,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="Skill1DmgLabel" >
+                    <Property name="Text" value="" />
+                    <Property name="TextColours" value="tl:FF0AC92B tr:FF0AC92B bl:FF0AC92B br:FF0AC92B" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.72,0},{0.60,0},{0.86,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="Skill1DmgValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.72,0},{0.99,0},{0.86,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="Skill2DmgLabel" >
+                    <Property name="Text" value="" />
+                    <Property name="TextColours" value="tl:FF0AC92B tr:FF0AC92B bl:FF0AC92B br:FF0AC92B" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.86,0},{0.60,0},{1.0,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="Skill2DmgValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.60,0},{0.86,0},{0.99,0},{1.0,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>                
+            </Window>
+            
+            <!-- The defensive stats -->
+            <Window type="SWB/GroupBox" name="Defense" >
+                <Property name="Text" value="Defense" />
+                <Property name="Area" value="{{0.550,0},{0.570,0},{1.0,0},{1.0,0}}" />
+
+                <Window type="SWB/StaticText" name="ArmorLabel" >
+                    <Property name="Text" value="Armor" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.02,0},{0.6,0},{0.16,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ArmorValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.02,0},{0.99,0},{0.16,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="BlockLabel" >
+                    <Property name="Text" value="Block" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.16,0},{0.6,0},{0.30,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="BlockValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.16,0},{0.99,0},{0.30,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistPhysLabel" >
+                    <Property name="Text" value="Physical" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.44,0},{0.6,0},{0.58,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistPhysValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.44,0},{0.99,0},{0.58,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistFireLabel" >
+                    <Property name="Text" value="Fire" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.58,0},{0.6,0},{0.72,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistFireValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.58,0},{0.99,0},{0.72,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistAirLabel" >
+                    <Property name="Text" value="Air" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.72,0},{0.6,0},{0.86,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistAirValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.72,0},{0.99,0},{0.86,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistIceLabel" >
+                    <Property name="Text" value="Ice" />
+                    <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.0,0},{0.86,0},{0.6,0},{1.0,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ResistIceValueLabel" >
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.6,0},{0.86,0},{0.99,0},{1.0,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>                
+            </Window>
+            
+
+
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/charcreate.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,43 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="CharCreate" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0,0},{0.0,0},{1,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Window type="SWB/StaticText" name="CharNameLabel" >
+            <Property name="Text" value="Name" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.03,0},{0.04,0},{0.14,0},{0.096,0}}" />
+        </Window>
+        <Window type="SWB/Editbox" name="NameBox" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.16,0},{0.044,0},{0.31,0},{0.098,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="SWB/StaticText" name="CharClassLabel" >
+            <Property name="Text" value="Class" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.111,0},{0.14,0},{0.25,0},{0.194,0}}" />
+        </Window>
+        <Window type="SWB/Listbox" name="ClassList" >
+            <Property name="Text" value="Options" />
+            <Property name="Area" value="{{0.054,0},{0.2,0},{0.3,0},{0.33,0}}" />
+        </Window>
+        <Window type="SWB/Listbox" name="LookList" >
+            <Property name="Text" value="Options" />
+            <Property name="Area" value="{{0.054,0},{0.37,0},{0.3,0},{0.50,0}}" />
+        </Window>
+        <Window type="SWB/Button" name="AbortButton" >
+            <Property name="Text" value="Cancel" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0755,0},{0.63,0},{0.265,0},{0.69,0}}" />
+        </Window>
+        <Window type="SWB/Button" name="CharCreateButton" >
+            <Property name="Text" value="Create" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0755,0},{0.53,0},{0.265,0},{0.59,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/chatwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,19 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="ChatRootWindow" >
+        <Property name="TitlebarFont" value="SWB-M" />
+        <Property name="TitlebarEnabled" value="False" />
+        <Property name="Area" value="{{0.126758,0},{0.00859365,0},{0.67168,0},{0.521614,0}}" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="False" />
+
+        <Window type="SWB/StaticText" name="ChatTextBox" >
+            <Property name="Area" value="{{0.0107901,0},{0.0101163,0},{0.992967,0},{0.843295,0}}" />
+        </Window>
+
+        <Window type="SWB/Editbox" name="ChatInputLine" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0172587,0},{0.854329,0},{0.992982,0},{0.976468,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/controlpanel.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,292 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ControlPanel" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+
+        <Window type="SWB/ProgressBar" name="ExperienceProgressBar" >
+            <Property name="StepSize" value="0.01" />
+            <Property name="CurrentProgress" value="0" />
+            <Property name="Area" value="{{0.0,0},{0.9,0},{1.0,0},{1.0,0}}" />
+        </Window>
+
+        <Window type="SWB/StaticImage" name="CPContainer" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.02,0},{0.0,0},{0.98,0},{0.91,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+
+            <Window type="SWB/StaticImage" name="CP_Btns" >
+                <Property name="Image" value="ControlPanel/Belt" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.4,0},{1.0,0},{1.0,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+                <Property name="MousePassThroughEnabled" value="True" />
+        
+                <Window type="SWB/StaticImage" name="CP_SysBtns" >
+                    <Property name="Area" value="{{0.85,0},{0.15,0},{0.98,0},{0.85,0}}" />
+                    <Property name="FrameEnabled" value="False" />
+                    
+                    <Window type="SWB/ImageButton" name="CharInfoButton" >
+                        <Property name="HoverImage" value="ControlPanel/CharInfoButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/CharInfoButton" />
+                        <Property name="PushedImage" value="ControlPanel/CharInfoButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/CharInfoButton" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{0.29,0},{0.45,0}}" />
+                    </Window>
+                    <Window type="SWB/ImageButton" name="QuestInfoButton" >
+                        <Property name="HoverImage" value="ControlPanel/QuestInfoButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/QuestInfoButton" />
+                        <Property name="PushedImage" value="ControlPanel/QuestInfoButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/QuestInfoButton" />
+                        <Property name="Area" value="{{0.33,0},{0.0,0},{0.62,0},{0.45,0}}" />
+                    </Window>
+                    <Window type="SWB/ImageButton" name="ChatOpenButton" >
+                        <Property name="HoverImage" value="ControlPanel/ChatOpenButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/ChatOpenButton" />
+                        <Property name="PushedImage" value="ControlPanel/ChatOpenButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/ChatOpenButton" />
+                        <Property name="Area" value="{{0.66,0},{0.0,0},{0.95,0},{0.45,0}}" />
+                    </Window>
+                    <Window type="SWB/ImageButton" name="SkillTreeButton" >
+                        <Property name="HoverImage" value="ControlPanel/SkillTreeButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/SkillTreeButton" />
+                        <Property name="PushedImage" value="ControlPanel/SkillTreeButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/SkillTreeButton" />
+                        <Property name="Area" value="{{0.0,0},{0.5,0},{0.29,0},{0.95,0}}" />
+                    </Window>
+                    <Window type="SWB/ImageButton" name="InventoryButton" >
+                        <Property name="HoverImage" value="ControlPanel/InventoryButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/InventoryButton" />
+                        <Property name="PushedImage" value="ControlPanel/InventoryButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/InventoryButton" />
+                        <Property name="Area" value="{{0.33,0},{0.5,0},{0.62,0},{0.95,0}}" />
+                    </Window>
+                    <Window type="SWB/ImageButton" name="PartyButton" >
+                        <Property name="HoverImage" value="ControlPanel/PartyButton_Hover" />
+                        <Property name="NormalImage" value="ControlPanel/PartyButton" />
+                        <Property name="PushedImage" value="ControlPanel/PartyButton_Hover" />
+                        <Property name="DisabledImage" value="ControlPanel/PartyButton" />
+                        <Property name="Area" value="{{0.66,0},{0.5,0},{0.95,0},{0.95,0}}" />
+                    </Window>
+                </Window>
+                
+                <Window type="SWB/StaticImage" name="CP_SkillBtns" >
+                    <Property name="Area" value="{{0.62,0},{0.15,0},{0.84,0},{0.85,0}}" />
+                    <Property name="FrameEnabled" value="False" />
+                    
+                    <Window type="SWB/StaticImage" name="LeftClickAbilityImage" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{0.38,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                    </Window>
+                    <Window type="SWB/StaticImage" name="RightClickAbilityImage" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.38,0},{0.0,0},{0.76,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                    </Window>
+                    <Window type="SWB/StaticImage" name="AlternateRightClickAbilityImage" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.76,0},{0.4,0},{1.0,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                    </Window>
+                    
+                    <Window type="SWB/TimerProgressBar" name="LeftClickAbilityProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{0.38,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="RightClickAbilityProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.38,0},{0.0,0},{0.76,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="AlternateRightClickAbilityProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.76,0},{0.4,0},{1.0,0},{1.0,0}}" />
+                    </Window>
+                </Window>
+                
+                
+                <!-- Inventory items -->
+                <Window type="SWB/StaticImage" name="PotionHolder">
+                    <Property name="Area" value="{{0.02,0},{0.12,0},{0.35,0},{0.88,0}}" />
+                    <Property name="FrameEnabled" value="False" />
+
+                    <!-- First item -->
+                    <Window type="SWB/BackgroundButton" name="InventoryItem0" >
+                        <Property name="Area" value="{{0.0,0},{0.29,0},{0.2,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="InventoryItem0ProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.0,0},{0.29,0},{0.2,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="InventoryShortcutLabel0" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{0.08,0},{0.30,0}}" />
+                        <Property name="BackgroundEnabled" value="True" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="BeltPotionCounter0" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.08,0},{0.6,0},{0.2,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+    
+                    <!-- Second item -->                
+                    <Window type="SWB/BackgroundButton" name="InventoryItem1" >
+                        <Property name="Area" value="{{0.2,0},{0.29,0},{0.4,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="InventoryItem1ProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.2,0},{0.29,0},{0.4,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="InventoryShortcutLabel1" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.2,0},{0.0,0},{0.28,0},{0.30,0}}" />
+                        <Property name="BackgroundEnabled" value="True" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="BeltPotionCounter1" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.28,0},{0.6,0},{0.4,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+
+                    
+                    <!-- Third item -->
+                    <Window type="SWB/BackgroundButton" name="InventoryItem2" >
+                        <Property name="Area" value="{{0.4,0},{0.29,0},{0.6,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="InventoryItem2ProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.4,0},{0.29,0},{0.6,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="InventoryShortcutLabel2" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.4,0},{0.0,0},{0.48,0},{0.30,0}}" />
+                        <Property name="BackgroundEnabled" value="True" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="BeltPotionCounter2" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.48,0},{0.6,0},{0.6,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+
+                    <!-- Fourth item -->
+                    <Window type="SWB/BackgroundButton" name="InventoryItem3" >
+                        <Property name="Area" value="{{0.6,0},{0.29,0},{0.8,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="InventoryItem3ProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.6,0},{0.29,0},{0.8,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="InventoryShortcutLabel3" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.6,0},{0.0,0},{0.68,0},{0.30,0}}" />
+                        <Property name="BackgroundEnabled" value="True" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="BeltPotionCounter3" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.68,0},{0.6,0},{0.8,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+
+
+                    <!-- Fifth item -->
+                    <Window type="SWB/BackgroundButton" name="InventoryItem4" >
+                        <Property name="Area" value="{{0.8,0},{0.29,0},{1.0,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/TimerProgressBar" name="InventoryItem4ProgressBar" >
+                        <Property name="StepSize" value="0.01" />
+                        <Property name="MousePassThroughEnabled" value="True" />
+                        <Property name="CurrentProgress" value="0" />
+                        <Property name="VerticalProgress" value="True" />
+                        <Property name="Area" value="{{0.8,0},{0.29,0},{1.0,0},{1.0,0}}" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="InventoryShortcutLabel4" >
+                        <Property name="FrameEnabled" value="True" />
+                        <Property name="Area" value="{{0.8,0},{0.0,0},{0.88,0},{0.30,0}}" />
+                        <Property name="BackgroundEnabled" value="True" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <Window type="SWB/StaticText" name="BeltPotionCounter4" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.88,0},{0.6,0},{1.0,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        <Property name="Font" value="SWB-S" />
+                    </Window>
+                    <!--
+                    <Window type="SWB/StaticImage" name="SlotNumbers" >
+                        <Property name="Image" value="ControlPanel/SlotNumbers" />
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.058003,0},{0.730578,0},{0.345531,0},{0.855198,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                    </Window>-->
+                </Window>
+            </Window>
+            
+            <Window type="SWB/StaticImage" name="GlobeAndSysBtnsHolder">
+                <Property name="Area" value="{{0.37,0},{0,0},{0.6,0},{1.0,0}}" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="AlwaysOnTop" value="True" />
+                <Property name="Alpha" value="0" />
+                
+                <Window type="SumWarsExtras/HPProgressBar" name="HealthProgressBar" >
+                    <Property name="StepSize" value="0.01" />
+                    <!--<Property name="RiseOnClick" value="False" />-->
+                    <Property name="CurrentProgress" value="0" />
+                    <Property name="Area" value="{{0.1,0},{0,0},{0.9,0},{0.99,0}}" />
+                    <Property name="VerticalProgress" value="True" />
+                    <Property name="InheritsAlpha" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="SaveExitButton" >
+                    <Property name="HoverImage" value="ControlPanel/SaveExitButton_Hover" />
+                    <Property name="NormalImage" value="ControlPanel/SaveExitButton" />
+                    <Property name="PushedImage" value="ControlPanel/SaveExitButton_Hover" />
+                    <Property name="DisabledImage" value="ControlPanel/SaveExitButton" />
+                    <Property name="Area" value="{{0.0,0},{0.77,0},{0.19,0},{0.97,0}}" />
+                    <Property name="InheritsAlpha" value="False" />
+                </Window>
+                <Window type="SWB/ImageButton" name="OptionsButton" >
+                    <Property name="HoverImage" value="ControlPanel/OptionsButton_Hover" />
+                    <Property name="NormalImage" value="ControlPanel/OptionsButton" />
+                    <Property name="PushedImage" value="ControlPanel/OptionsButton_Hover" />
+                    <Property name="DisabledImage" value="ControlPanel/OptionsButton" />
+                    <Property name="Area" value="{{0.81,0},{0.77,0},{1.0,0},{0.97,0}}" />
+                    <Property name="InheritsAlpha" value="False" />
+                </Window>
+            </Window>
+            
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/creditsscreen.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,39 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="CreditsWindow" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Text" value="Credits" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+        <Property name="FrameEnabled" value="True" />
+        <Property name="TitlebarEnabled" value="True" />
+        <Property name="CloseButtonEnabled" value="False" />
+        <Property name="Alpha" value="1.0" />
+        <Property name="InheritsAlpha" value="False" />
+
+        <Window type="SumWarsExtras/ScrollablePaneNoBar" name="CreditsPane" >
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="ContentPaneAutoSized" value="True" />
+            <Property name="MaxSize" value="{{1.0,0},{1.0,0}}" />
+            <!--<Property name="FrameEnabled" value="False" />--> <!-- Property not added to SumWarsExtras -->
+
+            <!-- The top side where the player picture, and main information are displayed -->
+            <Window type="SWB/StaticText" name="CreditsText" >
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                <Property name="MaxSize" value="{{1.0,0},{5.0,0}}" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="HorzFormatting" value="HorzCentred" />
+                <Property name="VertFormatting" value="TopAligned" />
+                <Property name="Font" value="SWB-L" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/dialogwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,121 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="DialogWindow" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        
+        <Window type="SWB/FrameWindow" name="DialogueUpperBar" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="TitlebarEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.15,0}}" />
+            <Property name="Alpha" value="1" />
+            <Property name="Text" value="Inventory" />
+            <Property name="TitlebarFont" value="SWB-L" />
+            <Property name="CloseButtonAlignment" value="0" />
+            <Property name="MousePassThroughEnabled" value="True" />
+            <Property name="SizingEnabled" value="False" />
+            <Property name="DragMovingEnabled" value="False" />
+            <Property name="CloseButtonEnabled" value="False" />
+            <Property name="RollUpEnabled" value="False" />
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="Visible" value="False" />
+            <Property name="WantsMultiClickEvents" value="False" />
+
+            <Window type="SWB/StaticImage" name="UpperBarBackground" >
+                <Property name="FrameEnabled" value="False" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="MousePassThroughEnabled" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.95,0}}" />
+            </Window>
+
+        </Window>
+
+        <Window type="SWB/FrameWindow" name="DialogueLowerBar" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="TitlebarEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.85,0},{1.0,0},{1.0,0}}" />
+            <Property name="Alpha" value="1" />
+            <Property name="Text" value="Inventory" />
+            <Property name="TitlebarFont" value="SWB-L" />
+            <Property name="CloseButtonAlignment" value="0" />
+            <Property name="MousePassThroughEnabled" value="True" />
+            <Property name="SizingEnabled" value="False" />
+            <Property name="DragMovingEnabled" value="False" />
+            <Property name="CloseButtonEnabled" value="False" />
+            <Property name="RollUpEnabled" value="False" />
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="Visible" value="False" />
+            <Property name="WantsMultiClickEvents" value="False" />
+
+            <Window type="SWB/StaticImage" name="LowerBarBackground" >
+                <Property name="FrameEnabled" value="False" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="MousePassThroughEnabled" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.05,0},{1.0,0},{1.0,0}}" />
+            </Window>
+
+            <Window type="SWB/StaticImage" name="SpeakerEmotionImage0" >
+                <Property name="FrameEnabled" value="True" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="Area" value="{{0.01,0},{0.05,0},{0.11,0},{0.95,0}}" />
+            </Window>
+    
+            <Window type="SWB/StaticImage" name="SpeakerEmotionImage1" >
+                <Property name="FrameEnabled" value="True" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="Area" value="{{0.89,0},{0.05,0},{0.99,0},{0.95,0}}" />
+            </Window>
+            
+            <Window type="SWB/StaticText" name="SpeakerNameLabel0" >
+                <Property name="Text" value="" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="Area" value="{{0.12,0},{0.05,0},{0.42,0},{0.27,0}}" />
+            </Window>
+
+            <Window type="SWB/StaticText" name="SpeakerNameLabel1" >
+                <Property name="Text" value="" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="BackgroundEnabled" value="True" />
+                <Property name="Area" value="{{0.58,0},{0.05,0},{0.88,0},{0.27,0}}" />
+            </Window>
+            
+            <Window type="SumWarsExtras/ScrollablePaneNoBar" name="SpeakerTextPane0" >
+                <Property name="Area" value="{{0.12,0},{0.27,0},{0.5,0},{0.89,0}}" />
+                
+                <Window type="SWB/MultiLineEditbox" name="SpeakerTextLabel0" >
+                    <Property name="Text" value="" />
+                    <!--<Property name="FrameEnabled" value="False" />
+                    <Property name="BackgroundEnabled" value="True" />-->
+                    <Property name="Area" value="{{0.0,0},{0.0,0},{0.99,0},{0.99,0}}" />
+                    <Property name="WantsMultiClickEvents" value="False" />
+                    <Property name="Font" value="SWB-S" />
+                </Window>
+            </Window>
+            
+            <Window type="SumWarsExtras/ScrollablePaneNoBar" name="SpeakerTextPane1" >
+                <Property name="Area" value="{{0.5,0},{0.27,0},{0.88,0},{0.89,0}}" />
+                
+                <Window type="SWB/MultiLineEditbox" name="SpeakerTextLabel1" >
+                    <Property name="Text" value="" />
+                    <!--<Property name="FrameEnabled" value="False" />
+                    <Property name="BackgroundEnabled" value="True" />-->
+                    <Property name="Area" value="{{0.0,0},{0.0,0},{0.99,0},{0.99,0}}" />
+                    <Property name="WantsMultiClickEvents" value="False" />
+                    <Property name="Font" value="SWB-S" />
+                </Window>
+            </Window>
+            
+            <Window type="SWB/Button" name="DialogueSkipAllButton" >
+                <Property name="Text" value="Skip" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="AlwaysOnTop" value="True" />
+                <Property name="Area" value="{{0.82,0},{0.81,0},{0.88,0},{0.99,0}}" />
+            </Window>
+        </Window>
+      
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/errordialogwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,26 @@
+
+
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ErrorDialogWindow" >
+        <Property name="Image" value="Misc/QuestionDialog" />
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        
+        <Window type="SWB/Button" name="ErrorDialogConfirmButton" >
+<!--            <Property name="HoverImage" value="MainMenu/SPBtnHover" />
+            <Property name="NormalImage" value="MainMenu/SPBtnNormal" />
+            <Property name="PushedImage" value="MainMenu/SPBtnPushed" />
+            <Property name="DisabledImage" value="MainMenu/SPBtnNormal" />-->
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.4,0},{0.6,0},{0.6,0},{0.75,0}}" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="ErrorDialogLabel" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.120732,0},{0.327987,0},{0.889024,0},{0.439308,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/hostgamewindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,50 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="HostGameWindow" >
+        <Property name="FrameEnabled" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Text" value="Host game" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <Window type="SWB/Button" name="HostGameStartButton" >
+            <Property name="Area" value="{{0.2,0},{0.84,0},{0.45,0},{0.95,0}}" />
+            <Property name="Text" value="Start" />
+        </Window>
+
+        <Window type="SWB/Button" name="HostGameCancelButton" >
+            <Property name="Area" value="{{0.55,0},{0.84,0},{0.8,0},{0.95,0}}" />
+            <Property name="Text" value="Cancel" />
+        </Window>
+
+        <Window type="SWB/StaticText" name="PlayerNumberLabel" >
+            <Property name="Text" value="Armor" />
+            <!--<Property name="HorzExtent" value="50" />-->
+            <!--<Property name="VertExtent" value="25.5702" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.07,0},{0.32,0},{0.51,0},{0.39,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        <Window type="SWB/Editbox" name="PlayerNumberBox" >
+            <Property name="Text" value="Armor" />
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.53,0},{0.32,0},{0.87,0},{0.39,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="SWB/StaticText" name="HostPortLabel" >
+            <Property name="Text" value="Armor" />
+            <!--<Property name="HorzExtent" value="50" />-->
+            <!--<Property name="VertExtent" value="25.5702" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.07,0},{0.5,0},{0.51,0},{0.57,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        <Window type="SWB/Editbox" name="HostPortBox" >
+            <Property name="Text" value="Armor" />
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.53,0},{0.5,0},{0.87,0},{0.57,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/inventory.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,499 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="Inventory" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Alpha" value="1" />
+        <Property name="Text" value="Inventory" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="0" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <!-- dummy holder to allow easier later updates -->
+        <Window type="SWB/StaticImage" name="inventory_aux" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        
+            <!-- The gold coins icon -->
+            <Window type="SWB/StaticImage" name="GoldStaticImage" >
+                <Property name="Image" value="Inventory/GoldPile" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="Area" value="{{0.05,0},{0.575,0},{0.104,0},{0.597,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+                <Window type="SWB/Button" name="GoldDropButton" >
+                    <Property name="Alpha" value="0" />
+                    <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                </Window>
+            </Window>
+            
+            <!-- The amount of gold -->
+            <Window type="SWB/StaticText" name="GoldValueLabel" >
+                <Property name="Text" value="0" />
+                <Property name="FrameEnabled" value="False" />
+                <Property name="Area" value="{{0.110,0},{0.575,0},{0.4,0},{0.607,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+            </Window>
+    
+            <Window type="SWB/Editbox" name="GoldDropValueBox" >
+                <Property name="MaxTextLength" value="1073741823" />
+                <Property name="Area" value="{{0.41,0},{0.565,0},{0.6,0},{0.612,0}}" />
+                <Property name="TextParsingEnabled" value="False" />
+            </Window>
+            
+    
+    
+            <!-- Top area, containing the hero picture and his/her gear -->
+            <Window type="SWB/RoundedPanelFrame" name="GearHolder">
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.56,0}}" />
+    
+                <Window type="SWB/RoundedPanelFrame" name="CharImageHolder">
+                    <Property name="Area" value="{{0.25,0},{0.03,0},{0.75,0},{0.85,0}}" />
+                    <Window type="SWB/StaticImage" name="CharacterImage" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.02,0},{0.02,0},{0.98,0},{0.98,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                    </Window>
+                </Window>
+                
+                <Window type="SWB/DoubleImageButton" name="SwapEquipButton" >
+                    <Property name="MainStateImage" value="SWB/WeaponSwitchState1" />
+                    <Property name="AltStateImage" value="SWB/WeaponSwitchState2" />
+                    <Property name="Area" value="{{0.40,0},{0.89,0},{0.60,0},{0.96,0}}" />
+                </Window>
+                
+                
+                <!-- The gear items -->
+                <Window type="SWB/BackgroundButton" name="AmuletItemLabel" >
+                    <Property name="Area" value="{{0.12,0},{0.03,0},{0.24,0},{0.17,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="ArmorItemLabel" >
+                    <Property name="Area" value="{{0.02,0},{0.19,0},{0.24,0},{0.55,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="WeaponItemLabel" >
+                    <Property name="Area" value="{{0.02,0},{0.56,0},{0.24,0},{0.97,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="RingRightItemLabel" >
+                    <Property name="Area" value="{{0.25,0},{0.86,0},{0.37,0},{0.98,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="RingLeftItemLabel" >
+                    <Property name="Area" value="{{0.63,0},{0.86,0},{0.75,0},{0.98,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="HelmetItemLabel" >
+                    <Property name="Area" value="{{0.76,0},{0.03,0},{0.98,0},{0.26,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="GlovesItemLabel" >
+                    <Property name="Area" value="{{0.76,0},{0.27,0},{0.98,0},{0.55,0}}" />
+                </Window>
+                <Window type="SWB/BackgroundButton" name="ShieldItemLabel" >
+                    <Property name="Area" value="{{0.76,0},{0.56,0},{0.98,0},{0.97,0}}" />
+                </Window>
+            </Window>
+    
+            <!-- The lower side location containing the stash -->
+            <Window type="SWB/RoundedPanelFrame" name="StashHolder">
+                <Property name="Area" value="{{0.0,0},{0.6240544,0},{1.0,0},{1.0,0}}" />
+                <Window type="SWB/TabButton" name="SmallTabButton" >
+                    <Property name="Text" >Small</Property>
+                    <Property name="Area" value="{{0.03,0},{0.01,0},{0.33,0},{0.15,0}}" />
+                </Window>
+                <Window type="SWB/TabButton" name="MediumTabButton" >
+                    <Property name="Text" >Medium</Property>
+                    <Property name="Area" value="{{0.35,0},{0.01,0},{0.65,0},{0.15,0}}" />
+                </Window>
+                <Window type="SWB/TabButton" name="BigTabButton" >
+                    <Property name="Text" >Big</Property>
+                    <Property name="Area" value="{{0.67,0},{0.01,0},{0.97,0},{0.15,0}}" />
+                </Window>
+            
+                <!-- The lower side location containing the stash -->
+                <Window type="SWB/StaticImage" name="StashItemArea">
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="Area" value="{{0.01,0},{0.15,0},{0.99,0},{0.99,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                    
+                    <!-- The tab containing the small items -->
+                    <Window type="SWB/StaticImage" name="SmallTabMain" >
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        
+                        <Window type="SWB/BackgroundButton" name="SmallItem0Label" >
+                            <Property name="Area" value="{{0.0,0},{0.0,0},{0.1,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem1Label" >
+                            <Property name="Area" value="{{0.1,0},{0.0,0},{0.2,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem2Label" >
+                            <Property name="Area" value="{{0.2,0},{0.0,0},{0.3,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem3Label" >
+                            <Property name="Area" value="{{0.3,0},{0.0,0},{0.4,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem4Label" >
+                            <Property name="Area" value="{{0.4,0},{0.0,0},{0.5,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem5Label" >
+                            <Property name="Area" value="{{0.5,0},{0.0,0},{0.6,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem6Label" >
+                            <Property name="Area" value="{{0.6,0},{0.0,0},{0.7,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem7Label" >
+                            <Property name="Area" value="{{0.7,0},{0.0,0},{0.8,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem8Label" >
+                            <Property name="Area" value="{{0.8,0},{0.0,0},{0.9,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem9Label" >
+                            <Property name="Area" value="{{0.9,0},{0.0,0},{1.0,0},{0.33,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem10Label" >
+                            <Property name="Area" value="{{0.0,0},{0.33,0},{0.1,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem11Label" >
+                            <Property name="Area" value="{{0.1,0},{0.33,0},{0.2,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem12Label" >
+                            <Property name="Area" value="{{0.2,0},{0.33,0},{0.3,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem13Label" >
+                            <Property name="Area" value="{{0.3,0},{0.33,0},{0.4,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem14Label" >
+                            <Property name="Area" value="{{0.4,0},{0.33,0},{0.5,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem15Label" >
+                            <Property name="Area" value="{{0.5,0},{0.33,0},{0.6,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem16Label" >
+                            <Property name="Area" value="{{0.6,0},{0.33,0},{0.7,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem17Label" >
+                            <Property name="Area" value="{{0.7,0},{0.33,0},{0.8,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem18Label" >
+                            <Property name="Area" value="{{0.8,0},{0.33,0},{0.9,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem19Label" >
+                            <Property name="Area" value="{{0.9,0},{0.33,0},{1.0,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem20Label" >
+                            <Property name="Area" value="{{0.0,0},{0.66,0},{0.1,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem21Label" >
+                            <Property name="Area" value="{{0.1,0},{0.66,0},{0.2,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem22Label" >
+                            <Property name="Area" value="{{0.2,0},{0.66,0},{0.3,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem23Label" >
+                            <Property name="Area" value="{{0.3,0},{0.66,0},{0.4,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem24Label" >
+                            <Property name="Area" value="{{0.4,0},{0.66,0},{0.5,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem25Label" >
+                            <Property name="Area" value="{{0.5,0},{0.66,0},{0.6,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem26Label" >
+                            <Property name="Area" value="{{0.6,0},{0.66,0},{0.7,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem27Label" >
+                            <Property name="Area" value="{{0.7,0},{0.66,0},{0.8,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem28Label" >
+                            <Property name="Area" value="{{0.8,0},{0.66,0},{0.9,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="SmallItem29Label" >
+                            <Property name="Area" value="{{0.9,0},{0.66,0},{1.0,0},{1.0,0}}" />
+                        </Window>
+                        
+                        <Window type="SWB/TimerProgressBar" name="SmallItem0ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.0103128,0},{0.0257146,0},{0.0795478,0},{0.275714,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem1ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.110313,0},{0.0266671,0},{0.179548,0},{0.276667,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem2ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.216141,0},{0.0304011,0},{0.280533,0},{0.258096,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem3ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.317126,0},{0.0196327,0},{0.381518,0},{0.254763,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem4ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.419733,0},{0.0296325,0},{0.484125,0},{0.257327,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem5ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.515875,0},{0.011429,0},{0.58511,0},{0.261429,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem6ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.62613,0},{0.000476723,0},{0.695365,0},{0.250477,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem7ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.717845,0},{0.00476246,0},{0.78708,0},{0.254762,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem8ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.823465,0},{0.0166673,0},{0.8927,0},{0.266667,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem9ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.920452,0},{0.00809576,0},{0.989687,0},{0.258096,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem10ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.00932784,0},{0.365238,0},{0.0785629,0},{0.615238,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem11ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.107995,0},{0.361905,0},{0.177231,0},{0.611905,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem12ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.215933,0},{0.366191,0},{0.285168,0},{0.616191,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem13ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.307648,0},{0.370476,0},{0.376883,0},{0.620476,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem14ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.417207,0},{0.365238,0},{0.486443,0},{0.615238,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem15ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.52051,0},{0.377143,0},{0.589745,0},{0.627143,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem16ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.621495,0},{0.358572,0},{0.69073,0},{0.608572,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem17ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.72248,0},{0.362857,0},{0.791715,0},{0.612857,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem18ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.821148,0},{0.374762,0},{0.890383,0},{0.624762,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem19ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.920452,0},{0.358572,0},{0.989687,0},{0.608572,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem20ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.00637324,0},{0.720952,0},{0.0756084,0},{0.970952,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem21ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.118946,0},{0.71,0},{0.188181,0},{0.96,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem22ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.214948,0},{0.728571,0},{0.284183,0},{0.978571,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem23ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.315585,0},{0.709047,0},{0.38482,0},{0.959048,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem24ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.416223,0},{0.727619,0},{0.485458,0},{0.977619,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem25ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.50686,0},{0.715714,0},{0.586095,0},{0.965714,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem26ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.61051,0},{0.728571,0},{0.689745,0},{0.978571,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem27ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.704195,0},{0.716666,0},{0.78343,0},{0.966666,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem28ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.809467,0},{0.742857,0},{0.888702,0},{0.969999,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                        <Window type="SWB/TimerProgressBar" name="SmallItem29ProgressBar" >
+                            <Property name="StepSize" value="0.01" />
+                            <Property name="MousePassThroughEnabled" value="True" />
+                            <Property name="CurrentProgress" value="0" />
+                            <Property name="Area" value="{{0.911089,0},{0.719047,0},{0.990324,0},{0.969047,0}}" />
+                            <Property name="VerticalProgress" value="True" />
+                        </Window>
+                    </Window>
+                    
+                    <!-- The tab containing the medium items -->
+                    <Window type="SWB/StaticImage" name="MediumTabMain" >
+                        <Property name="Visible" value="False" />
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        
+                        <Window type="SWB/BackgroundButton" name="MediumItem0Label" >
+                            <Property name="Area" value="{{0.0,0},{0.0,0},{0.166,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem1Label" >
+                            <Property name="Area" value="{{0.166,0},{0.0,0},{0.333,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem2Label" >
+                            <Property name="Area" value="{{0.333,0},{0.0,0},{0.5,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem3Label" >
+                            <Property name="Area" value="{{0.5,0},{0.0,0},{0.666,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem4Label" >
+                            <Property name="Area" value="{{0.666,0},{0.0,0},{0.833,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem5Label" >
+                            <Property name="Area" value="{{0.833,0},{0.0,0},{1.0,0},{0.5,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem6Label" >
+                            <Property name="Area" value="{{0.0,0},{0.5,0},{0.166,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem7Label" >
+                            <Property name="Area" value="{{0.166,0},{0.5,0},{0.333,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem8Label" >
+                            <Property name="Area" value="{{0.333,0},{0.5,0},{0.5,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem9Label" >
+                            <Property name="Area" value="{{0.5,0},{0.5,0},{0.666,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem10Label" >
+                            <Property name="Area" value="{{0.666,0},{0.5,0},{0.833,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="MediumItem11Label" >
+                            <Property name="Area" value="{{0.833,0},{0.5,0},{1.0,0},{1.0,0}}" />
+                        </Window>
+                    </Window>
+                    
+                    <!-- The tab containing the large items -->
+                    <Window type="SWB/StaticImage" name="BigTabMain" >
+                        <Property name="Visible" value="False" />
+                        <Property name="AlwaysOnTop" value="True" />
+                        <Property name="FrameEnabled" value="False" />
+                        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                        <Property name="BackgroundEnabled" value="False" />
+                        
+                        <Window type="SWB/BackgroundButton" name="BigItem0Label" >
+                            <Property name="Area" value="{{0.0,0},{0.0,0},{0.199,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="BigItem1Label" >
+                            <Property name="Area" value="{{0.2,0},{0.0,0},{0.399,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="BigItem2Label" >
+                            <Property name="Area" value="{{0.4,0},{0.0,0},{0.599,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="BigItem3Label" >
+                            <Property name="Area" value="{{0.6,0},{0.0,0},{0.799,0},{1.0,0}}" />
+                        </Window>
+                        <Window type="SWB/BackgroundButton" name="BigItem4Label" >
+                            <Property name="Area" value="{{0.8,0},{0.0,0},{0.999,0},{1.0,0}}" />
+                        </Window>
+                    </Window>
+                </Window>
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/joingamewindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,49 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="JoinGameWindow" >
+        <Property name="FrameEnabled" value="True" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <Window type="SWB/Button" name="JoinGameStartButton" >
+            <Property name="Area" value="{{0.2,0},{0.84,0},{0.45,0},{0.95,0}}" />
+            <Property name="Text" value="Start" />
+        </Window>
+
+        <Window type="SWB/Button" name="JoinGameCancelButton" >
+            <Property name="Area" value="{{0.55,0},{0.84,0},{0.8,0},{0.95,0}}" />
+            <Property name="Text" value="Cancel" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="HostnameLabel" >
+            <Property name="Text" value="Armor" />
+            <!--<Property name="HorzExtent" value="50" />-->
+            <!--<Property name="VertExtent" value="25.5702" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.07,0},{0.32,0},{0.51,0},{0.39,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        <Window type="SWB/Editbox" name="HostnameBox" >
+            <Property name="Text" value="Armor" />
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.53,0},{0.32,0},{0.87,0},{0.39,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="SWB/StaticText" name="PortLabel" >
+            <Property name="Text" value="Armor" />
+            <!--<Property name="HorzExtent" value="50" />-->
+            <!--<Property name="VertExtent" value="25.5702" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.07,0},{0.5,0},{0.51,0},{0.57,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        <Window type="SWB/Editbox" name="PortBox" >
+            <Property name="Text" value="Armor" />
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.53,0},{0.5,0},{0.87,0},{0.57,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/mainmenu.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,96 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="MainMenuRoot" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="True" />
+        <Property name="Area" value="{{0,0},{-0,0},{1,0},{1,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        
+        <Window type="SWB/Button" name="SinglePlayerButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.732617,0},{0.0434896,0},{0.986523,0},{0.100782,0}}" />
+            <Property name="Text" value="Singleplayer" />
+        </Window>
+        
+        <Window type="SWB/Button" name="ServerJoinButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.732812,0},{0.103906,0},{0.986718,0},{0.161198,0}}" />
+            <Property name="Text" value="Join Game" />
+        </Window>
+        
+        <Window type="SWB/Button" name="ServerHostButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.732031,0},{0.166927,0},{0.985937,0},{0.224219,0}}" />
+            <Property name="Text" value="Host Game" />
+        </Window>
+        
+        <Window type="SWB/Button" name="MainOptionsButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.38,0},{0.914062,0},{0.57,0},{0.955728,0}}" />
+            <Property name="Text" value="Options" />
+        </Window>
+        
+        <Window type="SWB/Button" name="CreditsButton" >
+            <Property name="Text" value="Credits" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.58,0},{0.913542,0},{0.76,0},{0.955209,0}}" />
+        </Window>
+        
+        <Window type="SWB/Button" name="EndGameButton" >
+            <Property name="Text" value="Quit" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.77,0},{0.914062,0},{0.96,0},{0.955729,0}}" />
+            <Property name="TooltipText" value="Exit the [colour='FFFFFF55']game" />
+        </Window>
+        
+        <Window type="SWB/Button" name="LoginButton" >
+            <Property name="Text" value="Login" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.25531,0},{0.914062,0},{0.37,0},{0.955729,0}}" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="SumwarsVersionLabel" >
+            <Property name="Font" value="SWB-S" />
+            <Property name="Text" value="VersionLabel" />
+            <Property name="Alpha" value="0.7" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="RightAligned" />
+            <Property name="Area" value="{{0.583594,0},{0.96,0},{0.958594,0},{0.999,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="SumwarsOnlineIndicatorLabel" >
+            <Property name="Text" value="Not logged in." />
+            <Property name="Alpha" value="0.7" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="LeftAligned" />
+            <Property name="Area" value="{{0.27594,0},{0.96901,0},{0.558594,0},{0.992448,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+        
+        <Window type="SWB/FrameWindow" name="SaveGameSelectionFrame" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="TitlebarFont" value="SWB-M" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="SizingEnabled" value="False" />
+            <Property name="TitlebarEnabled" value="False" />
+            <Property name="Area" value="{{0.0294922,0},{0.0161458,0},{0.249023,0},{0.977865,0}}" />
+            <Property name="DragMovingEnabled" value="False" />
+            <Property name="CloseButtonEnabled" value="False" />
+            <Property name="RollUpEnabled" value="False" />
+            <Property name="Alpha" value="0.2" />
+        </Window>
+        
+        <Window type="SWB/StaticImage" name="MainMenuSumwarsLogo" >
+            <Property name="Alpha" value="0.7" />
+            <Property name="Image" value="MainMenu/Logo" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.284961,0},{0.0151042,0},{0.69707,0},{0.289844,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/messagequestionwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,38 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="QuestionInfoRoot" >
+        <Property name="FrameEnabled" value="True" />
+        <Property name="Area" value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="Text" value="Confirm" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="False" />
+        <Property name="RollUpEnabled" value="False" />
+        <Property name="Visible" value="False" />
+
+        <Window type="SWB/StaticText" name="QuestionInfoLabel">
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="1.0" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.12,0},{0.32,0},{0.88,0},{0.43,0}}" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+
+        <Window type="SWB/Button" name="QuestionAnswerButton1">
+            <Property name="Alpha" value="1.0" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.2,0},{0.6,0},{0.4,0},{0.85,0}}" />
+            <Property name="Text" value="Yes" />
+        </Window>
+
+        <Window type="SWB/Button" name="QuestionAnswerButton2">
+            <Property name="Alpha" value="1.0" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.6,0},{0.6,0},{0.8,0},{0.85,0}}" />
+            <Property name="Text" value="No" />
+        </Window>
+
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/minimapwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,34 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="MinimapWindow" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="TitlebarEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="False" />
+        
+
+        <Window type="SWB/StaticImage" name="MinimapImage" >
+            <Property name="FrameEnabled" value="True" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="0.92" />
+            <Property name="Visible" value="True" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="WantsMultiClickEvents" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+            <Property name="Image" value="minimap_img" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="RegionNameLabel">
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="1.0" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.25,0},{0.01,0},{0.75,0},{0.06,0}}" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        
+        </Window>
+    
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/monsterhealthbar.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,36 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="ObjectInfoRoot" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        
+
+        <Window type="SWB/ProgressBar" name="MonsterHealthProgressBar" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="1.0" />
+            <Property name="Visible" value="True" />
+            <Property name="Area" value="{{0.35,0},{0.035,0},{0.65,0},{0.075,0}}" />
+            <Property name="WantsMultiClickEvents" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+    
+            <Property name="GS_DarkerThemeColour" value="77942424" />
+            <Property name="GS_LighterThemeColour" value="88FF0000" />
+            <Property name="GS_MainThemeColour" value="88FF3630" />
+            <Property name="GS_ShineColour" value="77FFFFFF" />
+            <Property name="GS_MainThemeGradientLeftToRight" value="tl:50FF0000 tr:60FF3613 bl:50FF0000 br:60FF3613" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="ObjectInfoLabel">
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="1.0" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="HorzFormatting" value="WordWrapCentreAligned" />
+            <Property name="Area" value="{{0.35,0},{0.035,0},{0.65,0},{0.075,0}}" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        
+        </Window>
+    
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/optionswindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,365 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="OptionsWindow" >
+
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Alpha" value="1.0" />
+        <!--<Property name="TitleText" value="Options" />-->
+        <Property name="Text" value="Options" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="Visible" value="True" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="TitlebarEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        
+        <Window type="SWB/TabControl" name="OptionsWindowTab" >
+            <Property name="Alpha" value="1.0" />
+            <Property name="TabHeight" value="{0.13,0.0}" />
+            <Property name="TabPanePosition" value="Top" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.92,0}}" />
+            <Property name="MaxSize" value="{{1,0},{1,0}}" />
+            <Property name="TooltipText" value="Options for the game are set here" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+            
+             <!-- tab 1-->
+            <Window type="SWB/TabContentPane" name="OptionsShortkeys" >
+                <Property name="Text" value="Shortkeys" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="Visible" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/StaticText" name="ShortkeyLabel0" >
+                    <Property name="Text" value="Inventory" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0,0},{0.35,0},{0.1,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel0" >
+                    <Property name="Text" value="I" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0,0},{0.55,0},{0.1,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel1" >
+                    <Property name="Text" value="Character screen" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.1,0},{0.35,0},{0.2,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel1" >
+                    <Property name="Text" value="C" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.1,0},{0.55,0},{0.2,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel2" >
+                    <Property name="Text" value="Skilltree" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.2,0},{0.35,0},{0.3,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel2" >
+                    <Property name="Text" value="T" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.2,0},{0.55,0},{0.3,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel3" >
+                    <Property name="Text" value="Party screen" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.3,0},{0.35,0},{0.4,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel3" >
+                    <Property name="Text" value="P" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.3,0},{0.55,0},{0.4,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel4" >
+                    <Property name="Text" value="Chatbox" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.4,0},{0.35,0},{0.5,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel4" >
+                    <Property name="Text" value="M" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.4,0},{0.55,0},{0.5,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel5" >
+                    <Property name="Text" value="Quests" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.5,0},{0.35,0},{0.6,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel5" >
+                    <Property name="Text" value="Q" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.5,0},{0.55,0},{0.6,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel6" >
+                    <Property name="Text" value="Minimap" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.6,0},{0.35,0},{0.7,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel6" >
+                    <Property name="Text" value="Tab" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.6,0},{0.55,0},{0.7,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel7" >
+                    <Property name="Text" value="Swap equipement" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.7,0},{0.35,0},{0.8,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel7" >
+                    <Property name="Text" value="W" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.4,0},{0.7,0},{0.55,0},{0.8,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyLabel8" >
+                    <Property name="Text" value="Item Labels" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.8,0},{0.35,0},{0.9,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="ShortkeyValueLabel8" >
+                    <Property name="Text" value="Alt" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="HorzFormatting" value="HorzCentred" />
+                    <Property name="Area" value="{{0.403203,0},{0.8,0},{0.55,0},{0.9,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+            </Window>
+            
+             <!-- tab 2-->
+            <Window type="SWB/TabContentPane" name="OptionsGameplay" >
+                <Property name="Text" value="Gameplay" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="Visible" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/StaticText" name="GameplayDifficultyLabel" >
+                    <Property name="Text" value="Difficulty" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.0183985,0},{0.148522,0},{0.348398,0},{0.248522,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="DifficultyBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.4,0},{0.146047,0},{0.8,0},{0.246047,0}}" />
+                    <Property name="Size" value="{{0.4,0},{0.3,0}}" />
+                    <Property name="MaxTextLength" value="1073741823" />
+                </Window>
+                <Window type="SWB/StaticText" name="TextSpeedLabel" >
+                    <Property name="Text" value="Text Speed" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.015548,0},{0.475763,0},{0.345548,0},{0.575763,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/HorizontalScrollbar" name="TextSpeedSlider" >
+                    <Property name="PageSize" value="0" />
+                    <Property name="StepSize" value="1" />
+                    <Property name="OverlapSize" value="0" />
+                    <Property name="DocumentSize" value="1" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="ScrollPosition" value="0" />
+                    <Property name="Area" value="{{0.390391,0},{0.482696,0},{0.823861,0},{0.582697,0}}" />
+                </Window>
+            </Window>
+            
+             <!-- tab 3-->
+            <Window type="SWB/TabContentPane" name="OptionsSound" >
+                <Property name="Text" value="Sound" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="Visible" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/StaticText" name="MusicVolumeLabel" >
+                    <Property name="Text" value="Music" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.015548,0},{0.475763,0},{0.345548,0},{0.575763,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/HorizontalScrollbar" name="MusicVolumeSlider" >
+                    <Property name="PageSize" value="0" />
+                    <Property name="StepSize" value="1" />
+                    <Property name="OverlapSize" value="0" />
+                    <Property name="DocumentSize" value="1" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="ScrollPosition" value="0" />
+                    <Property name="Area" value="{{0.4,0},{0.482696,0},{0.8,0},{0.582696,0}}" />
+                </Window>
+                <Window type="SWB/StaticText" name="SoundVolumeLabel" >
+                    <Property name="Text" value="Sound" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.015548,0},{0.12587,0},{0.345548,0},{0.225869,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/HorizontalScrollbar" name="SoundVolumeSlider" >
+                    <Property name="PageSize" value="0" />
+                    <Property name="StepSize" value="1" />
+                    <Property name="OverlapSize" value="0" />
+                    <Property name="DocumentSize" value="1" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="ScrollPosition" value="0" />
+                    <Property name="Area" value="{{0.4,0},{0.12536,0},{0.8,0},{0.22536,0}}" />
+                </Window>
+            </Window>
+            
+             <!-- tab 4-->
+            <Window type="SWB/TabContentPane" name="OptionsGraphic" >
+                <Property name="Text" value="Graphic" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="Visible" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/Checkbox" name="GrabMouseInWindowedModeBox" >
+                    <Property name="Text" value="Grab mouse in windowed mode (needs restart)" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.02,0},{0.78,0},{0.125,0}}" />
+                </Window>
+                <Window type="SWB/StaticText" name="VideoDriver" >
+                    <Property name="Text" value="Video Driver" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.15,0},{0.34,0},{0.25,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="VideoDriverBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.35,0},{0.15,0},{0.98,0},{0.25,0}}" />
+                    <Property name="Size" value="{{0.5,0},{0.25,0}}" />
+                    <Property name="MaxTextLength" value="256" />
+                </Window>
+                <Window type="SWB/StaticText" name="DisplayMode" >
+                    <Property name="Text" value="Display Mode" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.26,0},{0.34,0},{0.36,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="DisplayModeBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.35,0},{0.26,0},{0.98,0},{0.36,0}}" />
+                    <Property name="Size" value="{{0.5,0},{0.3,0}}" />
+                    <Property name="MaxTextLength" value="256" />
+                </Window>
+                <Window type="SWB/StaticText" name="Resolution" >
+                    <Property name="Text" value="Resolution" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.37,0},{0.34,0},{0.47,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="ResolutionBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.35,0},{0.37,0},{0.98,0},{0.47,0}}" />
+                    <Property name="Size" value="{{0.5,0},{0.5,0}}" />
+                    <Property name="MaxTextLength" value="256" />
+                </Window>
+                <Window type="SWB/StaticText" name="EnemyHighlightLabel" >
+                    <Property name="Text" value="Enemy Highlight Color" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.50,0},{0.34,0},{0.60,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="EHColorBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.35,0},{0.50,0},{0.98,0},{0.60,0}}" />
+                    <Property name="Size" value="{{0.5,0},{0.39,0}}" />
+                    <Property name="MaxTextLength" value="256" />
+                </Window>
+
+                <Window type="SWB/StaticText" name="ShadowsLabel" >
+                    <Property name="Text" value="Shadows" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.02,0},{0.62,0},{0.34,0},{0.72,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="ShadowsDropDownList" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.35,0},{0.62,0},{0.98,0},{0.72,0}}" />
+                    <Property name="Size" value="{{0.5,0},{0.35,0}}" />
+                    <Property name="MaxTextLength" value="256" />
+                </Window>
+            </Window>
+            
+             <!-- tab 5-->
+            <Window type="SWB/TabContentPane" name="OptionsMisc" >
+                <Property name="Text" value="Misc" />
+                <Property name="Alpha" value="1.0" />
+                <Property name="Visible" value="True" />
+                <Property name="InheritsAlpha" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/StaticText" name="LanguageLabel" >
+                    <Property name="Text" value="Language" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.08,0},{0.33,0},{0.31,0},{0.43,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/Combobox" name="LanguageBox" >
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.4,0},{0.351176,0},{0.8,0},{0.451176,0}}" />
+                    <Property name="Size" value="{{0.4,0},{0.5,0}}" />
+                    <Property name="MaxTextLength" value="1073741823" />
+                </Window>
+            </Window>
+        </Window>
+
+        <Window type="SWB/Button" name="OptionsCloseButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.4,0},{0.93,0},{0.6,0},{0.99,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/questinfo.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,58 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="QuestInfo" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Alpha" value="1" />
+        <Property name="Text" value="Trade" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <Window type="SWB/StaticImage" name="questinfo_aux" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+
+            <Window type="SWB/Listbox" name="QuestList" >
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.48,0}}" />
+            </Window>
+            
+            <Window type="SWB/Checkbox" name="QuestOpenBox" >
+                <Property name="Area" value="{{0.03,0},{0.502446,0},{0.10,0},{0.555984,0}}" />
+            </Window>
+            <Window type="SWB/StaticText" name="QuestOpenLabel" >
+                <Property name="FrameEnabled" value="False" />
+                <Property name="TextColours" value="tl:FFE3CF57 tr:FFE3CF57 bl:FFE3CF57 br:FFE3CF57" />
+                <Property name="Area" value="{{0.11,0},{0.502446,0},{0.32,0},{0.545983,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+            </Window>
+            <Window type="SWB/Checkbox" name="QuestDoneBox" >
+                <Property name="Area" value="{{0.33,0},{0.502446,0},{0.40,0},{0.555984,0}}" />
+            </Window>
+            <Window type="SWB/StaticText" name="QuestDoneLabel" >
+                <Property name="FrameEnabled" value="False" />
+                <Property name="TextColours" value="tl:FF61B329 tr:FF61B329 bl:FF61B329 br:FF61B329" />
+                <Property name="Area" value="{{0.41,0},{0.506658,0},{0.60,0},{0.543176,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+            </Window>
+            <Window type="SWB/Checkbox" name="QuestFailedBox" >
+                <Property name="Area" value="{{0.61,0},{0.502446,0},{0.68,0},{0.555984,0}}" />
+            </Window>
+            <Window type="SWB/StaticText" name="QuestFailedLabel" >
+                <Property name="FrameEnabled" value="False" />
+                <Property name="TextColours" value="tl:FFEE3B3B tr:FFEE3B3B bl:FFEE3B3B br:FFEE3B3B" />
+                <Property name="Area" value="{{0.69,0},{0.508062,0},{0.92,0},{0.54458,0}}" />
+                <Property name="BackgroundEnabled" value="False" />
+            </Window>
+            <Window type="SWB/MultiLineEditbox" name="QuestDescription" >
+                <Property name="Text" ></Property>
+                <Property name="MaxTextLength" value="1073741823" />
+                <Property name="Area" value="{{0.0,0},{0.586678,0},{1.0,0},{1.0,0}}" />
+                <Property name="TextParsingEnabled" value="False" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/saveexitwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,25 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="SaveExitWindow" >
+        <Property name="Area" value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
+        <Property name="Text" value="Save and Exit" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <!-- The OK button -->
+        <Window type="SWB/Button" name="GameExitConfirmButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.1,0},{0.45,0},{0.4,0},{0.75,0}}" />
+        </Window>
+        
+        <!-- The Cancel button -->
+        <Window type="SWB/Button" name="GameExitAbortButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.6,0},{0.45,0},{0.9,0},{0.75,0}}" />
+        </Window>
+        
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/saveitem.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,45 @@
+<GUILayout version="4" >
+    <Window type="SWB/Button" name="SaveItemRoot" >
+        <Property name="Alpha" value="0.5" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="Area" value="{{0,0},{0,0},{1,0},{0.2,0}}" />
+
+        <Window type="SWB/StaticText" name="SaveItemRoot_Name" >
+            <Property name="Text" value="SaveItemRoot_Name" />
+            <!--<Property name="HorzExtent" value="165" />-->
+            <!--<Property name="VertExtent" value="23.8451" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.293234,0},{0.0861111,0},{0.814916,0},{0.544444,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+
+        <Window type="SWB/StaticText" name="SaveItemRoot_DecriptionLabel" >
+            <Property name="Text" value="Level 5 Fencer" />
+            <!--<Property name="HorzExtent" value="140" />-->
+            <!--<Property name="VertExtent" value="24.0283" />-->
+            <Property name="FrameEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.26,0},{0.559288,0},{0.83,0},{0.864844,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+
+        <Window type="SWB/StaticImage" name="SaveItemRoot_Avatar" >
+            <Property name="Image" value="MainMenu/Logo" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.041435,0},{0.102552,0},{0.239047,0},{0.924156,0}}" />
+        </Window>
+
+        <Window type="SWB/ImageButton" name="SaveItemRoot_DelChar" >
+            <Property name="HoverImage" value="MainMenu/DelCharBtnHover" />
+            <Property name="NormalImage" value="MainMenu/DelCharBtnNormal" />
+            <Property name="PushedImage" value="MainMenu/DelCharBtnPushed" />
+            <Property name="Area" value="{{0.891602,0},{0.265625,0},{0.983398,0},{0.736981,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/skilltree.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,68 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="Skilltree" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Alpha" value="1" />
+        <Property name="Text" value="Inventory" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="0" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <!-- dummy holder to allow easier later updates -->
+        <Window type="SWB/StaticImage" name="skilltree_aux" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        
+            <Window type="SWB/TabControl" name="SkilltreeTabs" >
+                <Property name="Alpha" value="1.0" />
+                <Property name="TabHeight" value="{0,56}" />
+                <Property name="TabButtonType" value="SWB/TabButton" />
+                <Property name="TabPanePosition" value="Top" />
+                <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{0.9,0}}" />
+            </Window>
+            
+            <Window type="SWB/StaticImage" name="SkillTreeAdditionalInfoHolder">
+                <Property name="FrameEnabled" value="False" />
+                <Property name="Area" value="{{0.0,0},{0.9,0},{1.0,0},{1.0,0}}" />
+                
+                <Window type="SWB/StaticText" name="SkillpointsLabel" >
+                    <Property name="Text" value="Inventory" />
+                    <Property name="TextColours" value="tl:FFA2CD5A tr:FFA2CD5A bl:FFA2CD5A br:FFA2CD5A" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.05,0},{0.0,0},{0.84,0},{0.5,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                    <Property name="HorzFormatting" value="RightAligned" />
+                </Window>
+                <Window type="SWB/StaticText" name="SkillpointsValueLabel" >
+                    <Property name="Text" value="Inventory" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.85,0},{0.0,0},{0.99,0},{0.5,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                <Window type="SWB/StaticText" name="NextSkillpointsLabel" >
+                    <Property name="Text" value="Inventory" />
+                    <Property name="TextColours" value="tl:FF458B00 tr:FF458B00 bl:FF458B00 br:FF458B00" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.05,0},{0.5,0},{0.84,0},{0.99,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                    <Property name="HorzFormatting" value="RightAligned" />
+                </Window>
+                <Window type="SWB/StaticText" name="NextSkillpointsValueLabel" >
+                    <Property name="Text" value="Inventory" />
+                    <Property name="FrameEnabled" value="False" />
+                    <Property name="InheritsAlpha" value="False" />
+                    <Property name="Area" value="{{0.85,0},{0.5,0},{0.99,0},{0.99,0}}" />
+                    <Property name="BackgroundEnabled" value="False" />
+                </Window>
+                
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/startscreen.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,30 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="StartScreenRoot" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        
+        <Window type="SWB/StaticImage" name="StartScreenImage" >
+            <Property name="InheritsAlpha" value="True" />
+            <Property name="Area" value="{{0.33,0},{0.33,0},{0.67,0},{0.67,0}}" />
+            <Property name="Image" value="SumWarsLogo.png" />
+            <Property name="FrameEnabled" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+<!--            <Property name="BackgroundColours" value="tl:00000000 tr:00000000 bl:00000000 br:00000000" />-->
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+        
+        <Window type="SWB/ProgressBar" name="LoadRessourcesProgressBar" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.15,0},{0.58,0},{0.85,0},{0.61,0}}" />
+            <Property name="Text" value="Loading" />
+<!--            <Property name="GS_DarkerThemeColour" value="60005464" />
+            <Property name="GS_LighterThemeColour" value="6013C6BC" />
+            <Property name="GS_MainThemeColour" value="6013868B" />
+            <Property name="GS_ShineColour" value="60FFFFFF" />
+            <Property name="GS_MainThemeGradientLeftToRight" value="tl:00FFFFFF tr:AA13C6BC bl:00FFFFFF br:AA13C6BC" />-->
+            <Property name="MousePassThroughEnabled" value="True" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/tradewindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,70 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="TradeWindow" >
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="Alpha" value="1" />
+        <Property name="Text" value="Trade" />
+        <Property name="TitlebarFont" value="SWB-L" />
+        <Property name="CloseButtonAlignment" value="1" />
+        <Property name="MousePassThroughEnabled" value="True" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+
+        <!-- dummy holder to allow easier later updates -->
+        <!-- Note: additional sub-items will be added to this widget from code (if it's found) -->
+        <Window type="SWB/StaticImage" name="tradewindow_aux" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        
+        
+            <Window type="SWB/ImageButton" name="TradeBigPrevButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnUpHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnUp" />
+                <Property name="PushedImage" value="TradeWindow/BtnUp" />
+                <Property name="DisabledImage" value="TradeWindow/BtnUp" />
+                <Property name="Area" value="{{0.95,0},{0.25823,0},{1.0,0},{0.30823,0}}" />
+            </Window>
+            <Window type="SWB/ImageButton" name="TradeBigNextButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnDownHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnDown" />
+                <Property name="PushedImage" value="TradeWindow/BtnDown" />
+                <Property name="DisabledImage" value="TradeWindow/BtnDown" />
+                <Property name="Area" value="{{0.95,0},{0.341058,0},{1.0,0},{0.391058,0}}" />
+            </Window>
+            <Window type="SWB/ImageButton" name="TradeMediumPrevButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnUpHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnUp" />
+                <Property name="PushedImage" value="TradeWindow/BtnUp" />
+                <Property name="DisabledImage" value="TradeWindow/BtnUp" />
+                <Property name="Area" value="{{0.95,0},{0.547517,0},{1.0,0},{0.597517,0}}" />
+            </Window>
+            <Window type="SWB/ImageButton" name="TradeMediumNextButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnDownHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnDown" />
+                <Property name="PushedImage" value="TradeWindow/BtnDown" />
+                <Property name="DisabledImage" value="TradeWindow/BtnDown" />
+                <Property name="Area" value="{{0.95,0},{0.627538,0},{1.0,0},{0.677538,0}}" />
+            </Window>
+            <Window type="SWB/ImageButton" name="TradeSmallPrevButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnUpHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnUp" />
+                <Property name="PushedImage" value="TradeWindow/BtnUp" />
+                <Property name="DisabledImage" value="TradeWindow/BtnUp" />
+                <Property name="Area" value="{{0.95,0},{0.778209,0},{1.0,0},{0.828209,0}}" />
+            </Window>
+            <Window type="SWB/ImageButton" name="TradeSmallNextButton" >
+                <Property name="HoverImage" value="TradeWindow/BtnDownHover" />
+                <Property name="NormalImage" value="TradeWindow/BtnDown" />
+                <Property name="PushedImage" value="TradeWindow/BtnDown" />
+                <Property name="DisabledImage" value="TradeWindow/BtnDown" />
+                <Property name="Area" value="{{0.95,0},{0.855422,0},{1.0,0},{0.905422,0}}" />
+            </Window>
+            
+            <Window type="SWB/Button" name="TradeCloseButton" >
+                <Property name="Area" value="{{0.33,0},{0.95,0},{0.66,0},{1.0,0}}" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/warningdialogwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+<GUILayout version="4" >
+    <Window type="SWB/FrameWindow" name="WarningDialogWindow" >
+        <Property name="Area" value="{{0.3,0},{0.25,0},{0.7,0},{0.60,0}}" />
+        
+        <Property name="Text" value="Warning" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="True" />
+        <Property name="RollUpEnabled" value="False" />
+        <Property name="FrameEnabled" value="True" />
+
+        <Window type="SWB/Button" name="WarningDialogConfirmButton" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.3,0},{0.82,0},{0.7,0},{1.0,0}}" />
+        </Window>
+        
+        <Window type="SWB/StaticText" name="WarningDialogLabel" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.1,0},{0.05,0},{0.9,0},{0.8,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/common/worldmapwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,22 @@
+<GUILayout version="4" >
+    <Window type="SWB/StaticImage" name="WorldmapWindow" >
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Property name="MousePassThroughEnabled" value="False" />
+        
+        <Window type="SWB/StaticImage" name="WorldmapImage" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Alpha" value="1.0" />
+            <Property name="Visible" value="True" />
+            <Property name="FrameEnabled" value="True" />
+            <Property name="Area" value="{{0.0,0},{0.0,0},{1.0,0},{1.0,0}}" />
+            <Property name="WantsMultiClickEvents" value="False" />
+            <Property name="MousePassThroughEnabled" value="True" />
+    
+            <Property name="BackgroundEnabled" value="False" />
+            <Property name="Image" value="worldMap.png" />
+        </Window>
+            
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/contenteditor.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,1412 @@
+
+<GUILayout version="4" >
+    <Window type="DefaultWindow" name="Root" >
+        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window type="TaharezLook/TabControl" name="ObjectInfoTabControl" >
+            <Property name="TabHeight" value="{0,31.1724}" />
+            <Property name="TabPanePosition" value="Top" />
+            <Property name="Area" value="{{0.000539273,0},{0.00312498,0},{0.997266,0},{0.898958,0}}" />
+            <Window type="DefaultWindow" name="RenderInfoTab" >
+                <Property name="Text" value="Render Info" />
+                <Property name="Visible" value="False" />
+                <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                <Window type="TaharezLook/TabControl" name="RenderInfoTabControl" >
+                    <Property name="TabHeight" value="{0,31.1724}" />
+                    <Property name="TabPanePosition" value="Top" />
+                    <Property name="Area" value="{{0.00391872,0},{0.00348824,0},{0.527266,0},{1.00058,0}}" />
+                    <Window type="DefaultWindow" name="RITab/BasicMesh" >
+                        <Property name="Text" value="Mesh" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/Combobox" name="RITab/BM/MeshSelector" >
+                            <Property name="Area" value="{{0.334514,0},{0.0363174,0},{0.662888,0},{0.905855,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/BM/MainMeshLabel" >
+                            <Property name="Text" value="Select main mesh:" />
+                            <Property name="HorzExtent" value="115" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03739,0},{0.0186585,0},{0.327415,0},{0.0879001,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="RITab/SubMesh" >
+                        <Property name="Text" value="Submeshes" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/Combobox" name="RITab/SubMesh/Selector" >
+                            <Property name="Area" value="{{0.3,0},{0.023961,0},{0.65,0},{0.50428,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="RITab/SubMesh/AddSubMeshButton" >
+                            <Property name="Text" value="Add Submesh" />
+                            <Property name="Area" value="{{0.7,0},{0.06618,0},{0.950041,0},{0.128133,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/NewSubmeshLabel" >
+                            <Property name="Text" value="New submesh:" />
+                            <Property name="HorzExtent" value="91" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.022898,0},{0.238785,0},{0.068202,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/NewSMNameLabel" >
+                            <Property name="Text" value="submesh name:" />
+                            <Property name="HorzExtent" value="97" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.0270315,0},{0.0721111,0},{0.243158,0},{0.127415,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/EditSMLabel" >
+                            <Property name="Text" value="Edit submesh:" />
+                            <Property name="HorzExtent" value="86" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.0232801,0},{0.181441,0},{0.249406,0},{0.236745,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="RITab/SubMesh/EditSMSelector" >
+                            <Property name="Area" value="{{0.3,0},{0.185165,0},{0.65,0},{0.575544,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/AttachMeshLabel" >
+                            <Property name="Text" value="Attach to:" />
+                            <Property name="HorzExtent" value="61" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.08,0},{0.228963,0},{0.259419,0},{0.304266,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="RITab/SubMesh/AttachMeshSelector" >
+                            <Property name="Area" value="{{0.24,0},{0.251637,0},{0.55,0},{0.696243,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/BoneLabel" >
+                            <Property name="Text" value="at bone:" />
+                            <Property name="HorzExtent" value="51" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.57,0},{0.242082,0},{0.721903,0},{0.301351,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="RITab/SubMesh/BoneSelector" >
+                            <Property name="Area" value="{{0.7,0},{0.254553,0},{0.98,0},{0.699159,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/Editbox" name="RITab/SM/SMNameEditbox" >
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.3,0},{0.077842,0},{0.65,0},{0.122302,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Checkbox" name="RITab/SM/AttachSMCheckbox" >
+                            <Property name="Area" value="{{0.0329296,0},{0.24344,0},{0.0784697,0},{0.293731,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/RotateLabel" >
+                            <Property name="Text" value="Rotate(x,y,z):" />
+                            <Property name="HorzExtent" value="84" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.02,0},{0.4,0},{0.219404,0},{0.46,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMRotateX" >
+                            <Property name="StepSize" value="5" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="3600" />
+                            <Property name="MinimumValue" value="-3600" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.25,0},{0.40842,0},{0.45,0},{0.46,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMRotateY" >
+                            <Property name="StepSize" value="5" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="3600" />
+                            <Property name="MinimumValue" value="-3600" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.5,0},{0.40842,0},{0.7,0},{0.46,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMRotateZ" >
+                            <Property name="StepSize" value="5" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="3600" />
+                            <Property name="MinimumValue" value="-3600" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.75,0},{0.40842,0},{0.95,0},{0.46,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/ScaleLabel" >
+                            <Property name="Text" value="Scale:" />
+                            <Property name="HorzExtent" value="37" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.02,0},{0.5,0},{0.22,0},{0.56,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMScale" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.25,0},{0.5,0},{0.45,0},{0.56,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="RITab/SM/OffsetLabel" >
+                            <Property name="Text" value="Offset (x,y,z):" />
+                            <Property name="HorzExtent" value="85" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.02,0},{0.6,0},{0.22,0},{0.66,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMOffsetX" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="200" />
+                            <Property name="MinimumValue" value="-200" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.25,0},{0.6,0},{0.45,0},{0.66,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMOffsetY" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="200" />
+                            <Property name="MinimumValue" value="-200" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.5,0},{0.6,0},{0.7,0},{0.66,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="RITab/SM/SMOffsetZ" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="200" />
+                            <Property name="MinimumValue" value="-200" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.75,0},{0.6,0},{0.95,0},{0.66,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="RITab/SubMesh/DelSubMeshButton" >
+                            <Property name="Text" value="Delete Submesh" />
+                            <Property name="Area" value="{{0.672314,0},{0.76618,0},{0.950041,0},{0.828133,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="RITab/Animations" >
+                        <Property name="Text" value="Animations" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                    </Window>
+                    <Window type="DefaultWindow" name="RITab/XML" >
+                        <Property name="Text" value="XML" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/MultiLineEditbox" name="RITab/XML/RIXMLEditbox" >
+                            <Property name="Text" >
+</Property>
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.0229259,0},{0.0172008,0},{0.986204,0},{0.901313,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="RITab/XML/SubmitButton" >
+                            <Property name="Text" value="Submit XML" />
+                            <Property name="Area" value="{{0.0344625,0},{0.919477,0},{0.390245,0},{0.976916,0}}" />
+                        </Window>
+                    </Window>
+                </Window>
+                <Window type="TaharezLook/StaticImage" name="RITab/BM/meshPreview" >
+                    <Property name="Area" value="{{0.535738,0},{0.0565595,0},{0.983904,0},{0.772162,0}}" />
+                </Window>
+            </Window>
+            <Window type="DefaultWindow" name="FixedObjectTab" >
+                <Property name="Text" value="FixedObject" />
+                <Property name="Visible" value="False" />
+                <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                <Window type="TaharezLook/TabControl" name="FixedObjectTabControl" >
+                    <Property name="TabHeight" value="{0,31.1724}" />
+                    <Property name="TabPanePosition" value="Top" />
+                    <Property name="Area" value="{{0.00391872,0},{0.00348824,0},{0.527266,0},{1.00058,0}}" />
+                    <Window type="DefaultWindow" name="FOTab/Properties" >
+                        <Property name="Text" value="Properties" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{-0.00215884,0},{0,0},{0.997841,0},{1,0}}" />
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/ShapeLabel" >
+                            <Property name="Text" value="Shape:" />
+                            <Property name="HorzExtent" value="42" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.01,0},{0.347415,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/RadioButton" name="FOTab/Prop/CircleCheckbox" >
+                            <Property name="Area" value="{{0.03,0},{0.1,0},{0.1,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/CircleLabel" >
+                            <Property name="Text" value="Circle" />
+                            <Property name="HorzExtent" value="37" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.1,0},{0.1,0},{0.2,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/RadiusLabel" >
+                            <Property name="Text" value="Radius:" />
+                            <Property name="HorzExtent" value="42" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.3,0},{0.1,0},{0.4,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Prop/RadiusSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="20" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.42,0},{0.1,0},{0.62,0},{0.15,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/Prop/DetectCircleButton" >
+                            <Property name="Text" value="Autodetect" />
+                            <Property name="Area" value="{{0.7,0},{0.1,0},{0.92,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/RadioButton" name="FOTab/Prop/RectangleCheckbox" >
+                            <Property name="Area" value="{{0.03,0},{0.2,0},{0.1,0},{0.25,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/RectangleLabel" >
+                            <Property name="Text" value="Rectangle" />
+                            <Property name="HorzExtent" value="63" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.1,0},{0.2,0},{0.2,0},{0.25,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/WidthLabel" >
+                            <Property name="Text" value="Width:" />
+                            <Property name="HorzExtent" value="38" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.3,0},{0.2,0},{0.4,0},{0.25,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Prop/WidthSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="20" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.42,0},{0.2,0},{0.62,0},{0.25,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/DepthLabel" >
+                            <Property name="Text" value="Depth:" />
+                            <Property name="HorzExtent" value="42" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.3,0},{0.301493,0},{0.4,0},{0.351493,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Prop/DepthSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="20" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.42,0},{0.3,0},{0.62,0},{0.35,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/Prop/DetectRectButton" >
+                            <Property name="Text" value="Autodetect" />
+                            <Property name="Area" value="{{0.7,0},{0.3,0},{0.92,0},{0.35,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Prop/CollisionLabel" >
+                            <Property name="Text" value="Collision type" />
+                            <Property name="HorzExtent" value="85" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.1,0},{0.4,0},{0.4,0},{0.45,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="FOTab/Prop/LayerSelector" >
+                            <Property name="Area" value="{{0.42,0},{0.4,0},{0.62,0},{0.8,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Properties/CopyDataLabel" >
+                            <Property name="Text" value="Copy data from:" />
+                            <Property name="HorzExtent" value="100" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.6,0},{0.3,0},{0.65,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="FOTab/Properties/CopyDataBox" >
+                            <Property name="Area" value="{{0.28,0},{0.6,0},{0.65,0},{0.95,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/Properties/CopyDataButton" >
+                            <Property name="Text" value="Copy" />
+                            <Property name="Area" value="{{0.7,0},{0.6,0},{0.85,0},{0.65,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="FOTab/Create" >
+                        <Property name="Text" value="Create Object" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/Button" name="FOTab/XML/CreateButton" >
+                            <Property name="Text" value="Create Object" />
+                            <Property name="Area" value="{{0.0452567,0},{0.320993,0},{0.401039,0},{0.378432,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Create/PosLabel" >
+                            <Property name="Text" value="Position:" />
+                            <Property name="HorzExtent" value="53" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.05,0},{0.03,0},{0.22,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Create/PosXSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.28,0},{0.03,0},{0.54,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Create/PosYSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.61,0},{0.03,0},{0.88,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/Create/GetPlPosButton" >
+                            <Property name="Text" value="Get Player Position" />
+                            <Property name="Area" value="{{0.495761,0},{0.123872,0},{0.858021,0},{0.184297,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="FOTab/Create/AngleLabel" >
+                            <Property name="Text" value="Angle:" />
+                            <Property name="HorzExtent" value="39" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.2,0},{0.2,0},{0.28,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="FOTab/Create/AngleSpinner" >
+                            <Property name="StepSize" value="5" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="3600" />
+                            <Property name="MinimumValue" value="-3600" />
+                            <Property name="Area" value="{{0.28,0},{0.2,0},{0.54,0},{0.27,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/Create/DelAllButton" >
+                            <Property name="Text" value="Delete all objects" />
+                            <Property name="Area" value="{{0.0552785,0},{0.871688,0},{0.436968,0},{0.94256,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="FOTab/XML" >
+                        <Property name="Text" value="XML" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/MultiLineEditbox" name="FOTab/XML/FOXMLEditbox" >
+                            <Property name="Text" >
+</Property>
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.0229259,0},{0.0172008,0},{0.986204,0},{0.901313,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="FOTab/XML/SubmitButton" >
+                            <Property name="Text" value="Submit XML" />
+                            <Property name="Area" value="{{0.0344625,0},{0.919477,0},{0.390245,0},{0.976916,0}}" />
+                        </Window>
+                    </Window>
+                </Window>
+            </Window>
+            <Window type="DefaultWindow" name="MonsterTab" >
+                <Property name="Text" value="Monster" />
+                <Property name="Visible" value="False" />
+                <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                <Window type="TaharezLook/TabControl" name="MonsterTabControl" >
+                    <Property name="TabHeight" value="{0,31.1724}" />
+                    <Property name="TabPanePosition" value="Top" />
+                    <Property name="Area" value="{{0.00391872,0},{0.00348824,0},{0.527266,0},{1.00058,0}}" />
+                    <Window type="DefaultWindow" name="MonsterTab/Properties" >
+                        <Property name="Text" value="Properties" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{-0.00215884,0},{0,0},{0.997841,0},{1,0}}" />
+                        <Window type="TaharezLook/StaticText" name="MonsterTab/Prop/RadiusLabel" >
+                            <Property name="Text" value="Radius:" />
+                            <Property name="HorzExtent" value="42" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.3,0},{0.1,0},{0.4,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="MonsterTab/Prop/RadiusSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="20" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.42,0},{0.1,0},{0.62,0},{0.15,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+
+                        <Window type="TaharezLook/StaticText" name="MonsterTab/Properties/CopyDataLabel" >
+                            <Property name="Text" value="Copy data from:" />
+                            <Property name="HorzExtent" value="100" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.6,0},{0.3,0},{0.65,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="MonsterTab/Properties/CopyDataBox" >
+                            <Property name="Area" value="{{0.28,0},{0.6,0},{0.65,0},{0.95,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="MonsterTab/Properties/CopyDataButton" >
+                            <Property name="Text" value="Copy" />
+                            <Property name="Area" value="{{0.7,0},{0.6,0},{0.85,0},{0.65,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="MonsterTab/Create" >
+                        <Property name="Text" value="Create Object" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/Button" name="MonsterTab/XML/CreateButton" >
+                            <Property name="Text" value="Create Object" />
+                            <Property name="Area" value="{{0.0452567,0},{0.320993,0},{0.401039,0},{0.378432,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="MonsterTab/Create/PosLabel" >
+                            <Property name="Text" value="Position:" />
+                            <Property name="HorzExtent" value="53" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.05,0},{0.03,0},{0.22,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="MonsterTab/Create/PosXSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.28,0},{0.03,0},{0.54,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="MonsterTab/Create/PosYSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.61,0},{0.03,0},{0.88,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="MonsterTab/Create/GetPlPosButton" >
+                            <Property name="Text" value="Get Player Position" />
+                            <Property name="Area" value="{{0.495761,0},{0.123872,0},{0.858021,0},{0.184297,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="MonsterTab/Create/AngleLabel" >
+                            <Property name="Text" value="Angle:" />
+                            <Property name="HorzExtent" value="39" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.2,0},{0.2,0},{0.28,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="MonsterTab/Create/AngleSpinner" >
+                            <Property name="StepSize" value="5" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="3600" />
+                            <Property name="MinimumValue" value="-3600" />
+                            <Property name="Area" value="{{0.28,0},{0.2,0},{0.54,0},{0.27,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="MonsterTab/Create/DelAllButton" >
+                            <Property name="Text" value="Delete all objects" />
+                            <Property name="Area" value="{{0.0552785,0},{0.871688,0},{0.436968,0},{0.94256,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="MonsterTab/XML" >
+                        <Property name="Text" value="XML" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/MultiLineEditbox" name="MonsterTab/XML/MonsterXMLEditbox" >
+                            <Property name="Text" >
+</Property>
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.0229259,0},{0.0172008,0},{0.986204,0},{0.901313,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="MonsterTab/XML/SubmitButton" >
+                            <Property name="Text" value="Submit XML" />
+                            <Property name="Area" value="{{0.0344625,0},{0.919477,0},{0.390245,0},{0.976916,0}}" />
+                        </Window>
+                    </Window>
+                </Window>
+            </Window>			
+            <Window type="DefaultWindow" name="ItemTab" >
+                <Property name="Text" value="Item" />
+                <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                <Window type="TaharezLook/TabControl" name="ItemTabControl" >
+                    <Property name="TabHeight" value="{0,31.1724}" />
+                    <Property name="TabPanePosition" value="Top" />
+                    <Property name="Area" value="{{0.00391872,0},{0.00348824,0},{0.527266,0},{1.00058,0}}" />
+                    <Window type="DefaultWindow" name="ItemTab/General" >
+                        <Property name="Text" value="General" />
+                        <Property name="Area" value="{{-0.00215884,0},{0,0},{0.997841,0},{1,0}}" />
+                        <Window type="TaharezLook/StaticText" name="ItemTab/Properties/TypeLabel" >
+                            <Property name="Text" value="Type:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.09,0},{0.2,0},{0.15,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="ItemTab/Properties/TypeBox" >
+                            <Property name="Area" value="{{0.2,0},{0.1,0},{0.65,0},{0.5,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/Properties/SizeLabel" >
+                            <Property name="Text" value="Size:" />
+                            <Property name="HorzExtent" value="29" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.16,0},{0.2,0},{0.24,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="ItemTab/Properties/SizeBox" >
+                            <Property name="Area" value="{{0.2,0},{0.17,0},{0.65,0},{0.65,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/Properties/CopyDataLabel" >
+                            <Property name="Text" value="Copy data from:" />
+                            <Property name="HorzExtent" value="100" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.6,0},{0.3,0},{0.65,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Combobox" name="ItemTab/Properties/CopyDataBox" >
+                            <Property name="Area" value="{{0.28,0},{0.6,0},{0.65,0},{0.95,0}}" />
+                            <Property name="MaxTextLength" value="1073741823" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="ItemTab/Properties/CopyDataButton" >
+                            <Property name="Text" value="Copy" />
+                            <Property name="Area" value="{{0.7,0},{0.6,0},{0.85,0},{0.65,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/General/NameLabel" >
+                            <Property name="Text" value="Name:" />
+                            <Property name="HorzExtent" value="41" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.03,0},{0.2,0},{0.08,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Editbox" name="ItemTab/General/NameBox" >
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.2,0},{0.03,0},{0.65,0},{0.08,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/General/PriceLabel" >
+                            <Property name="Text" value="Value:" />
+                            <Property name="HorzExtent" value="38" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.25,0},{0.2,0},{0.3,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="ItemTab/General/PriceSpinner" >
+                            <Property name="Area" value="{{0.2,0},{0.25,0},{0.65,0},{0.3,0}}" />
+							<Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/General/EnchantRangeLabel" >
+                            <Property name="Text" value="Enchant min:" />
+                            <Property name="HorzExtent" value="82" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.34,0},{0.24,0},{0.4,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="ItemTab/General/EnchantMinSpinner" >
+                            <Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.24,0},{0.34,0},{0.5,0},{0.4,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/StaticText" name="ItemTab/General/EnchantMaxLabel" >
+                            <Property name="Text" value="max:" />
+                            <Property name="HorzExtent" value="29" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.55,0},{0.34,0},{0.65,0},{0.4,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="ItemTab/General/EnchantMaxSpinner" >
+                            <Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.65,0},{0.34,0},{0.9,0},{0.4,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="ItemTab/Equip" >
+                        <Property name="Text" >Equip
+</Property>
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/HealthLabel" >
+                            <Property name="Text" value="Health:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.03,0},{0.2,0},{0.08,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/HealthSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.03,0},{0.40,0},{0.08,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/AttrLabel" >
+                            <Property name="Text" value="Attribute:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.10,0},{0.2,0},{0.16,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/StrengthLabel" >
+                            <Property name="Text" value="Strength:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.17,0},{0.2,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/StrengthSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.17,0},{0.40,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/DexterityLabel" >
+                            <Property name="Text" value="Dexterity:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.17,0},{0.7,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/DexteritySpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.17,0},{0.90,0},{0.23,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/MagicPowerLabel" >
+                            <Property name="Text" value="Magic Power:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.24,0},{0.2,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/MagicPowerSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.24,0},{0.40,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/WillpowerLabel" >
+                            <Property name="Text" value="Willpower:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.24,0},{0.7,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/WillpowerSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.24,0},{0.90,0},{0.30,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/ResistancesLabel" >
+                            <Property name="Text" value="Resistances:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.32,0},{0.4,0},{0.38,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/PhysResLabel" >
+                            <Property name="Text" value="Physical:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.39,0},{0.2,0},{0.45,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/PhysResSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.39,0},{0.40,0},{0.45,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/FireResLabel" >
+                            <Property name="Text" value="Fire:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.39,0},{0.7,0},{0.45,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/FireResSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.39,0},{0.90,0},{0.45,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/IceResLabel" >
+                            <Property name="Text" value="Ice:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.46,0},{0.2,0},{0.52,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/IceResSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.46,0},{0.40,0},{0.52,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/AirResLabel" >
+                            <Property name="Text" value="Air:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.46,0},{0.7,0},{0.52,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/AirResSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.46,0},{0.90,0},{0.52,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/OtherLabel" >
+                            <Property name="Text" value="Other:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.54,0},{0.2,0},{0.60,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/ArmorLabel" >
+                            <Property name="Text" value="Armor:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.61,0},{0.2,0},{0.67,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/ArmorSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.61,0},{0.40,0},{0.67,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/BlockLabel" >
+                            <Property name="Text" value="Block:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.61,0},{0.7,0},{0.67,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/BlockSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.61,0},{0.90,0},{0.67,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/AttackLabel" >
+                            <Property name="Text" value="Precision:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.68,0},{0.2,0},{0.74,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/AttackSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.68,0},{0.40,0},{0.74,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Equip/PowerLabel" >
+                            <Property name="Text" value="Power:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.68,0},{0.7,0},{0.74,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Equip/PowerSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.7,0},{0.68,0},{0.90,0},{0.74,0}}" />
+                        </Window>
+						
+                    </Window>
+                    <Window type="DefaultWindow" name="ItemTab/Weapon" >
+                        <Property name="Text" >Weapon
+</Property>
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/TypeLabel" >
+                            <Property name="Text" value="Type:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.03,0},{0.2,0},{0.08,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Editbox" name="ItemTab/Weapon/TypeBox" >
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.2,0},{0.03,0},{0.65,0},{0.08,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/DamageLabel" >
+                            <Property name="Text" value="Damage:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.10,0},{0.2,0},{0.16,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/PhysLabel" >
+                            <Property name="Text" value="Physical:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.17,0},{0.2,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/PhysMinSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.22,0},{0.17,0},{0.42,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/PhysToLabel" >
+                            <Property name="Text" value="-" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.44,0},{0.17,0},{0.48,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/PhysMaxSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.48,0},{0.17,0},{0.68,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/PhysMultLabel" >
+                            <Property name="Text" value="x" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.75,0},{0.17,0},{0.78,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/PhysMultSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+							<Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.78,0},{0.17,0},{0.98,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/FireLabel" >
+                            <Property name="Text" value="Fire:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.24,0},{0.2,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/FireMinSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.22,0},{0.24,0},{0.42,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/FireToLabel" >
+                            <Property name="Text" value="-" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.44,0},{0.24,0},{0.48,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/FireMaxSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.48,0},{0.24,0},{0.68,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/FireMultLabel" >
+                            <Property name="Text" value="x" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.75,0},{0.24,0},{0.78,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/FireMultSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+							<Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.78,0},{0.24,0},{0.98,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/IceLabel" >
+                            <Property name="Text" value="Ice:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.31,0},{0.2,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/IceMinSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.22,0},{0.31,0},{0.42,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/IceToLabel" >
+                            <Property name="Text" value="-" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.44,0},{0.31,0},{0.48,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/IceMaxSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.48,0},{0.31,0},{0.68,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/IceMultLabel" >
+                            <Property name="Text" value="x" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.75,0},{0.31,0},{0.78,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/IceMultSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+							<Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.78,0},{0.31,0},{0.98,0},{0.37,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/AirLabel" >
+                            <Property name="Text" value="Air:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.38,0},{0.2,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/AirMinSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.22,0},{0.38,0},{0.42,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/AirToLabel" >
+                            <Property name="Text" value="-" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.44,0},{0.38,0},{0.48,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/AirMaxSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.48,0},{0.38,0},{0.68,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/AirMultLabel" >
+                            <Property name="Text" value="x" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.75,0},{0.38,0},{0.78,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/AirMultSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="0" />
+							<Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.78,0},{0.38,0},{0.98,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/PrecisionLabel" >
+                            <Property name="Text" value="Precision:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.47,0},{0.2,0},{0.53,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/PrecisionSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="1" />
+                            <Property name="Area" value="{{0.20,0},{0.47,0},{0.40,0},{0.53,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/PowerLabel" >
+                            <Property name="Text" value="Power:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.53,0},{0.47,0},{0.7,0},{0.53,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/PowerSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="32767" />
+                            <Property name="MinimumValue" value="1" />
+                            <Property name="Area" value="{{0.70,0},{0.47,0},{0.90,0},{0.53,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/RangeLabel" >
+                            <Property name="Text" value="Range:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.54,0},{0.2,0},{0.60,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/RangeSpinner" >
+                            <Property name="StepSize" value="0.1" />
+                            <Property name="CurrentValue" value="1" />
+                            <Property name="MaximumValue" value="50" />
+                            <Property name="MinimumValue" value="0" />
+							<Property name="TextInputMode" value="FloatingPoint" />
+                            <Property name="Area" value="{{0.20,0},{0.54,0},{0.40,0},{0.60,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/SpeedLabel" >
+                            <Property name="Text" value="Speed:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.53,0},{0.54,0},{0.7,0},{0.60,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/SpeedSpinner" >
+                            <Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="5000" />
+                            <Property name="MinimumValue" value="-2000" />
+                            <Property name="Area" value="{{0.70,0},{0.54,0},{0.90,0},{0.60,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/Checkbox" name="ItemTab/Weapon/TwohandedCheckbox" >
+                            <Property name="Area" value="{{0.03,0},{0.62,0},{0.07,0},{0.66,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/TwohandedLabel" >
+                            <Property name="Text" value="Twohanded weapon" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.08,0},{0.61,0},{0.50,0},{0.67,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Weapon/CritPercentLabel" >
+                            <Property name="Text" value="Crit. Hits:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.68,0},{0.2,0},{0.74,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Weapon/CritPercentSpinner" >
+                            <Property name="StepSize" value="1" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="100" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.20,0},{0.68,0},{0.40,0},{0.74,0}}" />
+                        </Window>
+						
+						
+                    </Window>
+                    <Window type="DefaultWindow" name="ItemTab/Consume" >
+                        <Property name="Text" >Consume</Property>
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/TypeLabel" >
+                            <Property name="Text" value="Health:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.03,0},{0.2,0},{0.08,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/HealthSpinner" >
+                            <Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                           <Property name="Area" value="{{0.2,0},{0.03,0},{0.40,0},{0.08,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/CureLabel" >
+                            <Property name="Text" value="Status heal and immunity time:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.10,0},{0.7,0},{0.16,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/BlindLabel" >
+                            <Property name="Text" value="Blind:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.17,0},{0.2,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/BlindSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.20,0},{0.17,0},{0.40,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/PoisonedLabel" >
+                            <Property name="Text" value="Poisoned:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.17,0},{0.7,0},{0.23,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/PoisonedSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.70,0},{0.17,0},{0.90,0},{0.23,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/BerserkLabel" >
+                            <Property name="Text" value="Berserk:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.24,0},{0.2,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/BerserkSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.20,0},{0.24,0},{0.40,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/ConfusedLabel" >
+                            <Property name="Text" value="Confused:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.24,0},{0.7,0},{0.30,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/ConfusedSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.70,0},{0.24,0},{0.90,0},{0.30,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/MuteLabel" >
+                            <Property name="Text" value="Mute:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.31,0},{0.2,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/MuteSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.20,0},{0.31,0},{0.40,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/ParalyzedLabel" >
+                            <Property name="Text" value="Paralyzed:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.31,0},{0.7,0},{0.37,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/ParalyzedSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.70,0},{0.31,0},{0.90,0},{0.37,0}}" />
+                        </Window>
+						
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/FrozenLabel" >
+                            <Property name="Text" value="Frozen:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.38,0},{0.2,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/FrozenSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.20,0},{0.38,0},{0.40,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/StaticText" name="ItemTab/Consume/BurningLabel" >
+                            <Property name="Text" value="Burning:" />
+                            <Property name="HorzExtent" value="36" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.52,0},{0.38,0},{0.7,0},{0.44,0}}" />
+                        </Window>
+						
+						<Window type="TaharezLook/Spinner" name="ItemTab/Consume/BurningSpinner" >
+                            <Property name="StepSize" value="1000" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="1000000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.70,0},{0.38,0},{0.90,0},{0.44,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="ItemTab/Create" >
+                        <Property name="Text" value="Create Item" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/StaticText" name="ItemTab/Create/EnchantLabel" >
+                            <Property name="Text" value="Enchant:" />
+                            <Property name="HorzExtent" value="55" />
+                            <Property name="VertExtent" value="15.5148" />
+                            <Property name="FrameEnabled" value="False" />
+                            <Property name="Area" value="{{0.03,0},{0.03,0},{0.2,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Spinner" name="ItemTab/Create/EnchantSpinner" >
+                            <Property name="StepSize" value="50" />
+                            <Property name="CurrentValue" value="0" />
+                            <Property name="MaximumValue" value="10000" />
+                            <Property name="MinimumValue" value="0" />
+                            <Property name="Area" value="{{0.2,0},{0.03,0},{0.5,0},{0.1,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="ItemTab/Create/CreateInventoryButton" >
+                            <Property name="Text" value="Create in inventory" />
+                            <Property name="Area" value="{{0.03,0},{0.2,0},{0.4,0},{0.26,0}}" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="ItemTab/Create/CreateDropButton" >
+                            <Property name="Text" value="Create an drop" />
+                            <Property name="Area" value="{{0.5,0},{0.2,0},{0.9,0},{0.26,0}}" />
+                        </Window>
+                    </Window>
+                    <Window type="DefaultWindow" name="ItemTab/XML" >
+                        <Property name="Text" value="XML" />
+                        <Property name="Visible" value="False" />
+                        <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+                        <Window type="TaharezLook/MultiLineEditbox" name="ItemTab/XML/ItemXMLEditbox" >
+                            <Property name="Text" >
+</Property>
+                            <Property name="MaxTextLength" value="1073741823" />
+                            <Property name="Area" value="{{0.0229259,0},{0.0172008,0},{0.986204,0},{0.901313,0}}" />
+                            <Property name="TextParsingEnabled" value="False" />
+                        </Window>
+                        <Window type="TaharezLook/Button" name="ItemTab/XML/SubmitButton" >
+                            <Property name="Text" value="Submit XML" />
+                            <Property name="Area" value="{{0.0344625,0},{0.919477,0},{0.390245,0},{0.976916,0}}" />
+                        </Window>
+                    </Window>
+                </Window>
+				<Window type="TaharezLook/StaticImage" name="ItemTab/BM/itemPreview" >
+                    <Property name="Area" value="{{0.535738,0},{0.0565595,0},{0.983904,0},{0.772162,0}}" />
+                </Window>
+            </Window>
+			<Window type="DefaultWindow" name="GameInfoTab" >
+				<Property name="Text" value="Info" />
+                <Property name="Area" value="{{0,0},{0,0},{1,0},{1,0}}" />
+				<Window type="TaharezLook/MultiLineEditbox" name="GameInfoTab/TextBox" >
+                    <Property name="Text" ></Property>
+                    <Property name="MaxTextLength" value="1073741823" />
+                    <Property name="Area" value="{{0.0229259,0},{0.0172008,0},{0.986204,0},{0.901313,0}}" />
+                    <Property name="TextParsingEnabled" value="True" />
+                </Window>
+			</Window>
+		</Window>
+        <Window type="TaharezLook/Button" name="CloseButton" >
+            <Property name="Text" value="Close" />
+            <Property name="Area" value="{{0.84668,0},{0.897134,0},{0.996094,0},{0.997395,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/errordialogwindow.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,24 @@
+
+
+<GUILayout version="4" >
+    <Window type="TaharezLook/StaticImage" name="ErrorDialogWindow" >
+        <Property name="Image" value="Misc/QuestionDialog" />
+        <Property name="FrameEnabled" value="False" />
+        <Property name="Area" value="{{0.3,0},{0.25,0},{0.7,0},{0.55,0}}" />
+        <Property name="BackgroundEnabled" value="False" />
+        <Window type="TaharezLook/Button" name="ErrorDialogConfirmButton" >
+            <Property name="HoverImage" value="MainMenu/SPBtnHover" />
+            <Property name="NormalImage" value="MainMenu/SPBtnNormal" />
+            <Property name="PushedImage" value="MainMenu/SPBtnPushed" />
+            <Property name="DisabledImage" value="MainMenu/SPBtnNormal" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.4,0},{0.6,0},{0.6,0},{0.75,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="ErrorDialogLabel" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="HorzCentred" />
+            <Property name="Area" value="{{0.120732,0},{0.327987,0},{0.889024,0},{0.439308,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/filebrowser.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,36 @@
+
+
+<GUILayout version="4" >
+    <Window type="TaharezLook/FrameWindow" name="FileBrowserMain" >
+        <Property name="TitlebarFont" value="SWB-M" />
+        <Property name="TitlebarEnabled" value="True" />
+        <Property name="Area" value="{{0.0398442,0},{0.0320312,0},{0.803516,0},{0.92526,0}}" />
+        <Window type="TaharezLook/Button" name="Ok" >
+            <Property name="Text" >Ok
+</Property>
+            <Property name="Area" value="{{0.551786,0},{0.909009,0},{0.740562,0},{0.984835,0}}" />
+        </Window>
+        <Window type="TaharezLook/Button" name="Cancel" >
+            <Property name="Text" >Cancel
+</Property>
+            <Property name="Area" value="{{0.750001,0},{0.911411,0},{0.984694,0},{0.987237,0}}" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="CurrentPath" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0188777,0},{0.0637985,0},{0.903054,0},{0.141126,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="FileName" >
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.0215894,0},{0.90975,0},{0.542052,0},{0.982869,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+        <Window type="TaharezLook/MultiColumnList" name="Browser" >
+            <Property name="Area" value="{{0.0240409,0},{0.150729,0},{0.981202,0},{0.894899,0}}" />
+        </Window>
+        <Window type="TaharezLook/Button" name="PopDir" >
+            <Property name="Text" value="Up" />
+            <Property name="Area" value="{{0.911764,0},{0.0641398,0},{0.973785,0},{0.136297,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/filechooser.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,14 @@
+
+<GUILayout version="4" >
+    <Window type="TaharezLook/FrameWindow" name="FileChooser" >
+        <Property name="TitlebarEnabled" value="True" />
+        <Property name="Area" value="{{0.107227,0},{0.0713526,0},{0.597461,0},{0.797478,0}}" />
+        <Window type="TaharezLook/Listbox" name="FrameWindow/FileListBox" >
+            <Property name="Area" value="{{0.0155378,0},{0.19178,0},{0.980679,0},{0.991551,0}}" />
+        </Window>
+        <Window type="TaharezLook/Combobox" name="FrameWindow/DirectoryComboBox" >
+            <Property name="Area" value="{{0.0179279,0},{0.0908662,0},{0.987052,0},{0.340866,0}}" />
+            <Property name="MaxTextLength" value="1073741823" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/fontdemo.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,58 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window type="DefaultGUISheet" name="root">
+    <Window type="TaharezLook/FrameWindow" name="FontDemo/Window">
+        <Property name="Position" value="{{0.1,0},{0.1,0}}" />
+        <Property name="MaxSize" value="{{1,0},{1,0}}" />
+        <Property name="MinSize" value="{{0,128},{0,128}}" />
+        <Property name="Size" value="{{0.8,0},{0.8,0}}" />
+        <Property name="Text" value="Font Demo" />
+        <Property name="TooltipText" value="This is a simple demonstration of what the font subsystem can do." />
+
+        <Window type="TaharezLook/MultiLineEditbox" name="FontDemo/FontSample">
+            <Property name="Area" value="{{0.05,0},{0.1,0},{0.75,0},{0.5,0}}" />
+            <Property name="TooltipText" value="This window shows a sample of the selected font" />
+			<Property name="WordWrap" value="True" />
+        </Window>
+
+        <Window type="TaharezLook/Listbox" name="FontDemo/LangList">
+            <Property name="Area" value="{{0.8,0},{0.1,0},{0.95,0},{0.5,0}}" />
+            <Property name="TooltipText" value="Contains a list of languages to select sample text from" />
+        </Window>
+
+        <Window type="TaharezLook/Listbox" name="FontDemo/FontList">
+            <Property name="Area" value="{{0.05,0},{0.55,0},{0.45,0},{0.95,0}}" />
+            <Property name="TooltipText" value="This listbox shows a list of available fonts to experiment with" />
+        </Window>
+
+        <Window type="TaharezLook/StaticText" name="FontDemo/FontDesc" >
+            <Property name="FrameEnabled" value="False" />
+            <Property name="HorzFormatting" value="WordWrapCentred" />
+            <Property name="VertFormatting" value="CentreAligned" />
+            <Property name="Area" value="{{0.5,0},{0.55,0},{0.95,0},{0.65,0}}" />
+            <Property name="BackgroundEnabled" value="False" />
+        </Window>
+
+        <Window type="TaharezLook/Checkbox" name="FontDemo/AutoScaled" >
+            <Property name="Text" value="Auto scale font to current resolution" />
+            <Property name="Area" value="{{0.5,0},{0.7,0},{0.95,0},{0.75,0}}" />
+            <Property name="TooltipText" value="Choose between autoscaled/non-autoscaled font versions" />
+        </Window>
+
+        <Window type="TaharezLook/Checkbox" name="FontDemo/Antialiased" >
+            <Property name="Text" value="Antialias the font for smoother look" />
+            <Property name="Area" value="{{0.5,0},{0.8,0},{0.95,0},{0.85,0}}" />
+            <Property name="TooltipText" value="Choose between antialiased/non-antialiased font versions" />
+        </Window>
+
+        <Window type="TaharezLook/HorizontalScrollbar" name="FontDemo/PointSize" >
+            <Property name="DocumentSize" value="72" />
+            <Property name="PageSize" value="1" />
+            <Property name="StepSize" value="1" />
+            <Property name="OverlapSize" value="0" />
+            <Property name="Area" value="{{0.5,0},{0.9,0},{0.95,0},{0.9,12}}" />
+            <Property name="TooltipText" value="Changes font point size" />
+        </Window>
+    </Window>
+</Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/guidebugtab.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,53 @@
+
+
+<GUILayout version="4" >
+    <Window type="TaharezLook/FrameWindow" name="GuiDebugTab" >
+        <Property name="Text" value="Gui" />
+        <Property name="Alpha" value="0.1" />
+        <Property name="FrameEnabled" value="False" />
+        <Property name="TitlebarFont" value="SWB-M" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="TitlebarEnabled" value="False" />
+        <Property name="Area" value="{{0.275196,0},{0.289837,0},{0.736134,0},{0.827709,0}}" />
+        <Property name="DragMovingEnabled" value="False" />
+        <Property name="CloseButtonEnabled" value="False" />
+        <Window type="TaharezLook/StaticText" name="windowUnderMouseStaticText" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0135734,0},{0.0152437,0},{0.9946,0},{0.0965521,0}}" />
+        </Window>
+        <Window type="TaharezLook/Checkbox" name="pickWidgetCheckbox" >
+            <Property name="Text" value="Pick Widget" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0233057,0},{0.909116,0},{0.273307,0},{0.992081,0}}" />
+        </Window>
+        <Window type="TaharezLook/Button" name="pickWidgetButton" >
+            <Property name="Text" value="Pick" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.282626,0},{0.909296,0},{0.988136,0},{0.984998,0}}" />
+        </Window>
+        <Window type="TaharezLook/Combobox" name="sizeFormCombobox" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0165258,0},{0.196652,0},{0.319492,0},{0.282038,0}}" />
+            <Property name="MaxTextLength" value="1073741823" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="xSizeLabel" >
+            <Property name="Text" value="0" />
+            <!--<Property name="HorzExtent" value="9" />-->
+            <!--<Property name="VertExtent" value="23.1724" />-->
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.332627,0},{0.197399,0},{0.641949,0},{0.275522,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="ySizeLabel" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.65339,0},{0.195158,0},{0.988135,0},{0.275702,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="typeStaticText" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0139833,0},{0.108756,0},{0.990678,0},{0.186879,0}}" />
+        </Window>
+        <Window type="TaharezLook/StaticText" name="contentsTextbox" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.0165258,0},{0.288643,0},{0.988983,0},{0.906605,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/iconedittab.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,14 @@
+
+
+<GUILayout version="4" >
+    <Window type="DefaultWindow" name="IconEditTab" >
+        <Property name="Area" value="{{0.19043,0},{0.266927,0},{0.727539,0},{0.800781,0}}" />
+        <Window type="TaharezLook/StaticImage" name="IconEditTab/3DView" >
+            <Property name="Area" value="{{0.0545455,0},{0.0487805,0},{0.336364,0},{0.609756,0}}" />
+        </Window>
+        <Window type="TaharezLook/Checkbox" name="IconEditTab/UseGlow" >
+            <Property name="Text" value="Use Glow" />
+            <Property name="Area" value="{{0.354545,0},{0.0487805,0},{0.781818,0},{0.134146,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/layouts/luascripttab.layout	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,35 @@
+
+
+<GUILayout version="4" >
+    <Window type="TaharezLook/FrameWindow" name="luaScriptTab" >
+        <Property name="Alpha" value="0.1" />
+        <Property name="FrameEnabled" value="False" />
+        <Property name="InheritsAlpha" value="False" />
+        <Property name="SizingEnabled" value="False" />
+        <Property name="TitlebarEnabled" value="False" />
+        <Property name="Area" value="{{0.0725001,0},{0.0133335,0},{0.928755,0},{0.936666,0}}" />
+        <Property name="CloseButtonEnabled" value="False" />
+        <Window type="TaharezLook/Button" name="luaScriptTab/ExecuteScriptButton" >
+            <Property name="Text" value="Execute" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.00365257,0},{0.900724,0},{0.270077,0},{0.988268,0}}" />
+        </Window>
+        <Window type="TaharezLook/Menubar" name="luaScriptTab/MenuBar" >
+            <Property name="ItemSpacing" value="10" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="Area" value="{{0.00711788,0},{0.0104692,0},{0.992602,0},{0.070938,0}}" />
+        </Window>
+        <Window type="TaharezLook/TabControl" name="luaScriptTab/FileTabControl" >
+            <Property name="TabHeight" value="{0,38}" />
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="TabPanePosition" value="Top" />
+            <Property name="Area" value="{{0.00903386,0},{0.0826716,0},{0.992288,0},{0.892241,0}}" />
+        </Window>
+        <Window type="TaharezLook/Editbox" name="luaScriptTab/fileDirectoryEditBox" >
+            <Property name="InheritsAlpha" value="False" />
+            <Property name="MaxTextLength" value="1073741823" />
+            <Property name="Area" value="{{0.27833,0},{0.898973,0},{0.990234,0},{0.98666,0}}" />
+            <Property name="TextParsingEnabled" value="False" />
+        </Window>
+    </Window>
+</GUILayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/looknfeel/Falagard.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,540 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Falagard" type="falagardSpecificationType" />
+	<xsd:complexType name="falagardSpecificationType">
+		<xsd:sequence>
+			<xsd:element name="WidgetLook" type="widgetLookType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="widgetLookType">
+		<xsd:sequence>
+            <xsd:element name="EventLinkDefinition" type="eventLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="PropertyDefinition" type="propertyDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="PropertyLinkDefinition" type="propertyLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="NamedArea" type="namedAreaType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Child" type="widgetComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImagerySection" type="imagerySectionType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="StateImagery" type="stateType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="AnimationDefinition" type="animAnimationDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="inherits" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+    <xsd:complexType name="propertyDefinitionType">
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="help" type="xsd:string" use="optional" default="Falagard custom property definition - gets/sets a named user string." />
+        <xsd:attribute name="fireEvent" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyLinkDefinitionType">
+		<xsd:sequence>
+			<xsd:element name="PropertyLinkTarget" type="propertyLinkTargetType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="targetProperty" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="fireEvent" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyLinkTargetType">
+        <xsd:attribute name="widget" type="xsd:string" use="required" />
+        <xsd:attribute name="property" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="eventLinkDefinitionType">
+		<xsd:sequence>
+			<xsd:element name="EventLinkTarget" type="eventLinkTargetType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="event" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="eventLinkTargetType">
+        <xsd:attribute name="widget" type="xsd:string" use="required" />
+        <xsd:attribute name="event" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="namedAreaType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="stateType">
+		<xsd:sequence>
+			<xsd:element name="Layer" type="layerType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="clipped" type="xsd:boolean" use="optional" default="true" />
+	</xsd:complexType>
+	<xsd:complexType name="layerType">
+		<xsd:sequence>
+			<xsd:element name="Section" type="sectionSpecType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="priority" type="xsd:integer" use="optional" default="0" />
+	</xsd:complexType>
+    <xsd:complexType name="sectionSpecType">
+        <xsd:choice  minOccurs="0" maxOccurs="1">
+            <xsd:element name="Colour" type="colourType" />
+            <xsd:element name="Colours" type="colourRectType" />
+            <xsd:element name="ColourProperty" type="settingByPropertyType" />
+            <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+        </xsd:choice>
+        <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="section" type="xsd:string" use="required" />
+        <xsd:attribute name="controlProperty" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="controlValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="controlWidget" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+	<xsd:complexType name="imagerySectionType">
+		<xsd:sequence>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:element name="FrameComponent" type="frameComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImageryComponent" type="imageryComponentType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="TextComponent" type="textComponentType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice  minOccurs="0" maxOccurs="9">
+                <xsd:element name="Image" type="frameImageType" />
+                <xsd:element name="ImageProperty" type="frameImageType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="3">
+                <xsd:element name="VertFormat" type="frameVertFormatType" />
+                <xsd:element name="VertFormatProperty" type="frameFormatPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="3">
+                <xsd:element name="HorzFormat" type="frameHorzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="frameFormatPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="textComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="Text" type="textStringType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="TextProperty" type="textPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="FontProperty" type="fontPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertTextFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzTextFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+	<xsd:complexType name="imageryComponentType">
+		<xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice>
+                <xsd:element name="Image" type="imageType" />
+                <xsd:element name="ImageProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="widgetComponentType">
+		<xsd:sequence>
+            <xsd:element name="EventAction" type="eventActionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="VertAlignment" type="vertAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="HorzAlignment" type="horzAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="type" type="xsd:string" use="required" />
+		<xsd:attribute name="nameSuffix" type="xsd:string" use="required" />
+		<xsd:attribute name="renderer" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="autoWindow" type="xsd:boolean" use="optional" default="true" />
+	</xsd:complexType>
+	<xsd:complexType name="horzFormatType">
+		<xsd:attribute name="type" type="horzFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertFormatType">
+		<xsd:attribute name="type" type="vertFormatEnum" use="required" />
+	</xsd:complexType>
+        <xsd:complexType name="horzTextFormatType">
+		<xsd:attribute name="type" type="horzTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertTextFormatType">
+		<xsd:attribute name="type" type="vertTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="horzAlignmentType">
+		<xsd:attribute name="type" type="horzAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertAlignmentType">
+		<xsd:attribute name="type" type="vertAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="propertyType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="imageType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameImageType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="required" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="frameVertFormatType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="type" type="vertFormatEnum" use="optional" default="Stretched" />
+    </xsd:complexType>
+    <xsd:complexType name="frameHorzFormatType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="type" type="horzFormatEnum" use="optional" default="Stretched" />
+    </xsd:complexType>
+    <xsd:complexType name="frameFormatPropertyType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="componentAreaType">
+        <xsd:choice>
+            <xsd:sequence>
+                <xsd:element name="Dim" type="dimensionType" minOccurs="1" maxOccurs="4" />
+            </xsd:sequence>
+            <xsd:element name="AreaProperty" type="settingByPropertyType" />
+            <xsd:element name="NamedAreaSource" type="namedAreaSourceType" />
+        </xsd:choice>
+	</xsd:complexType>
+	<xsd:complexType name="dimensionType">
+		<xsd:choice>
+			<xsd:element name="UnifiedDim" type="unifiedDimType" />
+			<xsd:element name="AbsoluteDim" type="absoluteDimType" />
+			<xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="ImagePropertyDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+            <xsd:element name="OperatorDim" type="operatorDimType" />
+		</xsd:choice>
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="fontDimType">
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="type" type="fontMetricTypeEnum" use="required" />
+        <xsd:attribute name="padding" type="xsd:decimal" use="optional" default="0" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyDimType">
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="type" type="propertyDimensionTypeEnum" use="optional" default="" />
+    </xsd:complexType>
+	<xsd:complexType name="unifiedDimType">
+		<xsd:attribute name="scale" type="xsd:decimal" use="optional" default="0" />
+		<xsd:attribute name="offset" type="xsd:integer" use="optional" default="0" />
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="absoluteDimType">
+		<xsd:attribute name="value" type="xsd:decimal" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="imageDimType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="widgetDimType">
+		<xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="operatorDimType">
+        <xsd:choice minOccurs="2" maxOccurs="2">
+			<xsd:element name="UnifiedDim" type="unifiedDimType" />
+			<xsd:element name="AbsoluteDim" type="absoluteDimType" />
+			<xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="ImagePropertyDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+            <xsd:element name="OperatorDim" type="operatorDimType" />
+        </xsd:choice>
+        <xsd:attribute name="op" type="dimensionOperatorEnum" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="settingByPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="colourRectType">
+		<xsd:attribute name="topLeft" type="colourValType" use="required" />
+		<xsd:attribute name="topRight" type="colourValType" use="required" />
+		<xsd:attribute name="bottomLeft" type="colourValType" use="required" />
+		<xsd:attribute name="bottomRight" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="colourType">
+		<xsd:attribute name="colour" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:simpleType name="colourValType">
+		<xsd:restriction base="xsd:string">
+			<xsd:pattern value="[a-fA-F0-9]{8}" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:complexType name="textStringType">
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="textPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="fontPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="namedAreaSourceType">
+        <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="eventActionType">
+        <xsd:attribute name="event" type="xsd:string" use="required" />
+        <xsd:attribute name="action" type="eventActionTypeEnum" use="required" />
+    </xsd:complexType>
+    <xsd:simpleType name="propertyDimensionTypeEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="" />
+			<xsd:enumeration value="Width" />
+			<xsd:enumeration value="Height" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="dimensionTypeEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftEdge" />
+			<xsd:enumeration value="TopEdge" />
+			<xsd:enumeration value="RightEdge" />
+			<xsd:enumeration value="BottomEdge" />
+			<xsd:enumeration value="XPosition" />
+			<xsd:enumeration value="YPosition" />
+			<xsd:enumeration value="Width" />
+			<xsd:enumeration value="Height" />
+			<xsd:enumeration value="XOffset" />
+			<xsd:enumeration value="YOffset" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:simpleType name="horzTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LeftAligned" />
+            <xsd:enumeration value="RightAligned" />
+            <xsd:enumeration value="CentreAligned" />
+            <xsd:enumeration value="Justified" />
+            <xsd:enumeration value="WordWrapLeftAligned" />
+            <xsd:enumeration value="WordWrapRightAligned" />
+            <xsd:enumeration value="WordWrapCentreAligned" />
+            <xsd:enumeration value="WordWrapJustified" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="vertTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="TopAligned" />
+            <xsd:enumeration value="BottomAligned" />
+            <xsd:enumeration value="CentreAligned" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="propertyTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Colour" />
+            <xsd:enumeration value="ColourRect" />
+            <xsd:enumeration value="UBox" />
+            <xsd:enumeration value="URect" />
+            <xsd:enumeration value="USize" />
+            <xsd:enumeration value="UDim" />
+            <xsd:enumeration value="UVector2" />
+            <xsd:enumeration value="Sizef" />
+            <xsd:enumeration value="Vector2f" />
+            <xsd:enumeration value="Vector3f" />
+            <xsd:enumeration value="Rectf" />
+            <xsd:enumeration value="Font" />
+            <xsd:enumeration value="Image" />
+            <xsd:enumeration value="Quaternion" />
+            <xsd:enumeration value="AspectMode" />
+            <xsd:enumeration value="HorizontalAlignment" />
+            <xsd:enumeration value="VerticalAlignment" />
+            <xsd:enumeration value="HorizontalTextFormatting" />
+            <xsd:enumeration value="VerticalTextFormatting" />
+            <xsd:enumeration value="WindowUpdateMode" />
+            <xsd:enumeration value="bool" />
+            <xsd:enumeration value="uint" />
+            <xsd:enumeration value="unsigned long" />
+            <xsd:enumeration value="int" />
+            <xsd:enumeration value="float" />
+            <xsd:enumeration value="double" />
+            <xsd:enumeration value="TabControl::TabPanePosition" />
+            <xsd:enumeration value="Spinner::TextInputMode" />
+            <xsd:enumeration value="ItemListBase::SortMode" />
+            <xsd:enumeration value="ListHeaderSegment::SortDirection" />
+            <xsd:enumeration value="MultiColumnList::SelectionMode" />
+            <xsd:enumeration value="VerticalFormatting" />
+            <xsd:enumeration value="HorizontalFormatting" />
+            <xsd:enumeration value="Range" />
+            <xsd:enumeration value="String" />
+            <xsd:enumeration value="Generic" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="fontMetricTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LineSpacing" />
+            <xsd:enumeration value="Baseline" />
+            <xsd:enumeration value="HorzExtent" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="dimensionOperatorEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Noop" />
+            <xsd:enumeration value="Add" />
+            <xsd:enumeration value="Subtract" />
+            <xsd:enumeration value="Multiply" />
+            <xsd:enumeration value="Divide" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="frameImageComponentEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Background" />
+            <xsd:enumeration value="TopLeftCorner" />
+            <xsd:enumeration value="TopRightCorner" />
+            <xsd:enumeration value="BottomLeftCorner" />
+            <xsd:enumeration value="BottomRightCorner" />
+            <xsd:enumeration value="LeftEdge" />
+            <xsd:enumeration value="RightEdge" />
+            <xsd:enumeration value="TopEdge" />
+            <xsd:enumeration value="BottomEdge" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="eventActionTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Redraw" />
+            <xsd:enumeration value="Layout" />
+        </xsd:restriction>
+    </xsd:simpleType>
+
+
+
+	<xsd:complexType name="animAnimationDefinitionType">
+        <xsd:sequence>
+            <xsd:element name="Affector" type="animAffectorType" minOccurs="1" maxOccurs="unbounded" />
+            <xsd:element name="Subscription" type="animSubscriptionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="duration" type="xsd:decimal" use="required" />
+		<xsd:attribute name="replayMode" type="animReplayModeEnum" use="optional" default="loop" />
+		<xsd:attribute name="autoStart" type="xsd:boolean" use="optional" default="false" />
+	</xsd:complexType>
+	<xsd:complexType name="animAffectorType">
+        <xsd:sequence>
+            <xsd:element name="KeyFrame" type="animKeyFrameType" minOccurs="1" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="applicationMethod" type="animApplicationMethodEnum" use="optional" default="absolute" />
+		<xsd:attribute name="property" type="xsd:string" use="required" />
+		<xsd:attribute name="interpolator" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="animKeyFrameType">
+		<xsd:attribute name="position" type="xsd:decimal" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="progression" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="sourceProperty" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+	<xsd:complexType name="animSubscriptionType">
+		<xsd:attribute name="event" type="xsd:string" use="required" />
+		<xsd:attribute name="action" type="animActionEnum" use="required" />
+	</xsd:complexType>
+    <xsd:simpleType name="animReplayModeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="once" />
+            <xsd:enumeration value="loop" />
+            <xsd:enumeration value="bounce" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animApplicationMethodEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="absolute" />
+            <xsd:enumeration value="relative" />
+            <xsd:enumeration value="relative multiply" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animProgressionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="linear" />
+            <xsd:enumeration value="discrete" />
+            <xsd:enumeration value="quadratic accelerating" />
+            <xsd:enumeration value="quadratic decelerating" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animActionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Start" />
+            <xsd:enumeration value="Stop" />
+            <xsd:enumeration value="Pause" />
+            <xsd:enumeration value="Unpause" />
+            <xsd:enumeration value="TogglePause" />
+        </xsd:restriction>
+    </xsd:simpleType>
+
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/looknfeel/SWB.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,5684 @@
+<!--
+SWB - SumWarsBase
+SWB is licensed under the terms of the LGPL license.
+-->
+<!--
+version:      0.1
+Last change:	$LastChangedDate: 2013-01-26 01:26:14 +0200 (S, 26 ian. 2013) $
+-->
+
+<Falagard version="7">
+
+
+
+    <!--
+    ***************************************************
+        SWB/Button32
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Button">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
+        <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" />
+        <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" />
+        <PropertyDefinition name="BackgroundColour" initialValue="FFFFD9CD" redrawOnWrite="true" type="Colour" />
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormatProperty name="VertLabelFormatting" />
+                <HorzFormatProperty name="HorzLabelFormatting" />
+            </TextComponent>
+        </ImagerySection>
+
+<!-- TODO: investigate if a common border would help or not -->
+<!--        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Button32_2C_TL" />
+                <Image component="TopRightCorner" name="SWB/Button32_2C_TR" />
+                <Image component="BottomLeftCorner" name="SWB/Button32_2C_BL" />
+                <Image component="BottomRightCorner" name="SWB/Button32_2C_BR" />
+                <Image component="LeftEdge" name="SWB/Button32_2C_L" />
+                <Image component="TopEdge" name="SWB/Button32_2C_T" />
+                <Image component="RightEdge" name="SWB/Button32_2C_R" />
+                <Image component="BottomEdge" name="SWB/Button32_2C_B" />
+                <Image component="Background" name="SWB/Button32_2C_M" />
+            </FrameComponent>
+        </ImagerySection>-->
+
+        <ImagerySection name="normal_main_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/BtnWideNormal_TL" />
+                <Image component="TopRightCorner" name="SWB/BtnWideNormal_TR" />
+                <Image component="BottomLeftCorner" name="SWB/BtnWideNormal_BL" />
+                <Image component="BottomRightCorner" name="SWB/BtnWideNormal_BR" />
+                <Image component="LeftEdge" name="SWB/BtnWideNormal_L" />
+                <Image component="TopEdge" name="SWB/BtnWideNormal_T" />
+                <Image component="RightEdge" name="SWB/BtnWideNormal_R" />
+                <Image component="BottomEdge" name="SWB/BtnWideNormal_B" />
+                <Image component="Background" name="SWB/BtnWideNormal_M" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="hover_main_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/BtnWideHover_TL" />
+                <Image component="TopRightCorner" name="SWB/BtnWideHover_TR" />
+                <Image component="BottomLeftCorner" name="SWB/BtnWideHover_BL" />
+                <Image component="BottomRightCorner" name="SWB/BtnWideHover_BR" />
+                <Image component="LeftEdge" name="SWB/BtnWideHover_L" />
+                <Image component="TopEdge" name="SWB/BtnWideHover_T" />
+                <Image component="RightEdge" name="SWB/BtnWideHover_R" />
+                <Image component="BottomEdge" name="SWB/BtnWideHover_B" />
+                <Image component="Background" name="SWB/BtnWideHover_M" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="pushed_main_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/BtnWidePushed_TL" />
+                <Image component="TopRightCorner" name="SWB/BtnWidePushed_TR" />
+                <Image component="BottomLeftCorner" name="SWB/BtnWidePushed_BL" />
+                <Image component="BottomRightCorner" name="SWB/BtnWidePushed_BR" />
+                <Image component="LeftEdge" name="SWB/BtnWidePushed_L" />
+                <Image component="TopEdge" name="SWB/BtnWidePushed_T" />
+                <Image component="RightEdge" name="SWB/BtnWidePushed_R" />
+                <Image component="BottomEdge" name="SWB/BtnWidePushed_B" />
+                <Image component="Background" name="SWB/BtnWidePushed_M" />
+            </FrameComponent>
+        </ImagerySection>
+
+       
+        <!-- regular representation of the button -->
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal_main_section">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <!-- the cursor is hovering over the button -->
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover_main_section">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+                  
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <!-- the cursor is pushing the button -->
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed_main_section">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+                  
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <!-- the cursor pushed the buton, but is moving away -->
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover_main_section">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+                  
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <!-- the button is simply disabled -->
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal_main_section_main_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+                  
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ImageButton
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ImageButton">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="pushed">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="PushedImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="disabled">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="DisabledImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+
+    <!--
+    ***************************************************
+        SWB/DoubleImageButton
+        based on the single ImageButton, but with the ability of storing additional images.
+        These additional images should be accessible from code to overwrite (on-demand) the Normal, Hover and Pushed
+        state images. 
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/DoubleImageButton">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="MainStateImage" initialValue="" redrawOnWrite="false" />
+        <PropertyDefinition name="AltStateImage" initialValue="" redrawOnWrite="false" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="pushed">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="PushedImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="disabled">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="DisabledImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/SimplePanel
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/SimplePanelFrame">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BackgroundPictureColour" initialValue="DFFFFFFF" redrawOnWrite="true"/>
+        <PropertyDefinition name="BackgroundImage" initialValue="" redrawOnWrite="true" />
+
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Static_TL" />
+                <Image component="LeftEdge" name="SWB/Static_L" />
+                <Image component="BottomLeftCorner" name="SWB/Static_BL" />
+                <Image component="TopEdge" name="SWB/Static_T" />
+                <Image component="Background" name="SWB/Static_M" />
+                <Image component="BottomEdge" name="SWB/Static_B" />
+                <Image component="TopRightCorner" name="SWB/Static_TR" />
+                <Image component="RightEdge" name="SWB/Static_R" />
+                <Image component="BottomRightCorner" name="SWB/Static_BR" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal">
+                  <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+    
+    
+    
+    <!--
+    ***************************************************
+        SWB/RoundedPanelFrame
+        A simple rounded frame (border) that can be used to simulate grouping widgets together.
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/RoundedPanelFrame">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Rounded_Small_Border_TL" />
+                <Image component="LeftEdge" name="SWB/Rounded_Small_Border_L" />
+                <Image component="BottomLeftCorner" name="SWB/Rounded_Small_Border_BL" />
+                <Image component="TopEdge" name="SWB/Rounded_Small_Border_T" />
+                <Image component="Background" name="SWB/Rounded_Small_Border_M" />
+                <Image component="BottomEdge" name="SWB/Rounded_Small_Border_B" />
+                <Image component="TopRightCorner" name="SWB/Rounded_Small_Border_TR" />
+                <Image component="RightEdge" name="SWB/Rounded_Small_Border_R" />
+                <Image component="BottomRightCorner" name="SWB/Rounded_Small_Border_BR" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal">
+                   <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+    
+    
+    
+    <!--
+    ***************************************************
+        SWB/RoundedPanelTopFrame
+        A simple rounded frame (border) that can be used to simulate grouping widgets together.
+        Does not contain a bottom side.
+    ***************************************************
+    -->
+    <!--
+    <WidgetLook name="SWB/RoundedPanelTopFrame">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Rounded_Small_Border_TL" />
+                <Image component="LeftEdge" name="SWB/Rounded_Small_Border_L" />
+                <Image component="TopEdge" name="SWB/Rounded_Small_Border_T" />
+                <Image component="Background" name="SWB/Rounded_Small_Border_M" />
+                <Image component="TopRightCorner" name="SWB/Rounded_Small_Border_TR" />
+                <Image component="RightEdge" name="SWB/Rounded_Small_Border_R" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal">
+                   <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+-->
+
+
+    <!--
+    ***************************************************
+        SWB/StaticImage
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    
+    <WidgetLook name="SWB/StaticImage">
+        <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+        <PropertyDefinition name="OverlayColour" initialValue="00FFFFFF" redrawOnWrite="true" />
+        
+        <Property name="BackgroundEnabled" value="True" />
+        <Property name="FrameEnabled" value="True" />
+        
+        <ImagerySection name="image_withframe">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/Static_L" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/Static_T" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="SWB/Static_R" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="SWB/Static_B" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <ImageProperty name="Image" />
+                <ColourRectProperty name="ImageColours" />
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="gray_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/Static_L" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/Static_T" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="SWB/Static_R" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="SWB/Static_B" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/PlainGray" />
+                <ColourRectProperty name="ImageColours" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="image_noframe">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="Image" />
+                <ColourRectProperty name="ImageColours" />
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+        <StateImagery name="EnabledFrame">
+            <Layer>
+                <Section look="SWB/StaticShared" section="frame">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledFrame">
+            <Layer>
+                <Section look="SWB/StaticShared" section="frame">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameEnabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameDisabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameEnabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameDisabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameImage">
+            <Layer>
+                <Section section="image_withframe">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="gray_section">
+                    <ColourProperty name="OverlayColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameImage">
+            <Layer>
+                <Section section="image_noframe" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/StaticShared
+        (Shared imagery components for static widgets)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/StaticShared">
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Static_TL" />
+                <Image component="LeftEdge" name="SWB/Static_L" />
+                <Image component="BottomLeftCorner" name="SWB/Static_BL" />
+                <Image component="TopEdge" name="SWB/Static_T" />
+                
+                <Image component="BottomEdge" name="SWB/Static_B" />
+                <Image component="TopRightCorner" name="SWB/Static_TR" />
+                <Image component="RightEdge" name="SWB/Static_R" />
+                <Image component="BottomRightCorner" name="SWB/Static_BR" />
+                <ColourRectProperty name="FrameColours" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="background">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/Static_L" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/Static_T" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="SWB/Static_R" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="SWB/Static_B" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/Static_M" />
+                <ColourProperty name="BackgroundColour" />
+                <!--<Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />-->
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="background_noframe">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/Static_M" />
+                <ColourProperty name="BackgroundColour" />
+                <!--<Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />-->
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/StaticText
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/StaticText">
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
+        <!--<PropertyDefinition name="BackgroundColours" initialValue="tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" redrawOnWrite="true" />-->
+        <PropertyDefinition name="BackgroundColour" initialValue="B2000000" redrawOnWrite="true" type="Colour" />
+
+        <Property name="FrameEnabled" value="True" />
+        <Property name="BackgroundEnabled" value="True" />
+        
+        <NamedArea name="WithFrameTextRenderArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/StaticRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/StaticBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="WithFrameTextRenderAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/StaticRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="WithFrameTextRenderAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/StaticBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="WithFrameTextRenderAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+        <StateImagery name="EnabledFrame">
+            <Layer>
+                <Section look="SWB/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledFrame">
+            <Layer>
+                <Section look="SWB/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameEnabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameDisabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameEnabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background_noframe">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameDisabledBackground">
+            <Layer>
+                <Section look="SWB/StaticShared" section="background_noframe">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/HorizontalScrollbarThumb
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/HorizontalScrollbarThumb">
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+
+        <Property name="HorzFree" value="True" /> <!-- Horizontal mouse drag -->
+        
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/HorzScrollThumbBorder_TL" />
+                <Image component="TopRightCorner" name="SWB/HorzScrollThumbBorder_TR" />
+                <Image component="BottomLeftCorner" name="SWB/HorzScrollThumbBorder_BL" />
+                <Image component="BottomRightCorner" name="SWB/HorzScrollThumbBorder_BR" />
+                <Image component="LeftEdge" name="SWB/HorzScrollThumbBorder_L" />
+                <Image component="TopEdge" name="SWB/HorzScrollThumbBorder_T" />
+                <Image component="RightEdge" name="SWB/HorzScrollThumbBorder_R" />
+                <Image component="BottomEdge" name="SWB/HorzScrollThumbBorder_B" />
+                <Image component="Background" name="SWB/HorzScrollThumbBorder_M" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/HorzScrollThumb_Background" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_DarkerThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/HorizontalScrollbar
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/HorizontalScrollbar">
+        <!-- WARNING: this property link seems to be problematic for the cegui layout editor.-->
+        <PropertyLinkDefinition name="ThumbMinSize" widget="__auto_thumb__" targetProperty="MinSize" initialValue="{{0,25},{0,0}}" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <!-- Assume square form of buttons; resize edges (left & right) accordingly -->
+                <Dim type="LeftEdge" >
+                    <UnifiedDim scale="1.0" type="Height" />
+                </Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="RightEdge" />
+                        <UnifiedDim scale="1.0" type="Height" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Height" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowRight" />
+        </Child>
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Height" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="GlyphImage" value="SWB/GlyphArrowLeft" />
+        </Child>
+        <Child  type="SWB/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,25},{0,0}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="RightEdge" />
+                            <ImageDim name="SWB/MiniHorzScrollRightNormal" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/MiniHorzScrollBarSegment" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+
+    <!--
+    ***************************************************
+        SWB/VerticalScrollbarThumb
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/VerticalScrollbarThumb">
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+
+        <Property name="VertFree" value="True" />
+
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/VertScrollThumbBorder_TL" />
+                <Image component="TopRightCorner" name="SWB/VertScrollThumbBorder_TR" />
+                <Image component="BottomLeftCorner" name="SWB/VertScrollThumbBorder_BL" />
+                <Image component="BottomRightCorner" name="SWB/VertScrollThumbBorder_BR" />
+                <Image component="LeftEdge" name="SWB/VertScrollThumbBorder_L" />
+                <Image component="TopEdge" name="SWB/VertScrollThumbBorder_T" />
+                <Image component="RightEdge" name="SWB/VertScrollThumbBorder_R" />
+                <Image component="BottomEdge" name="SWB/VertScrollThumbBorder_B" />
+                <Image component="Background" name="SWB/VertScrollThumbBorder_M" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/VertScrollThumb_Background" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_DarkerThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/VerticalScrollbar
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/VerticalScrollbar">
+        <!-- WARNING: this property link seems to be problematic for the cegui layout editor.-->
+        <PropertyLinkDefinition name="ThumbMinSize" widget="__auto_thumb__" targetProperty="MinSize" initialValue="{{0,0},{0,25}}" />
+        <Property name="VerticalScrollbar" value="True" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <!-- Assume square form of buttons; resize edges (top & bottom) accordingly -->
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="BottomEdge" />
+                        <UnifiedDim scale="1.0" type="Width" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Width" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowDown" />
+        </Child>
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Width" /></Dim>
+            </Area>
+            <Property name="GlyphImage" value="SWB/GlyphArrowUp" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.1" type="Height" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,0},{0,25}}" />
+        </Child>
+        
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Add">
+                            <UnifiedDim scale="0.0" type="TopEdge" />
+                            <AbsoluteDim value="16" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="BottomEdge" />
+                            <AbsoluteDim value="16" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/MiniVertScrollBarSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="CentreAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/GlyphButton
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/GlyphButton">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="GlyphImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+
+        <ImagerySection name="glyph">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <ImageDim name="SWB/MiniButton_L" dimension="Width"/>
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <ImageDim name="SWB/MiniButton_T" dimension="Height"/>
+                    </Dim>
+                    <Dim type="Width">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/MiniButton_L" dimension="Width" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/MiniButton_T" dimension="Height" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <ImageProperty name="GlyphImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/FilledRoundedBorder_TL" />
+                <Image component="LeftEdge" name="SWB/FilledRoundedBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/FilledRoundedBorder_BL" />
+                <Image component="TopEdge" name="SWB/FilledRoundedBorder_T" />
+                <Image component="Background" name="SWB/FilledRoundedBorder_M" />
+                <Image component="BottomEdge" name="SWB/FilledRoundedBorder_B" />
+                <Image component="TopRightCorner" name="SWB/FilledRoundedBorder_TR" />
+                <Image component="RightEdge" name="SWB/FilledRoundedBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/FilledRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/MiniButton_Background" /> <!-- shared image from other item -->
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_highlight">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/MiniButton_BackgHighlight" />  <!-- shared image from other item -->
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_DarkerThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section" />
+                <Section section="glyph" />
+            </Layer>
+
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/Label
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Label">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="Colour" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FFDDDDDD" redrawOnWrite="true" type="Colour" />
+        <PropertyDefinition name="VertFormatting" initialValue="CentreAligned" redrawOnWrite="true" type="VerticalTextFormatting" />
+        <PropertyDefinition name="HorzFormatting" initialValue="CentreAligned" redrawOnWrite="true" type="HorizontalTextFormatting" />
+
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+
+        <ImagerySection name="Label">
+            <TextComponent>
+                <Area>
+	            <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+	            <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+	            <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
+	            <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="Label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="Label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+    
+    
+    <!--
+    ***************************************************
+        SWB/Listbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Listbox">
+        <!-- The size of the scrollbar + buttons -->
+        <PropertyDefinition name="ScrollBarPreferredSize" initialValue="24" redrawOnWrite="true" layoutOnWrite="false" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="8" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="-8" /></Dim>
+                <Dim type="Width" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="12" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" >
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="-8"  /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="8" /></Dim>
+                <Dim type="Width" >
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="12" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ListboxTopLeft" />
+                <Image component="TopRightCorner" name="SWB/ListboxTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/ListboxBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/ListboxBottomRight" />
+                <Image component="LeftEdge" name="SWB/ListboxLeft" />
+                <Image component="RightEdge" name="SWB/ListboxRight" />
+                <Image component="TopEdge" name="SWB/ListboxTop" />
+                <Image component="BottomEdge" name="SWB/ListboxBottom" />
+                <Image component="Background" name="SWB/ListboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ListboxTransparent
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ListboxTransparent">
+        <!-- The size of the scrollbar + buttons -->
+        <PropertyDefinition name="ScrollBarPreferredSize" initialValue="24" redrawOnWrite="true" layoutOnWrite="false" />
+
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="25" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="25" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="-3" /></Dim>
+                <Dim type="Width" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="4" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" >
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0"  /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="20" /></Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="4" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <HorzAlignment type="LeftAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="20" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ComboDropList
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ComboDropList">
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ComboboxListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ComboboxListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ComboboxListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ComboboxListTop" dimension="Height" /></Dim>
+
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ComboboxListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-16" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="16" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="-8" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="8" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="24" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-16" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ComboboxListTopLeft" />
+                <Image component="TopRightCorner" name="SWB/ComboboxListTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/ComboboxListBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/ComboboxListBottomRight" />
+                <Image component="LeftEdge" name="SWB/ComboboxListLeft" />
+                <Image component="RightEdge" name="SWB/ComboboxListRight" />
+                <Image component="TopEdge" name="SWB/ComboboxListTop" />
+                <Image component="BottomEdge" name="SWB/ComboboxListBottom" />
+                <Image component="Background" name="SWB/ComboboxListBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SWB/ComboEditbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ComboEditbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FFFF8080" redrawOnWrite="true" />
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FFB15050" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+        <PropertyDefinition name="BackgroundColour" initialValue="77FFFFFF" redrawOnWrite="true" type="Colour" />
+
+        <!-- Use the default mouse cursor -->
+        <!--<Property name="MouseCursorImage" value="SWBCursors/MouseTextBar" />-->
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="10" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        
+        <ImagerySection name="container_normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/EditBox_TL" />
+                <Image component="LeftEdge" name="SWB/EditBox_L" />
+                <Image component="BottomLeftCorner" name="SWB/EditBox_BL" />
+                <Image component="TopEdge" name="SWB/EditBox_T" />
+                <Image component="Background" name="SWB/EditBox_M" />
+                <Image component="BottomEdge" name="SWB/EditBox_B" />
+                <Image component="TopRightCorner" name="SWB/EditBox_TR" />
+                <Image component="RightEdge" name="SWB/EditBox_R" />
+                <Image component="BottomRightCorner" name="SWB/EditBox_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="container_background">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/FilledRoundedBorder_TL" />
+                <Image component="LeftEdge" name="SWB/FilledRoundedBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/FilledRoundedBorder_BL" />
+                <Image component="TopEdge" name="SWB/FilledRoundedBorder_T" />
+                <Image component="Background" name="SWB/FilledRoundedBorder_M" />
+                <Image component="BottomEdge" name="SWB/FilledRoundedBorder_B" />
+                <Image component="TopRightCorner" name="SWB/FilledRoundedBorder_TR" />
+                <Image component="RightEdge" name="SWB/FilledRoundedBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/FilledRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/TextSelectionBrush" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><ImageDim name="SWB/EditBoxCarat" dimension="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/EditBoxCarat" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveSelection">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="selection">
+                    <ColourProperty name="ActiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveSelection">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="selection">
+                    <ColourProperty name="InactiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SWB/Combobox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Combobox">
+        <PropertyLinkDefinition name="NormalEditTextColour" widget="__auto_editbox__" targetProperty="NormalTextColour" initialValue="FFFFFFFF" />
+        <PropertyLinkDefinition name="SelectedEditTextColour" widget="__auto_editbox__" targetProperty="SelectedTextColour" initialValue="FFFFFFDD" /> <!-- GS_Selection-->
+        <PropertyLinkDefinition name="ActiveEditSelectionColour" widget="__auto_editbox__" targetProperty="ActiveSelectionColour" initialValue="FFFFB080" />
+        <PropertyLinkDefinition name="InactiveEditSelectionColour" widget="__auto_editbox__" targetProperty="InactiveSelectionColour" initialValue="FFB18A50" />
+        
+        <Child  type="SWB/ComboEditbox" nameSuffix="__auto_editbox__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Multiply">
+                            <FontDim type="LineSpacing" padding="10" />
+                            <!-- button width should be 1.42 times greater than height -->
+                            <AbsoluteDim value="1.42" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" >
+                    <FontDim type="LineSpacing" padding="10" />
+                </Dim>
+            </Area>
+        </Child>
+        <Child  type="SWB/ComboDropList" nameSuffix="__auto_droplist__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_editbox__" dimension="BottomEdge" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+            </Area>
+        </Child>
+        <Child  type="SWB/GlyphButtonCombo" nameSuffix="__auto_button__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+
+                <!-- width should be 1.42 times greater than height -->
+                <Dim type="Width" >
+                    <OperatorDim op="Add">
+                        <UnifiedDim scale="0" type="Width" />
+                        <OperatorDim op="Multiply">
+                            <WidgetDim widget="__auto_editbox__" dimension="Height" />
+                            <AbsoluteDim value="1.42" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <!-- if you want a square button instead, use the next line -->
+                <!--<Dim type="Width" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>-->
+                <Dim type="Height" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="GlyphImage" value="SWB/ComboboxButtonGlyph" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/GlyphButtonCombo
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/GlyphButtonCombo">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="GlyphImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="GlyphOffsetValueInPixels" initialValue="8" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="glyph">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <!--<AbsoluteDim value="5" />-->
+                        <PropertyDim name="GlyphOffsetValueInPixels" />
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <!--<AbsoluteDim value="5" />-->
+                        <PropertyDim name="GlyphOffsetValueInPixels" />
+                    </Dim>
+                    <Dim type="Width">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <PropertyDim name="GlyphOffsetValueInPixels" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <PropertyDim name="GlyphOffsetValueInPixels" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <ImageProperty name="GlyphImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ComboboxButtonBorder_TL" />
+                <Image component="LeftEdge" name="SWB/ComboboxButtonBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/ComboboxButtonBorder_BL" />
+                <Image component="TopEdge" name="SWB/ComboboxButtonBorder_T" />
+                <Image component="Background" name="SWB/ComboboxButtonBorder_M" />
+                <Image component="BottomEdge" name="SWB/ComboboxButtonBorder_B" />
+                <Image component="TopRightCorner" name="SWB/ComboboxButtonBorder_TR" />
+                <Image component="RightEdge" name="SWB/ComboboxButtonBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/ComboboxButtonBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/MiniButton_Background" /> <!-- shared image from other item -->
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="glyph" />
+            </Layer>
+
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ItemListbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ItemListbox">
+        <!-- The size of the scrollbar + buttons -->
+        <PropertyDefinition name="ScrollBarPreferredSize" initialValue="24" redrawOnWrite="true" layoutOnWrite="false" />
+        
+        <NamedArea name="ItemRenderArea">
+            <Area>
+                <Dim type="LeftEdge"><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge">
+                    <ImageDim name="SWB/ListboxTop" dimension="Height" />
+                </Dim>
+                <Dim type="RightEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="8" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="-8" /></Dim>
+                <Dim type="Width" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="12" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="-8"  /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="8" /></Dim>
+                <Dim type="Width" >
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="12" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ListboxTopLeft" />
+                <Image component="TopRightCorner" name="SWB/ListboxTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/ListboxBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/ListboxBottomRight" />
+                <Image component="LeftEdge" name="SWB/ListboxLeft" />
+                <Image component="RightEdge" name="SWB/ListboxRight" />
+                <Image component="TopEdge" name="SWB/ListboxTop" />
+                <Image component="BottomEdge" name="SWB/ListboxBottom" />
+                <Image component="Background" name="SWB/ListboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/ListboxItem
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ListboxItem">
+        <PropertyDefinition name="TextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectionBrush" initialValue="SWB/ListboxSelectionBrush" redrawOnWrite="true" />
+        
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        
+        <Property name="Selectable" value="True" />
+        <NamedArea name="ContentSize">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <AbsoluteDim value="0" />
+                </Dim>
+                <Dim type="TopEdge" >
+                    <AbsoluteDim value="0" />
+                </Dim>
+                <Dim type="Width" >
+                    <FontDim type="HorzExtent" padding="6" />
+                </Dim>
+                <Dim type="Height" >
+                    <FontDim type="LineSpacing" />
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="TopEdge">
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="LeftEdge">
+                        <AbsoluteDim value="3" />
+                    </Dim>
+                    <Dim type="RightEdge">
+                        <UnifiedDim scale="1" offset="-3" type="RightEdge" />
+                    </Dim>
+                    <Dim type="BottomEdge">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                    </Dim>
+                </Area>
+            </TextComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge">
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="LeftEdge">
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="RightEdge">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                    </Dim>
+                    <Dim type="BottomEdge">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                    </Dim>
+                </Area>
+                <ImageProperty name="SelectionBrush" />
+                <ColourProperty name="GS_LighterThemeColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="TextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="TextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedEnabled">
+            <Layer>
+                <Section section="selection" />
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+                <Section section="selection" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    
+
+    <!--
+    ***************************************************
+        SWB/Checkbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Checkbox">
+    <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderSpacing" initialValue="5" redrawOnWrite="true" layoutOnWrite="true" />
+        
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <UnifiedDim scale="1" type="Height" />
+                    </Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><PropertyDim name="BorderSpacing" /></Dim>
+                    <Dim type="TopEdge" ><PropertyDim name="BorderSpacing" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <PropertyDim name="BorderSpacing" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Add">
+                                <PropertyDim name="BorderSpacing" />
+                                <PropertyDim name="BorderSpacing" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+
+                <Image component="TopLeftCorner" name="SWB/CheckboxBorder_TL" />
+                <Image component="LeftEdge" name="SWB/CheckboxBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/CheckboxBorder_BL" />
+                <Image component="TopEdge" name="SWB/CheckboxBorder_T" />
+                <Image component="Background" name="SWB/CheckboxBorder_M" />
+                <Image component="BottomEdge" name="SWB/CheckboxBorder_B" />
+                <Image component="TopRightCorner" name="SWB/CheckboxBorder_TR" />
+                <Image component="RightEdge" name="SWB/CheckboxBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/CheckboxBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><PropertyDim name="BorderSpacing" /></Dim>
+                    <Dim type="TopEdge" ><PropertyDim name="BorderSpacing" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <PropertyDim name="BorderSpacing" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Add">
+                                <PropertyDim name="BorderSpacing" />
+                                <PropertyDim name="BorderSpacing" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                
+                <Image component="TopLeftCorner" name="SWB/CheckboxBck_TL" />
+                <Image component="LeftEdge" name="SWB/CheckboxBck_L" />
+                <Image component="BottomLeftCorner" name="SWB/CheckboxBck_BL" />
+                <Image component="TopEdge" name="SWB/CheckboxBck_T" />
+                <Image component="Background" name="SWB/CheckboxBck_M" />
+                <Image component="BottomEdge" name="SWB/CheckboxBck_B" />
+                <Image component="TopRightCorner" name="SWB/CheckboxBck_TR" />
+                <Image component="RightEdge" name="SWB/CheckboxBck_R" />
+                <Image component="BottomRightCorner" name="SWB/CheckboxBck_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="select_mark">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><PropertyDim name="BorderSpacing" /></Dim>
+                    <Dim type="TopEdge" >
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <PropertyDim name="BorderSpacing" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <PropertyDim name="BorderSpacing" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+
+                <Image component="Background" name="SWB/CheckboxMark" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedNormal">
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedHover">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+                
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="select_mark">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/Checkbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ImageCheckbox">
+        <PropertyDefinition name="UncheckedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="CheckedImage" initialValue="" redrawOnWrite="true" />
+
+        <ImagerySection name="checked_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="CheckedImage" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="unchecked_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="UncheckedImage" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="unchecked_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="unchecked_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="unchecked_section">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedNormal">
+            <Layer>
+                <Section section="checked_section" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="SelectedHover">
+            <Layer>
+                <Section section="checked_section" />
+            </Layer>
+        </StateImagery>
+                
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="checked_section">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/Editbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Editbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FFFF8080" redrawOnWrite="true" />
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FFB15050" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+        <PropertyDefinition name="BackgroundColour" initialValue="77FFFFFF" redrawOnWrite="true" type="Colour" />
+
+        <!-- Use the default mouse cursor -->
+        <!--<Property name="MouseCursorImage" value="SWBCursors/MouseTextBar" />-->
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="10" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        
+        <ImagerySection name="container_normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/EditBox_TL" />
+                <Image component="LeftEdge" name="SWB/EditBox_L" />
+                <Image component="BottomLeftCorner" name="SWB/EditBox_BL" />
+                <Image component="TopEdge" name="SWB/EditBox_T" />
+                <Image component="Background" name="SWB/EditBox_M" />
+                <Image component="BottomEdge" name="SWB/EditBox_B" />
+                <Image component="TopRightCorner" name="SWB/EditBox_TR" />
+                <Image component="RightEdge" name="SWB/EditBox_R" />
+                <Image component="BottomRightCorner" name="SWB/EditBox_BR" />
+            </FrameComponent>
+        </ImagerySection>
+   
+        <ImagerySection name="container_background">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/FilledRoundedBorder_TL" />
+                <Image component="LeftEdge" name="SWB/FilledRoundedBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/FilledRoundedBorder_BL" />
+                <Image component="TopEdge" name="SWB/FilledRoundedBorder_T" />
+                <Image component="Background" name="SWB/FilledRoundedBorder_M" />
+                <Image component="BottomEdge" name="SWB/FilledRoundedBorder_B" />
+                <Image component="TopRightCorner" name="SWB/FilledRoundedBorder_TR" />
+                <Image component="RightEdge" name="SWB/FilledRoundedBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/FilledRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+           
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="1" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" offset="-1"/></Dim>
+                </Area>
+                <Image name="SWB/TextSelectionBrush" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><ImageDim name="SWB/EditBoxCarat" dimension="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/EditBoxCarat" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="container_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveSelection">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="selection">
+                    <ColourProperty name="ActiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveSelection">
+            <Layer>
+                <Section section="container_background"><ColourProperty name="BackgroundColour" /></Section>
+                <Section section="selection">
+                    <ColourProperty name="InactiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/Spinner
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Spinner">
+        <Child  type="SWB/Editbox" nameSuffix="__auto_editbox__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Divide">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="2" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+        </Child>
+
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowUp" />
+        </Child>
+        
+        <Child  type="SWB/GlyphButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowDown" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/MultiLineEditbox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/MultiLineEditbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FFFF8080" redrawOnWrite="true" />
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FFB15050" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <!-- The size of the scrollbar + buttons -->
+        <PropertyDefinition name="ScrollBarPreferredSize" initialValue="24" redrawOnWrite="true" layoutOnWrite="false" />
+
+        <Property name="MouseCursorImage" value="SWBCursors/MouseTextBar" />
+        <Property name="SelectionBrushImage" value="SWB/MultiLineEditboxSelectionBrush" />
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/MultiLineEditboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/MultiLineEditboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/MultiLineEditboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/MultiLineEditboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="-4" /></Dim>
+                <Dim type="Width" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="5" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="-3"  /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                <Dim type="Width" >
+                    <PropertyDim name="ScrollBarPreferredSize" />
+                </Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <OperatorDim op="Add">
+                            <PropertyDim name="ScrollBarPreferredSize" />
+                            <AbsoluteDim value="7" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/MultiLineEditboxTopLeft" />
+                <Image component="TopRightCorner" name="SWB/MultiLineEditboxTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/MultiLineEditboxBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/MultiLineEditboxBottomRight" />
+                <Image component="LeftEdge" name="SWB/MultiLineEditboxLeft" />
+                <Image component="RightEdge" name="SWB/MultiLineEditboxRight" />
+                <Image component="TopEdge" name="SWB/MultiLineEditboxTop" />
+                <Image component="BottomEdge" name="SWB/MultiLineEditboxBottom" />
+                <Image component="Background" name="SWB/MultiLineEditboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><ImageDim name="SWB/EditBoxCarat" dimension="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/EditBoxCarat" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="main">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/Tooltip
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Tooltip">
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/TooltipLeftEdge" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/TooltipTopEdge" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/TooltipRightEdge" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/TooltipBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/TooltipTopLeft" />
+                <Image component="TopRightCorner" name="SWB/TooltipTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/TooltipBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/TooltipBottomRight" />
+                <Image component="LeftEdge" name="SWB/TooltipLeftEdge" />
+                <Image component="RightEdge" name="SWB/TooltipRightEdge" />
+                <Image component="TopEdge" name="SWB/TooltipTopEdge" />
+                <Image component="BottomEdge" name="SWB/TooltipBottomEdge" />
+                <Image component="Background" name="SWB/TooltipMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/TooltipLeftEdge" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/TooltipTopEdge" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="SWB/TooltipRightEdge" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="SWB/TooltipBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Colours topLeft="FFFFE6DA" topRight="FFFFE6DA" bottomLeft="FFFFFBFA" bottomRight="FFFFFBFA" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="CF8D8D8D" topRight="CF8D8D8D" bottomLeft="CF8D8D8D" bottomRight="CF8D8D8D" />
+                </Section>
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="BFEAEAEA" topRight="BFEAEAEA" bottomLeft="BFEAEAEA" bottomRight="BFEAEAEA" />
+                </Section>
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/CustomTooltip
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/CustomTooltip">
+
+        <PropertyDefinition name="CustomTooltipBackgroundTransparency" initialValue="F0222222" redrawOnWrite="true" />
+        
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/TooltipLeftEdge" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="SWB/TooltipTopEdge" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/TooltipRightEdge" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="SWB/TooltipBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/TooltipTopLeft" />
+                <Image component="LeftEdge" name="SWB/TooltipLeftEdge" />
+                <Image component="BottomLeftCorner" name="SWB/TooltipBottomLeft" />
+                <Image component="TopEdge" name="SWB/TooltipTopEdge" />
+                <Image component="Background" name="SWB/TooltipMiddle" />
+                <Image component="BottomEdge" name="SWB/TooltipBottomEdge" />
+                <Image component="TopRightCorner" name="SWB/TooltipTopRight" />
+                <Image component="RightEdge" name="SWB/TooltipRightEdge" />
+                <Image component="BottomRightCorner" name="SWB/TooltipBottomRight" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="2" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="10" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="4" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/TooltipMiddle" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/TooltipLeftEdge" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/TooltipTopEdge" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="SWB/TooltipRightEdge" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="SWB/TooltipBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="CustomTooltipBackgroundTransparency" />
+                </Section>
+                <Section section="border_section" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="CustomTooltipBackgroundTransparency" />
+                </Section>
+                <Section section="border_section" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ScrollablePane
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ScrollablePane">
+        <NamedArea name="ViewableArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+ <!--
+    ***************************************************
+        SWB/ScrollablePaneNoBar
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ScrollablePaneNoBar">
+        <NamedArea name="ViewableArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SWB/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SWB/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/TabButtonTopOnly
+        A tab button that looks like the top type... always.
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabButtonTopOnly">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
+        
+        <PropertyDefinition name="SelectedBackgroundColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverBackgroundColour" initialValue="AAFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="NonSelectedBackgroundColour" initialValue="25FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+
+        <!-- top border section -->
+        <ImagerySection name="top_border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/GenericRoundedBorder_TL" />
+                <Image component="TopEdge" name="SWB/GenericRoundedBorder_T" />
+                <Image component="TopRightCorner" name="SWB/GenericRoundedBorder_TR" />
+                <Image component="LeftEdge" name="SWB/GenericRoundedBorder_L" />
+                <Image component="Background" name="SWB/GenericRoundedBorder_M" />
+                <Image component="RightEdge" name="SWB/GenericRoundedBorder_R" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <!-- top background section -->
+        <ImagerySection name="top_background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/TabButtonBorder_TL" />
+                <Image component="TopEdge" name="SWB/TabButtonBorder_T" />
+                <Image component="TopRightCorner" name="SWB/TabButtonBorder_TR" />
+                <Image component="LeftEdge" name="SWB/TabButtonBorder_L" />
+                <Image component="Background" name="SWB/TabButtonBorder_M" />
+                <Image component="RightEdge" name="SWB/TabButtonBorder_R" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <StateImagery name="TopNormal">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomNormal">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopHover">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomHover">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopSelected">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomSelected">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopPushed">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomPushed">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopDisabled">
+            <Layer>
+                <Section section="top_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomDisabled">
+            <Layer>
+                <Section section="top_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/TabButtonBotOnly
+        A tab button that looks like the bottom type... always.
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabButtonBotOnly">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
+        
+        <PropertyDefinition name="SelectedBackgroundColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverBackgroundColour" initialValue="AAFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="NonSelectedBackgroundColour" initialValue="25FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+
+        <!-- bottom border section -->
+        <ImagerySection name="bottom_border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/GenericRoundedBorder_L" />
+                <Image component="Background" name="SWB/GenericRoundedBorder_M" />
+                <Image component="RightEdge" name="SWB/GenericRoundedBorder_R" />
+                <Image component="BottomLeftCorner" name="SWB/GenericRoundedBorder_BL" />
+                <Image component="BottomEdge" name="SWB/GenericRoundedBorder_B" />
+                <Image component="BottomRightCorner" name="SWB/GenericRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <!-- bottom background section -->
+        <ImagerySection name="bottom_background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/TabButtonBorder_L" />
+                <Image component="Background" name="SWB/TabButtonBorder_M" />
+                <Image component="RightEdge" name="SWB/TabButtonBorder_R" />
+                <Image component="BottomLeftCorner" name="SWB/TabButtonBorder_BL" />
+                <Image component="BottomEdge" name="SWB/TabButtonBorder_B" />
+                <Image component="BottomRightCorner" name="SWB/TabButtonBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        
+        <StateImagery name="TopNormal">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomNormal">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopHover">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="BottomHover">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopSelected">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomSelected">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="TopPushed">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="BottomPushed">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="TopDisabled">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomDisabled">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/TabButton
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabButton">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFDDDD" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
+        
+        <PropertyDefinition name="SelectedBackgroundColour" initialValue="FF940000" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverBackgroundColour" initialValue="AAFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="NonSelectedBackgroundColour" initialValue="25FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+
+        <!-- top border section -->
+        <ImagerySection name="top_border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/GenericRoundedBorder_TL" />
+                <Image component="TopEdge" name="SWB/GenericRoundedBorder_T" />
+                <Image component="TopRightCorner" name="SWB/GenericRoundedBorder_TR" />
+                <Image component="LeftEdge" name="SWB/GenericRoundedBorder_L" />
+                <Image component="Background" name="SWB/GenericRoundedBorder_M" />
+                <Image component="RightEdge" name="SWB/GenericRoundedBorder_R" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <!-- top background section -->
+        <ImagerySection name="top_background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/TabButtonBorder_TL" />
+                <Image component="TopEdge" name="SWB/TabButtonBorder_T" />
+                <Image component="TopRightCorner" name="SWB/TabButtonBorder_TR" />
+                <Image component="LeftEdge" name="SWB/TabButtonBorder_L" />
+                <Image component="Background" name="SWB/TabButtonBorder_M" />
+                <Image component="RightEdge" name="SWB/TabButtonBorder_R" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <!-- bottom border section -->
+        <ImagerySection name="bottom_border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/GenericRoundedBorder_L" />
+                <Image component="Background" name="SWB/GenericRoundedBorder_M" />
+                <Image component="RightEdge" name="SWB/GenericRoundedBorder_R" />
+                <Image component="BottomLeftCorner" name="SWB/GenericRoundedBorder_BL" />
+                <Image component="BottomEdge" name="SWB/GenericRoundedBorder_B" />
+                <Image component="BottomRightCorner" name="SWB/GenericRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <!-- bottom background section -->
+        <ImagerySection name="bottom_background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/TabButtonBorder_L" />
+                <Image component="Background" name="SWB/TabButtonBorder_M" />
+                <Image component="RightEdge" name="SWB/TabButtonBorder_R" />
+                <Image component="BottomLeftCorner" name="SWB/TabButtonBorder_BL" />
+                <Image component="BottomEdge" name="SWB/TabButtonBorder_B" />
+                <Image component="BottomRightCorner" name="SWB/TabButtonBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        
+        <StateImagery name="TopNormal">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomNormal">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="NonSelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopHover">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="BottomHover">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="HoverBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="TopSelected">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomSelected">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="TopPushed">
+            <Layer>
+                <Section section="top_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="BottomPushed">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <ColourProperty name="SelectedBackgroundColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="TopDisabled">
+            <Layer>
+                <Section section="top_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="top_border_section"><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="BottomDisabled">
+            <Layer>
+                <Section section="bottom_background_section">
+                    <Colours topLeft="997F7F7F" topRight="997F7F7F" bottomLeft="997F7F7F" bottomRight="997F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="bottom_border_section" ><ColourProperty name="BorderColour" /></Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/TabContentPane
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabContentPane">
+        <PropertyDefinition name="EnableTop" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
+        <PropertyDefinition name="EnableBottom" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Add">
+                            <ImageDim name="SWB/Rounded_Square_Small_TL" dimension="Height" />
+                            <AbsoluteDim value="3" />
+                        </OperatorDim>
+                    </Dim>
+                    
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Rounded_Square_Small_TL" />
+                <Image component="TopEdge" name="SWB/Rounded_Square_Small_T" />
+                <Image component="TopRightCorner" name="SWB/Rounded_Square_Small_TR" />
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Add">
+                            <AbsoluteDim value="0" />
+                            <ImageDim name="SWB/Rounded_Square_Small_TL" dimension="Height"/>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_BL" dimension="Height" />
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/Rounded_Square_Small_L" />
+                <Image component="Background" name="SWB/Rounded_Square_Small_M" />
+                <Image component="RightEdge" name="SWB/Rounded_Square_Small_R" />
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_BL" dimension="Height" />
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="BottomLeftCorner" name="SWB/Rounded_Square_Small_BL" />
+                <Image component="BottomEdge" name="SWB/Rounded_Square_Small_B" />
+                <Image component="BottomRightCorner" name="SWB/Rounded_Square_Small_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="normal">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SWB/TabButtonPane
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabButtonPane">
+        <PropertyDefinition name="EnableTop" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
+        <PropertyDefinition name="EnableBottom" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
+
+        <ImagerySection name="normal">
+
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SWB/TabControl
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TabControl">
+        <PropertyDefinition name="TCScrollLRatio" initialValue="0.2" redrawOnWrite="true" /> <!-- The ratio is height / width -->
+<!--        <PropertyDefinition name="TCScrollLRatio" initialValue="0.1" redrawOnWrite="true" layoutOnWrite="true" />-->
+
+        <Property name="TabButtonType" value="SWB/TabButton" />
+        <Property name="TabTextPadding" value="{0,6}" />
+
+        <Child type="SWB/TabContentPane" nameSuffix="__auto_TabPane__">
+            <Area>
+                <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge"><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="TopEdge">
+                    <OperatorDim op="Multiply">
+                        <PropertyDim widget="__auto_TabPane__" name="EnableBottom" />
+                        <PropertyDim name="TabHeight" type="Height" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <PropertyDim name="TabHeight" type="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        
+        <Child  type="SWB/TabButtonPane" nameSuffix="__auto_TabPane__Buttons">
+            <Area>
+                <Dim type="LeftEdge">
+                    <OperatorDim op="Multiply">
+                        <PropertyDim name="TabHeight" type="Height" />
+                        <PropertyDim name="TCScrollLRatio" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <OperatorDim op="Multiply">
+                            <PropertyDim name="TabHeight" type="Height" />
+                            <PropertyDim name="TCScrollLRatio" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge">
+                    <OperatorDim op="Add">
+                        <AbsoluteDim value="1" />
+                        <OperatorDim op="Multiply">
+                            <PropertyDim widget="__auto_TabPane__Buttons" name="EnableTop" />
+                            <OperatorDim op="Subtract">
+                                <UnifiedDim scale="1" type="Height" />
+                                <PropertyDim name="TabHeight" type="Height" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height"><PropertyDim name="TabHeight" type="Height" /></Dim>
+            </Area>
+        </Child>
+        
+        <Child type="SWB/GlyphButton" nameSuffix="__auto_TabPane__ScrollLeft">
+            <Area>
+                <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
+                </Dim>
+                <Dim type="Width">
+                    <OperatorDim op="Multiply">
+                        <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                        <PropertyDim name="TCScrollLRatio" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="BottomEdge" />
+                </Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowLeft" />
+        </Child>
+        
+        <Child type="SWB/GlyphButton" nameSuffix="__auto_TabPane__ScrollRight">
+            <Area>
+                <Dim type="Width">
+                    <OperatorDim op="Multiply">
+                        <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                        <PropertyDim name="TCScrollLRatio" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="LeftEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <WidgetDim widget="__auto_TabPane__ScrollRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
+                </Dim>
+                <Dim type="Height">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                </Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="GlyphImage" value="SWB/GlyphArrowRight" />
+        </Child>
+        
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/Titlebar
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/Titlebar">
+        <PropertyDefinition name="CaptionColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="ActiveColour" initialValue="FFFF0000" redrawOnWrite="true"/>
+        <PropertyDefinition name="InactiveColour" initialValue="FFEE1111" redrawOnWrite="true"/>
+        <PropertyDefinition name="BackgroundPictureColour" initialValue="FFBBA075" redrawOnWrite="true"/>
+        
+        <Property name="NonClient" value="True" />
+        
+        <ImagerySection name="overdrawn_section">
+            <FrameComponent>
+                <Area>
+                    <!--
+                    <Dim type="LeftEdge"><ImageDim name="SWB/PanelTitleUnderlay" dimension="LeftEdge" /></Dim>
+                    <Dim type="TopEdge"><ImageDim name="SWB/PanelTitleUnderlay" dimension="TopEdge" /></Dim>
+                    -->
+                    <Dim type="LeftEdge"><AbsoluteDim value="141" /></Dim> <!-- PanelTitleUnderlay left edge-->
+                    <Dim type="TopEdge"><AbsoluteDim value="8" /></Dim> <!-- PanelTitleUnderlay top edge-->
+                    <Dim type="Width">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <AbsoluteDim value="141" /> <!-- PanelTitleUnderlay left edge-->
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height"><ImageDim name="SWB/PanelTitleUnderlay" dimension="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/PanelTitleOverlay_L" />
+                <Image component="Background" name="SWB/PanelTitleOverlay_M" />
+                <Image component="RightEdge" name="SWB/PanelTitleOverlay_R" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SWB/PanelHeader_L" />
+                <Image component="Background" name="SWB/PanelHeader_M" />
+                <Image component="RightEdge" name="SWB/PanelHeader_R" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="caption"> 
+            <TextComponent>
+                <Area>
+                    <!--
+                    <Dim type="LeftEdge"><ImageDim name="SWB/PanelTitleArea_Calc" dimension="LeftEdge" /></Dim>
+                    <Dim type="TopEdge"><ImageDim name="SWB/PanelTitleArea_Calc" dimension="TopEdge" /></Dim>
+                    -->
+                    <Dim type="LeftEdge"><AbsoluteDim value="180" /></Dim> <!-- PanelTitleArea_Calc left edge-->
+                    <Dim type="TopEdge"><AbsoluteDim value="27" /></Dim> <!-- PanelTitleArea_Calc top edge-->
+                    <Dim type="Width">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <AbsoluteDim value="180" />
+                                <!--<ImageDim name="SWB/PanelTitleArea_Calc" dimension="LeftEdge" />-->
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height"><ImageDim name="SWB/PanelTitleArea_Calc" dimension="Height" /></Dim>
+                </Area>
+                <ColourProperty name="CaptionColour" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Active">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="overdrawn_section">
+                    <ColourProperty name="ActiveColour" />
+                </Section>
+                <Section section="caption" >
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Inactive">
+            <Layer>
+                <Section section="background_section">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="overdrawn_section">
+                    <ColourProperty name="InactiveColour" />
+                </Section>
+                <Section section="caption" >
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_section">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="overdrawn_section" />
+                <Section section="caption" ></Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/FrameWindow
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/FrameWindow">
+        <PropertyDefinition name="ClientAreaColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="TitlebarHeight" initialValue="95" redrawOnWrite="true" />
+        <PropertyDefinition name="BackgroundPictureColour" initialValue="FFBBA075" redrawOnWrite="true"/>
+        <PropertyDefinition name="CloseButtonAlignment" initialValue="1" redrawOnWrite="true"/>
+
+        <PropertyLinkDefinition name="CaptionColour" widget="__auto_titlebar__" targetProperty="CaptionColour" initialValue="FFFFFFFF" />
+        <PropertyLinkDefinition name="TitlebarFont" widget="__auto_titlebar__" targetProperty="Font" />
+
+        <Property name="NSSizingCursorImage" value="SWBCursors/MouseNoSoCursor" />
+        <Property name="EWSizingCursorImage" value="SWBCursors/MouseEsWeCursor" />
+        <Property name="NWSESizingCursorImage" value="SWBCursors/MouseNwSeCursor" />
+        <Property name="NESWSizingCursorImage" value="SWBCursors/MouseNeSwCursor" />
+        <Property name="MinSize" value="{{0.01,0},{0.01,0}}" />
+        <Property name="AutoRenderingSurface" value="True" />
+
+        <NamedArea name="ClientWithTitleWithFrame">
+            <Area>
+                <!--
+                <Dim type="LeftEdge" ><ImageDim name="SWB/WindowCenter_Calc" dimension="LeftEdge" /></Dim>
+                -->
+                <Dim type="LeftEdge" ><AbsoluteDim value="23" /></Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Add">
+                        <WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" />
+                        <OperatorDim op="Subtract">
+                            <!--
+                            <ImageDim name="SWB/WindowCenter_Calc" dimension="TopEdge" />
+                            <ImageDim name="SWB/WindowTopEdge" dimension="TopEdge" />
+                            -->
+                            <AbsoluteDim value="103" />
+                            <AbsoluteDim value="95" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Subtract">
+                            <!--
+                            <ImageDim name="SWB/WindowPanel_Calc" dimension="RightEdge" />
+                            <ImageDim name="SWB/WindowCenter_Calc" dimension="RightEdge" />
+                            -->
+                            <AbsoluteDim value="538" />
+                            <AbsoluteDim value="518" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <OperatorDim op="Subtract">
+                            <!--
+                            <ImageDim name="SWB/WindowPanel_Calc" dimension="BottomEdge" />
+                            <ImageDim name="SWB/WindowCenter_Calc" dimension="BottomEdge" />
+                            -->
+                            <AbsoluteDim value="320" />
+                            <AbsoluteDim value="292" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="ClientWithTitleNoFrame">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="BottomEdge" ><WidgetDim dimension="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="ClientNoTitleWithFrame">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="SWB/WindowCenter_Calc" dimension="LeftEdge" /></Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Add">
+                        <WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" />
+                        <OperatorDim op="Subtract">
+                            <!--
+                            <ImageDim name="SWB/WindowCenter_Calc" dimension="TopEdge" />
+                            <ImageDim name="SWB/WindowTopEdge" dimension="TopEdge" />
+                            -->
+                            <AbsoluteDim value="103" />
+                            <AbsoluteDim value="95" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <!--<ImageDim name="SWB/WindowCenter_Calc" dimension="LeftEdge" />-->
+                        <AbsoluteDim value="23" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <OperatorDim op="Subtract">
+                            <!--
+                            <ImageDim name="SWB/WindowPanel_Calc" dimension="BottomEdge" />
+                            <ImageDim name="SWB/WindowCenter_Calc" dimension="BottomEdge" />
+                            -->
+                            <AbsoluteDim value="320" />
+                            <AbsoluteDim value="292" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        
+        <NamedArea name="ClientNoTitleNoFrame">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+        </NamedArea>
+        
+        <!-- Child objects: Titlebar, close button -->
+        <Child type="SWB/Titlebar" nameSuffix="__auto_titlebar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" >
+                    <PropertyDim name="TitlebarHeight" />
+                </Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="False" />
+        </Child>
+        
+        <Child type="SWB/ImageButton" nameSuffix="__auto_closebutton__">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <OperatorDim op="Add">
+                        <AbsoluteDim value="15" />
+                        <OperatorDim op="Multiply">
+                            <PropertyDim name="CloseButtonAlignment" />
+                            <OperatorDim op="Subtract">
+                                <UnifiedDim scale="1" type="Width" />
+                                <OperatorDim op="Add">
+                                    <AbsoluteDim value="30" />
+                                    <AbsoluteDim value="31" />
+                                </OperatorDim>
+                            </OperatorDim>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="56" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="31" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="31" /></Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="NonClient" value="True" />
+            <Property name="HoverImage" value="SWB/PanelCloseButton_On" />
+            <Property name="PushedImage" value="SWB/PanelCloseButton_On" />
+            <Property name="NormalImage" value="SWB/PanelCloseButton_Off" />
+            <Property name="DisabledImage" value="SWB/PanelCloseButton_Off" />
+            <Property name="Visible" value="True" />
+        </Child>
+
+        <!-- Various imagery sections-->
+        <ImagerySection name="withtitle_frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/WindowTopLeft" />
+                <Image component="TopEdge" name="SWB/WindowTopEdge" />
+                <Image component="TopRightCorner" name="SWB/WindowTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/WindowBottomLeft" />
+                <Image component="Background" name="SWB/WindowMid" />
+                <Image component="BottomRightCorner" name="SWB/WindowBottomRight" />
+                <Image component="LeftEdge" name="SWB/WindowLeftEdge" />
+                <Image component="RightEdge" name="SWB/WindowRightEdge" />
+                <Image component="BottomEdge" name="SWB/WindowBottomEdge" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="notitle_frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/WindowTopLeft" />
+                <Image component="TopRightCorner" name="SWB/WindowTopRight" />
+                <Image component="BottomLeftCorner" name="SWB/WindowBottomLeft" />
+                <Image component="BottomRightCorner" name="SWB/WindowBottomRight" />
+                <Image component="LeftEdge" name="SWB/WindowLeftEdge" />
+                <Image component="RightEdge" name="SWB/WindowRightEdge" />
+                <Image component="BottomEdge" name="SWB/WindowBottomEdge" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="SWB/WindowTopLeft" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="SWB/WindowTopEdge" dimension="Width" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <ImageDim name="SWB/WindowTopRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <ImageDim name="SWB/WindowBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SWB/WindowMid" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="withtitle_noframe_client_area">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="Height" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SWB/WindowMid" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="notitle_noframe_client_area">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="SWB/WindowMid" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="ActiveWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="InactiveWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="DisabledWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="ActiveWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="InactiveWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="DisabledWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="ActiveNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="InactiveNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame">
+                    <ColourProperty name="BackgroundPictureColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="DisabledNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="ActiveNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="InactiveNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="DisabledNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/GroupBox
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/GroupBox">
+        <!-- TODO: next property is ignored ATM. Re-investigate appropriateness. -->
+        <!--<PropertyDefinition name="BackgroundTextColours" initialValue="tl:00000000 tr:00000000 bl:00000000 br:00000000" redrawOnWrite="true" />-->
+  	    <PropertyDefinition name="DisabledTextColour" initialValue="FF888888" redrawOnWrite="true" />
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="TextBackground" initialValue="FF888888" redrawOnWrite="true" />
+        <PropertyDefinition name="CaptionOffset" initialValue="10" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+
+        <Child type="DefaultWindow" nameSuffix="__auto_contentpane__">
+            <Area>
+                <Dim type="LeftEdge">
+                    <AbsoluteDim value="8" />
+                </Dim>
+                <Dim type="TopEdge">
+                    <AbsoluteDim value="20" />
+                </Dim>
+                <Dim type="RightEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" offset="0" type="RightEdge" />
+                        <AbsoluteDim value="8" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" offset="0" type="BottomEdge" />
+                        <AbsoluteDim value="8" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <OperatorDim op="Add">
+                            <AbsoluteDim value="11" />
+                            <PropertyDim name="CaptionOffset" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <AbsoluteDim value="3" />
+                    </Dim>
+                    <Dim type="RightEdge">
+                        <UnifiedDim scale="1" offset="0" type="RightEdge" />
+                    </Dim>
+                    <Dim type="BottomEdge">
+                        <UnifiedDim scale="1" offset="0" type="BottomEdge" />
+                    </Dim>
+                </Area>
+                <VertFormat type="TopAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <AbsoluteDim value="11" />
+                    </Dim>
+                    <Dim type="RightEdge">
+                        <UnifiedDim scale="1" offset="0" type="RightEdge" />
+                    </Dim>
+                    <Dim type="BottomEdge">
+                        <UnifiedDim scale="1" offset="0" type="BottomEdge" />
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Static_TL" />
+                <Image component="LeftEdge" name="SWB/Static_L" />
+                <Image component="BottomLeftCorner" name="SWB/Static_BL" />
+                <Image component="TopEdge" name="SWB/Static_T" />
+                <Image component="BottomEdge" name="SWB/Static_B" />
+                <Image component="TopRightCorner" name="SWB/Static_TR" />
+                <Image component="RightEdge" name="SWB/Static_R" />
+                <Image component="BottomRightCorner" name="SWB/Static_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="label_bg">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <OperatorDim op="Add">
+                            <AbsoluteDim value="5" />
+                            <PropertyDim name="CaptionOffset" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="TopEdge" >
+                        <AbsoluteDim value="0" />
+                    </Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Add">
+                            <FontDim type="HorzExtent" padding="5" />
+                            <AbsoluteDim value="8" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Add">
+                            <FontDim type="LineSpacing" />
+                            <AbsoluteDim value="6" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/FilledRoundedBorder_TL" />
+                <Image component="LeftEdge" name="SWB/FilledRoundedBorder_L" />
+                <Image component="BottomLeftCorner" name="SWB/FilledRoundedBorder_BL" />
+                <Image component="TopEdge" name="SWB/FilledRoundedBorder_T" />
+                <Image component="Background" name="SWB/FilledRoundedBorder_M" />
+                <Image component="BottomEdge" name="SWB/FilledRoundedBorder_B" />
+                <Image component="TopRightCorner" name="SWB/FilledRoundedBorder_TR" />
+                <Image component="RightEdge" name="SWB/FilledRoundedBorder_R" />
+                <Image component="BottomRightCorner" name="SWB/FilledRoundedBorder_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="label_bg">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame" />
+                <Section section="label_bg" />
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/BackgroundButton
+        (based on the Image button  Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/BackgroundButton">
+        <PropertyDefinition name="Image" initialValue="SWB/EmptyGlyph24" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BackgroundColour" initialValue="11FFFFFF" redrawOnWrite="true" type="Colour" />
+        <PropertyDefinition name="BackgroundHighlightColour" initialValue="FFFFFFFF" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+        <PropertyDefinition name="BorderColourHover" initialValue="FFCCB078" />
+        
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Rounded_Square_Small_TL" />
+                <Image component="LeftEdge" name="SWB/Rounded_Square_Small_L" />
+                <Image component="BottomLeftCorner" name="SWB/Rounded_Square_Small_BL" />
+                <Image component="TopEdge" name="SWB/Rounded_Square_Small_T" />
+                <Image component="Background" name="SWB/Rounded_Square_Small_M" />
+                <Image component="BottomEdge" name="SWB/Rounded_Square_Small_B" />
+                <Image component="TopRightCorner" name="SWB/Rounded_Square_Small_TR" />
+                <Image component="RightEdge" name="SWB/Rounded_Square_Small_R" />
+                <Image component="BottomRightCorner" name="SWB/Rounded_Square_Small_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="glyph">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <ImageDim name="SWB/Rounded_Square_Small_Calc_L" dimension="Width" />
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <ImageDim name="SWB/Rounded_Square_Small_Calc_T" dimension="Height" />
+                    </Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_Calc_L" dimension="Width" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_Calc_T" dimension="Height" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <ImageProperty name="Image" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <ImageDim name="SWB/Rounded_Square_Small_Calc_L" dimension="Width" />
+                    </Dim>
+                    <Dim type="TopEdge">
+                        <ImageDim name="SWB/Rounded_Square_Small_Calc_T" dimension="Height" />
+                    </Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_Calc_L" dimension="Width" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="SWB/Rounded_Square_Small_Calc_T" dimension="Height" />
+                                <AbsoluteDim value="2" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/Button_Background_TL" />
+                <Image component="LeftEdge" name="SWB/Button_Background_L" />
+                <Image component="BottomLeftCorner" name="SWB/Button_Background_BL" />
+                <Image component="TopEdge" name="SWB/Button_Background_T" />
+                <Image component="Background" name="SWB/Button_Background_M" />
+                <Image component="BottomEdge" name="SWB/Button_Background_B" />
+                <Image component="TopRightCorner" name="SWB/Button_Background_TR" />
+                <Image component="RightEdge" name="SWB/Button_Background_R" />
+                <Image component="BottomRightCorner" name="SWB/Button_Background_BR" />
+
+            </FrameComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="hover">
+                    <ColourProperty name="BackgroundColour" />
+                </Section>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+        
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover">
+                    <ColourProperty name="BackgroundHighlightColour" />
+                </Section>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColourHover" />
+                </Section>
+                <Section section="glyph" />
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="glyph" />
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="glyph" />
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="glyph" />
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SWB/ProgressBar
+        (based on the Taharez Look)
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/ProgressBar">
+        <PropertyDefinition name="BarSegmentMode" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="BorderColour" initialValue="FFBBA075" />
+        
+        <PropertyDefinition name="GS_DarkerThemeColour" initialValue="FFAC4F4F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_LighterThemeColour" initialValue="FFFF0101" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeColour" initialValue="FFDC5F5F" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_ShineColour" initialValue="B0FFFFFF" redrawOnWrite="true" />
+        <PropertyDefinition name="GS_MainThemeGradientLeftToRight" initialValue="tl:00FFFFFF tr:FFFF0101 bl:00FFFFFF br:FFFF0101" type="ColourRect" redrawOnWrite="true" />
+        
+        <NamedArea name="ProgressArea">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <ImageDim name="SWB/ProgressBar_Non_Fill_Calc" dimension="Width" />
+                </Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="SWB/ProgressBar_Non_Fill_Calc" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+        </NamedArea>
+        
+        <ImagerySection name="border_section">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ProgressBar_HD_TL" />
+                <Image component="LeftEdge" name="SWB/ProgressBar_HD_L" />
+                <Image component="BottomLeftCorner" name="SWB/ProgressBar_HD_BL" />
+                <Image component="TopEdge" name="SWB/ProgressBar_HD_T" />
+                <Image component="Background" name="SWB/ProgressBar_HD_M" />
+                <Image component="BottomEdge" name="SWB/ProgressBar_HD_B" />
+                <Image component="TopRightCorner" name="SWB/ProgressBar_HD_TR" />
+                <Image component="RightEdge" name="SWB/ProgressBar_HD_R" />
+                <Image component="BottomRightCorner" name="SWB/ProgressBar_HD_BR" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="border_section_redux">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" offset="0" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ProgressBar_HD_TL_Redux" />
+                <Image component="LeftEdge" name="SWB/ProgressBar_HD_L_Redux" />
+                <Image component="BottomLeftCorner" name="SWB/ProgressBar_HD_BL_Redux" />
+                <Image component="TopEdge" name="SWB/ProgressBar_HD_T" />
+                <Image component="Background" name="SWB/ProgressBar_HD_M" />
+                <Image component="BottomEdge" name="SWB/ProgressBar_HD_B" />
+                <Image component="TopRightCorner" name="SWB/ProgressBar_HD_TR_Redux" />
+                <Image component="RightEdge" name="SWB/ProgressBar_HD_R_Redux" />
+                <Image component="BottomRightCorner" name="SWB/ProgressBar_HD_BR_Redux" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_highlight">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="0" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="0" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ProgressBar_Bck_TL" />
+                <Image component="LeftEdge" name="SWB/ProgressBar_Bck_L" />
+                <Image component="BottomLeftCorner" name="SWB/ProgressBar_Bck_BL" />
+                <Image component="TopEdge" name="SWB/ProgressBar_Bck_T" />
+                <Image component="Background" name="SWB/ProgressBar_Bck_M" />
+                <Image component="BottomEdge" name="SWB/ProgressBar_Bck_B" />
+                <Image component="TopRightCorner" name="SWB/ProgressBar_Bck_TR" />
+                <Image component="RightEdge" name="SWB/ProgressBar_Bck_R" />
+                <Image component="BottomRightCorner" name="SWB/ProgressBar_Bck_BR" />
+            </FrameComponent>
+        </ImagerySection>
+
+        <ImagerySection name="background_highlight_redux">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> <!-- 10 - 6 -->
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <AbsoluteDim value="0" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <AbsoluteDim value="0" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="SWB/ProgressBar_Bck_TL_Redux" />
+                <Image component="LeftEdge" name="SWB/ProgressBar_Bck_L_Redux" />
+                <Image component="BottomLeftCorner" name="SWB/ProgressBar_Bck_BL_Redux" />
+                <Image component="TopEdge" name="SWB/ProgressBar_Bck_T" />
+                <Image component="Background" name="SWB/ProgressBar_Bck_M" />
+                <Image component="BottomEdge" name="SWB/ProgressBar_Bck_B" />
+                <Image component="TopRightCorner" name="SWB/ProgressBar_Bck_TR_Redux" />
+                <Image component="RightEdge" name="SWB/ProgressBar_Bck_R_Redux" />
+                <Image component="BottomRightCorner" name="SWB/ProgressBar_Bck_BR_Redux" />
+            </FrameComponent>
+        </ImagerySection>
+        
+        <ImagerySection name="progress_lights" >
+            <ImageryComponent>
+                <Area>
+                    <!-- Make sure not to start displaying the background filling image at the edges (left-right), 
+                    as the border displayed on top of it may start at 1-2, depending on the scale -->
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" offset="0" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="SWB/ProgressBarGraySegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormatProperty name="BarSegmentMode" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <ImagerySection name="progress_lights_leading" >
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" >
+                        <OperatorDim op="Add">
+                            <AbsoluteDim value="0" />
+                            <OperatorDim op="Multiply">
+                                <PropertyDim name="CurrentProgress" />
+                                <UnifiedDim scale="1" type="Width" offset="0" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="SWB/ProgressBarLitSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+                <Section section="border_section">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="background_highlight">
+                    <ColourProperty name="GS_ShineColour" />
+                </Section>
+            </Layer>
+            <Layer>
+                <Section section="border_section">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+
+
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress_lights" >
+                    <ColourRectProperty name="GS_MainThemeGradientLeftToRight" />
+                </Section>
+                <Section section="progress_lights" >
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+                <Section section="background_highlight_redux">
+                    <ColourProperty name="GS_DarkerThemeColour" />
+                </Section>
+                <Section section="progress_lights_leading" >
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+                <Section section="border_section_redux">
+                    <ColourProperty name="BorderColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+
+
+
+        <StateImagery name="DisabledProgress">
+            <Layer>
+                <Section section="progress_lights">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="progress_lights" >
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="background_highlight_redux">
+                    <ColourProperty name="GS_MainThemeColour" />
+                </Section>
+                <Section section="progress_lights_leading" >
+                    <ColourProperty name="GS_LighterThemeColour" />
+                </Section>
+                <Section section="border_section_redux">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SWB/TimerProgressBar
+    ***************************************************
+    -->
+    <WidgetLook name="SWB/TimerProgressBar">
+        <NamedArea name="ProgressArea">
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+        </NamedArea>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="progress_lights" >
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="SWB/ProgressBarTimerSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress_lights" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledProgress">
+            <Layer>
+                <Section section="progress_lights">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+            
+</Falagard>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/looknfeel/SumWarsExtras.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,586 @@
+<Falagard version="7">
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HPProgressOrbHighlight
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HPProgressOrbHighlight">
+        <PropertyDefinition name="NormalImage" initialValue="ControlPanel/HPHighlight" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HighlightModifier" initialValue="0" redrawOnWrite="true" />
+        
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal"><ColourProperty name="HighlightModifier" /></Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="normal"><ColourProperty name="HighlightModifier" /></Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal"><ColourProperty name="HighlightModifier" /></Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="normal"><ColourProperty name="HighlightModifier" /></Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal"><ColourProperty name="HighlightModifier" /></Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HPProgressBar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HPProgressBar">
+        <PropertyLinkDefinition name="HighlightModifier" widget="__auto_orb_highlight__" targetProperty="HighlightModifier" initialValue="FFBBA075" redrawOnWrite="true" />
+        <!--<PropertyDefinition name="HighlightRotation" initialValue="0" redrawOnWrite="true" />-->
+        <!--<PropertyLinkDefinition name="HighlightRotation" widget="__auto_orb_highlight__" targetProperty="ZRotation" initialValue="0" />-->
+
+        <NamedArea name="ProgressArea">
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+        </NamedArea>
+
+        <Child type="SumWarsExtras/HPProgressOrbHighlight" nameSuffix="__auto_orb_highlight__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-10" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-10" type="Height" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+
+        <ImagerySection name="background">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="ControlPanel/HPBackground" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>   
+        <ImagerySection name="progress" >
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <Image name="ControlPanel/HPForeground" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="background">
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress">
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled" />
+        <StateImagery name="DisabledProgress" />
+    </WidgetLook>
+
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/ScrollablePaneNoBar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/ScrollablePaneNoBar">
+        <NamedArea name="ViewableArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="0" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="0" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="SumWarsExtras/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="0" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HorizontalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HorizontalScrollbarThumb">
+        <Property name="HorzFree" value="True" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SumWarsExtras/MiniHorzScrollThumbLeftNormal" />
+                <Image component="RightEdge" name="SumWarsExtras/MiniHorzScrollThumbRightNormal" />
+                <Image component="Background" name="SumWarsExtras/MiniHorzScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="LeftEdge" name="SumWarsExtras/MiniHorzScrollThumbLeftHover" />
+                <Image component="RightEdge" name="SumWarsExtras/MiniHorzScrollThumbRightHover" />
+                <Image component="Background" name="SumWarsExtras/MiniHorzScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/HorizontalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/HorizontalScrollbar">
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="RightEdge" />
+                        <AbsoluteDim value="9" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="SumWarsExtras/MiniHorzScrollRightNormal" />
+            <Property name="HoverImage" value="SumWarsExtras/MiniHorzScrollRightHover" />
+            <Property name="PushedImage" value="SumWarsExtras/MiniHorzScrollRightNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="SumWarsExtras/MiniHorzScrollLeftNormal" />
+            <Property name="HoverImage" value="SumWarsExtras/MiniHorzScrollLeftHover" />
+            <Property name="PushedImage" value="SumWarsExtras/MiniHorzScrollLeftNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,25},{0,0}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="9" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="RightEdge" />
+                            <AbsoluteDim value="9" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="SumWarsExtras/MiniHorzScrollBarSegment" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/VerticalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/VerticalScrollbarThumb">
+        <Property name="VertFree" value="True" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="TopEdge" name="SumWarsExtras/MiniVertScrollThumbTopNormal" />
+                <Image component="BottomEdge" name="SumWarsExtras/MiniVertScrollThumbBottomNormal" />
+                <Image component="Background" name="SumWarsExtras/MiniVertScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
+                </Area>
+                <Image component="TopEdge" name="SumWarsExtras/MiniVertScrollThumbTopHover" />
+                <Image component="BottomEdge" name="SumWarsExtras/MiniVertScrollThumbBottomHover" />
+                <Image component="Background" name="SumWarsExtras/MiniVertScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        SumWarsExtras/VerticalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/VerticalScrollbar">
+        <Property name="VerticalScrollbar" value="True" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="9" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="BottomEdge" />
+                        <AbsoluteDim value="9" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="9" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NormalImage" value="SumWarsExtras/MiniVertScrollDownNormal" />
+            <Property name="HoverImage" value="SumWarsExtras/MiniVertScrollDownHover" />
+            <Property name="PushedImage" value="SumWarsExtras/MiniVertScrollDownNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="9" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="SumWarsExtras/MiniVertScrollUpNormal" />
+            <Property name="HoverImage" value="SumWarsExtras/MiniVertScrollUpHover" />
+            <Property name="PushedImage" value="SumWarsExtras/MiniVertScrollUpNormal" />
+        </Child>
+        <Child  type="SumWarsExtras/VerticalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.1" type="Height" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,0},{0,25}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="9" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="BottomEdge" />
+                            <AbsoluteDim value="9" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="SumWarsExtras/MiniVertScrollBarSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="CentreAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        SumWarsExtras/ImageButton
+    ***************************************************
+    -->
+    <WidgetLook name="SumWarsExtras/ImageButton">
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
+        
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="pushed">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="PushedImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="disabled">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <ImageProperty name="DisabledImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+</Falagard>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/looknfeel/TaharezLook.looknfeel	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,4154 @@
+<?xml version="1.0" ?>
+<Falagard version="7">
+    <!--
+    ***************************************************
+        TaharezLook/Label
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Label">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="Colour" />
+        <PropertyDefinition name="DisabledTextColour" initialValue="FFDDDDDD" redrawOnWrite="true" type="Colour" />
+        <PropertyDefinition name="VertFormatting" initialValue="CentreAligned" redrawOnWrite="true" type="VerticalTextFormatting" />
+        <PropertyDefinition name="HorzFormatting" initialValue="CentreAligned" redrawOnWrite="true" type="HorizontalTextFormatting" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <ImagerySection name="Label">
+            <TextComponent>
+                <Area>
+	            <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+	            <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
+	            <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
+	            <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
+                </Area>
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="Label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="Label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Button
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Button">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" type="VerticalTextFormatting"/>
+        <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" type="HorizontalTextFormatting"/>
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true"  type="Image"/>
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" type="VerticalFormatting" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" type="HorizontalFormatting" />  
+        <Property name="Size" value="{{0, 96}, {0, 32}}" />
+        <ImagerySection name="label">
+            <TextComponent>
+                <VertFormatProperty name="VertLabelFormatting" />
+                <HorzFormatProperty name="HorzLabelFormatting" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/ButtonRightNormal" />
+                <Image component="Background" name="TaharezLook/ButtonMiddleNormal" />
+            </FrameComponent>
+            <ImageryComponent>
+                <ImageProperty name="NormalImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ButtonLeftHighlight" />
+                <Image component="RightEdge" name="TaharezLook/ButtonRightHighlight" />
+                <Image component="Background" name="TaharezLook/ButtonMiddleHighlight" />
+            </FrameComponent>
+            <ImageryComponent>
+                <ImageProperty name="HoverImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="pushed">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ButtonLeftPushed" />
+                <Image component="RightEdge" name="TaharezLook/ButtonRightPushed" />
+                <Image component="Background" name="TaharezLook/ButtonMiddlePushed" />
+            </FrameComponent>
+            <ImageryComponent>
+                <ImageProperty name="PushedImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="disabled">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/ButtonRightNormal" />
+                <Image component="Background" name="TaharezLook/ButtonMiddleNormal" />
+            </FrameComponent>
+            <ImageryComponent>
+                <ImageProperty name="DisabledImage" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/RadioButton
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/RadioButton">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="Size" value="{{0, 256}, {0, 32}}" />
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/RadioButtonNormal" dimension="Width"/>
+                            <AbsoluteDim value="3" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Image name="TaharezLook/RadioButtonNormal" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Image name="TaharezLook/RadioButtonHover" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="select_mark">
+            <ImageryComponent>
+                <Image name="TaharezLook/RadioButtonMark" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedNormal">
+            <Layer>
+                <Section section="normal" />
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedHover">
+            <Layer>
+                <Section section="hover" />
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="select_mark">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Checkbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Checkbox">
+	    <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/CheckboxNormal" dimension="Width"/>
+                            <AbsoluteDim value="3" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Image name="TaharezLook/CheckboxNormal" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Image name="TaharezLook/CheckboxHover" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="select_mark">
+            <ImageryComponent>
+                <Image name="TaharezLook/CheckboxMark" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedNormal">
+            <Layer>
+                <Section section="normal" />
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedHover">
+            <Layer>
+                <Section section="hover" />
+                <Section section="select_mark" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="select_mark">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Editbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Editbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="MouseCursorImage" value="TaharezLook/MouseTextBar" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="container_normal">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/EditBoxLeft" />
+                <Image component="RightEdge" name="TaharezLook/EditBoxRight" />
+                <Image component="Background" name="TaharezLook/EditBoxMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="TaharezLook/TextSelectionBrush" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                    <Dim type="Width" ><ImageDim name="TaharezLook/EditBoxCaret" dimension="Width" /></Dim>
+                    <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
+                </Area>
+                <Image name="TaharezLook/EditBoxCaret" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="container_normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="container_normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="container_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveSelection">
+            <Layer>
+                <Section section="selection">
+                    <ColourProperty name="ActiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveSelection">
+            <Layer>
+                <Section section="selection">
+                    <ColourProperty name="InactiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Titlebar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Titlebar">
+        <PropertyDefinition name="CaptionColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="NonClient" value="True" />
+        <Property name="Size" value="{{0, 256}, {0, 32}}" />
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Image name="TaharezLook/NewTitlebarLeft" />
+                <VertFormat type="Stretched" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge"/>
+                            <OperatorDim op="Add">
+                                <ImageDim name="TaharezLook/SysAreaRight" dimension="Width"/>
+                                <ImageDim name="TaharezLook/SysAreaMiddle" dimension="Width" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/NewTitlebarRight" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge"/>
+                            <ImageDim name="TaharezLook/SysAreaRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/SysAreaMiddle" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Image name="TaharezLook/SysAreaRight" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/NewTitlebarLeft" dimension="Width" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <OperatorDim op="Subtract">
+                                <OperatorDim op="Subtract">
+                                    <UnifiedDim scale="1" type="RightEdge"/>
+                                    <ImageDim name="TaharezLook/SysAreaRight" dimension="Width"/>
+                                </OperatorDim>
+                                <ImageDim name="TaharezLook/SysAreaMiddle" dimension="Width"/>
+                            </OperatorDim>
+                            <ImageDim name="TaharezLook/NewTitlebarRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/NewTitlebarMiddle" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="caption">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/NewTitlebarLeft" dimension="Width" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1" offset="-75" type="Width" /></Dim>
+                </Area>
+                <ColourProperty name="CaptionColour" />
+                <VertFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Active">
+            <Layer>
+                <Section section="main" />
+                <Section section="caption" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Inactive">
+            <Layer>
+                <Section section="main" />
+                <Section section="caption" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="caption">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/FrameWindow
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/FrameWindow">
+        <PropertyDefinition name="ClientAreaColour" initialValue="FF141B38" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyLinkDefinition name="CaptionColour" widget="__auto_titlebar__" targetProperty="CaptionColour" initialValue="FFFFFFFF" type="ColourRect"/>
+        <PropertyLinkDefinition name="TitlebarFont" widget="__auto_titlebar__" targetProperty="Font" type="Font"/>
+        <Property name="NSSizingCursorImage" value="TaharezLook/MouseNoSoCursor" />
+        <Property name="EWSizingCursorImage" value="TaharezLook/MouseEsWeCursor" />
+        <Property name="NWSESizingCursorImage" value="TaharezLook/MouseNwSeCursor" />
+        <Property name="NESWSizingCursorImage" value="TaharezLook/MouseNeSwCursor" />
+        <Property name="MinSize" value="{{0.1,0},{0.1,0}}" />
+        <Property name="AutoRenderingSurface" value="True" />
+        <Property name="Size" value="{{0.3, 0}, {0.3, 0}}" />
+        <NamedArea name="ClientWithTitleWithFrame">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/WindowTopLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/WindowTopRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/WindowBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ClientWithTitleNoFrame">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="BottomEdge" ><WidgetDim dimension="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ClientNoTitleWithFrame">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/WindowTopLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/WindowTopEdge" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/WindowTopRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/WindowBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ClientNoTitleNoFrame" />
+        <Child type="TaharezLook/Titlebar" nameSuffix="__auto_titlebar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
+                <Dim type="Height" ><FontDim type="LineSpacing" padding="8" /></Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="False" />
+        </Child>
+        <Child type="TaharezLook/ImageButton" nameSuffix="__auto_closebutton__">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <OperatorDim op="Subtract">
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="LeftEdge"/>
+                            <ImageDim name="TaharezLook/SysAreaRight" dimension="Width"/>
+                        </OperatorDim>
+                        <ImageDim name="TaharezLook/SysAreaMiddle" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Multiply">
+                        <OperatorDim op="Subtract">
+                            <WidgetDim widget="__auto_titlebar__" dimension="Height" />
+                            <ImageDim name="TaharezLook/NewCloseButtonNormal" dimension="Width" />
+                        </OperatorDim>
+                        <AbsoluteDim value="0.5" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Width" ><ImageDim name="TaharezLook/NewCloseButtonNormal" dimension="Width" /></Dim>
+                <Dim type="Height" ><ImageDim name="TaharezLook/NewCloseButtonNormal" dimension="Width" /></Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="NormalImage" value="TaharezLook/NewCloseButtonNormal" />
+            <Property name="HoverImage" value="TaharezLook/NewCloseButtonHover" />
+            <Property name="PushedImage" value="TaharezLook/NewCloseButtonPressed" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <ImagerySection name="withtitle_frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                </Area>
+                <Image component="BottomLeftCorner" name="TaharezLook/WindowBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/WindowBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/WindowLeftEdge" />
+                <Image component="RightEdge" name="TaharezLook/WindowRightEdge" />
+                <Image component="BottomEdge" name="TaharezLook/WindowBottomEdge" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/WindowTopLeft" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <ImageDim name="TaharezLook/WindowTopRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <ImageDim name="TaharezLook/WindowBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/GenericBrush" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="notitle_frame">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/WindowTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/WindowTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/WindowBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/WindowBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/WindowLeftEdge" />
+                <Image component="RightEdge" name="TaharezLook/WindowRightEdge" />
+                <Image component="BottomEdge" name="TaharezLook/WindowBottomEdge" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/WindowTopLeft" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="TaharezLook/WindowTopEdge" dimension="Width" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <ImageDim name="TaharezLook/WindowTopRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <ImageDim name="TaharezLook/WindowBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/GenericBrush" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="withtitle_noframe_client_area">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/GenericBrush" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="notitle_noframe_client_area">
+            <ImageryComponent>
+                <Image name="TaharezLook/GenericBrush" />
+                <ColourProperty name="ClientAreaColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="ActiveWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledWithTitleWithFrame">
+            <Layer>
+                <Section section="withtitle_frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledWithTitleNoFrame">
+            <Layer>
+                <Section section="withtitle_noframe_client_area">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledNoTitleWithFrame">
+            <Layer>
+                <Section section="notitle_frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledNoTitleNoFrame">
+            <Layer>
+                <Section section="notitle_noframe_client_area">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/GroupBox (DefaultWindow)
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/GroupBox">
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFDFDFDF tr:FFDFDFDF bl:FFDFDFDF br:FFDFDFDF" redrawOnWrite="true" type="ColourRect"/>
+
+        <PropertyDefinition name="BackgroundTextColours" initialValue="tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" redrawOnWrite="true" type="ColourRect"/>
+
+	    <PropertyDefinition name="DisabledTextColour" initialValue="FF888888" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="TextBackground" initialValue="FF888888" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="Size" value="{{0.3, 0}, {0.3, 0}}" />
+        <NamedArea name="inner_rect" >
+            <Area>
+                <Dim type="LeftEdge">
+                    <AbsoluteDim value="8" />
+                </Dim>
+                <Dim type="TopEdge">
+                    <AbsoluteDim value="20" />
+                </Dim>
+                <Dim type="RightEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" offset="0" type="RightEdge" />
+                        <AbsoluteDim value="8" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" offset="0" type="BottomEdge" />
+                        <AbsoluteDim value="8" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <AbsoluteDim value="15" />
+                    </Dim>
+                </Area>
+                <VertFormat type="TopAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge">
+                        <AbsoluteDim value="11" />
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="TaharezLook/StaticTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/StaticTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/StaticBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/StaticBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/StaticLeft" />
+                <Image component="TopEdge" name="TaharezLook/StaticTop" />
+                <Image component="RightEdge" name="TaharezLook/StaticRight" />
+                <Image component="BottomEdge" name="TaharezLook/StaticBottom" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="label_bg">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <AbsoluteDim value="13" />
+                    </Dim>
+                    <Dim type="Width" >
+                        <FontDim type="HorzExtent" padding="5" />
+                    </Dim>
+                    <Dim type="Height" >
+                        <FontDim type="LineSpacing" />
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/StaticBackdrop" />
+                <ColourRectProperty name="BackgroundTextColours" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame" />
+                <Section section="label_bg" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame" />
+                    <Section section="label_bg" />
+                    <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ProgressBar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ProgressBar">
+        <Property name="Size" value="{{0, 256}, {0, 32}}" />
+        <NamedArea name="ProgressArea">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <OperatorDim op="Divide">
+                        <ImageDim name="TaharezLook/ProgressBarLeft" dimension="Width" />
+                        <AbsoluteDim value="2" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/ProgressBarRight" dimension="Width"/>
+                            <AbsoluteDim value="2" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ProgressBarLeft" />
+                <Image component="RightEdge" name="TaharezLook/ProgressBarRight" />
+                <Image component="Background" name="TaharezLook/ProgressBarMiddle" />
+                <HorzFormat type="Tiled" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="progress_lights" >
+            <ImageryComponent>
+                <Image name="TaharezLook/ProgressBarLitSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress_lights" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledProgress">
+            <Layer>
+                <Section section="progress_lights">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/AlternateProgressBar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/AltProgressBar">
+        <Property name="Size" value="{{0, 256}, {0, 32}}" />
+        <NamedArea name="ProgressArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/AltProgressLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="2" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/AltProgressRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-4" type="Height" /></Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/AltProgressLeft" />
+                <Image component="RightEdge" name="TaharezLook/AltProgressRight" />
+                <Image component="Background" name="TaharezLook/AltProgressMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="progress_lights" >
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight1" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.1" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight2" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.2" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight3" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.3" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight4" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.4" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight5" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.5" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight6" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.6" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight7" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.7" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight8" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.8" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight9" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.9" type="LeftEdge" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/AltProgressLight10" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Tiled" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress_lights" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledProgress">
+            <Layer>
+                <Section section="progress_lights">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/VUMeter (progress bar)
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/VUMeter">
+        <Property name="VerticalProgress" value="True" />
+        <Property name="Size" value="{{0, 16}, {0, 256}}" />
+        <NamedArea name="ProgressArea" />
+        <ImagerySection name="progress_lights" >
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/TextSelectionBrush" />
+                <Colours topLeft="FF00FF00" topRight="FF00FF00" bottomLeft="FF00FF00" bottomRight="FF00FF00" />
+                <VertFormat type="Tiled" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge" ><UnifiedDim scale="0.2" type="TopEdge" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="0.3" type="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/TextSelectionBrush" />
+                <Colours topLeft="FFFFFF00" topRight="FFFFFF00" bottomLeft="FFFFFF00" bottomRight="FFFFFF00" />
+                <VertFormat type="Tiled" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge" ><UnifiedDim scale="0" type="TopEdge" /></Dim>
+                    <Dim type="Height" ><UnifiedDim scale="0.2" type="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/TextSelectionBrush" />
+                <Colours topLeft="FFFF0000" topRight="FFFF0000" bottomLeft="FFFF0000" bottomRight="FFFF0000" />
+                <VertFormat type="Tiled" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+        </StateImagery>
+        <StateImagery name="Disabled">
+        </StateImagery>
+        <StateImagery name="EnabledProgress">
+            <Layer>
+                <Section section="progress_lights" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledProgress">
+            <Layer>
+                <Section section="progress_lights">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/SliderThumb
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/SliderThumb">
+        <Property name="VertFree" value="True" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Image name="TaharezLook/VertSliderThumbNormal" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Image name="TaharezLook/VertSliderThumbHover" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Slider
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Slider">
+        <Property name="VerticalSlider" value="True" />
+        <Property name="MouseAutoRepeatEnabled" value="True" />
+        <Property name="WantsMultiClickEvents" value="False" />
+        <Property name="Size" value="{{0, 16}, {0, 256}}" />
+        <NamedArea name="ThumbTrackArea" />
+        <Child  type="TaharezLook/SliderThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="Height" ><ImageDim name="TaharezLook/VertSliderThumbNormal" dimension="Height" /></Dim>
+            </Area>
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" ><UnifiedDim scale="1.0" offset="-6" type="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/VertSliderBody" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/HorizontalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/HorizontalScrollbarThumb">
+        <Property name="HorzFree" value="True" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 48}, {0, 16}}" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/MiniHorzScrollThumbLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/MiniHorzScrollThumbRightNormal" />
+                <Image component="Background" name="TaharezLook/MiniHorzScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/MiniHorzScrollThumbLeftHover" />
+                <Image component="RightEdge" name="TaharezLook/MiniHorzScrollThumbRightHover" />
+                <Image component="Background" name="TaharezLook/MiniHorzScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/HorizontalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/HorizontalScrollbar">
+        <Property name="Size" value="{{1, 0}, {0, 16}}" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="RightEdge" />
+                        <ImageDim name="TaharezLook/MiniHorzScrollRightNormal" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="Width" ><ImageDim name="TaharezLook/MiniHorzScrollRightNormal" dimension="Width" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="TaharezLook/MiniHorzScrollRightNormal" />
+            <Property name="HoverImage" value="TaharezLook/MiniHorzScrollRightHover" />
+            <Property name="PushedImage" value="TaharezLook/MiniHorzScrollRightNormal" />
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="Width" ><ImageDim name="TaharezLook/MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="TaharezLook/MiniHorzScrollLeftNormal" />
+            <Property name="HoverImage" value="TaharezLook/MiniHorzScrollLeftHover" />
+            <Property name="PushedImage" value="TaharezLook/MiniHorzScrollLeftNormal" />
+        </Child>
+        <Child  type="TaharezLook/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,25},{0,0}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="RightEdge" />
+                            <ImageDim name="TaharezLook/MiniHorzScrollRightNormal" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/MiniHorzScrollBarSegment" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/VerticalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/VerticalScrollbarThumb">
+        <Property name="VertFree" value="True" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 16}, {0, 48}}" />
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Image component="TopEdge" name="TaharezLook/MiniVertScrollThumbTopNormal" />
+                <Image component="BottomEdge" name="TaharezLook/MiniVertScrollThumbBottomNormal" />
+                <Image component="Background" name="TaharezLook/MiniVertScrollThumbMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <FrameComponent>
+                <Image component="TopEdge" name="TaharezLook/MiniVertScrollThumbTopHover" />
+                <Image component="BottomEdge" name="TaharezLook/MiniVertScrollThumbBottomHover" />
+                <Image component="Background" name="TaharezLook/MiniVertScrollThumbMiddleHover" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/VerticalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/VerticalScrollbar">
+        <Property name="VerticalScrollbar" value="True" />
+        <Property name="Size" value="{{0, 16}, {1, 0}}" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/MiniVertScrollUpNormal" dimension="Height" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/MiniVertScrollDownNormal" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="Height" ><ImageDim name="TaharezLook/MiniVertScrollDownNormal" dimension="Height" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NormalImage" value="TaharezLook/MiniVertScrollDownNormal" />
+            <Property name="HoverImage" value="TaharezLook/MiniVertScrollDownHover" />
+            <Property name="PushedImage" value="TaharezLook/MiniVertScrollDownNormal" />
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="Height" ><ImageDim name="TaharezLook/MiniVertScrollUpNormal" dimension="Height" /></Dim>
+            </Area>
+            <Property name="NormalImage" value="TaharezLook/MiniVertScrollUpNormal" />
+            <Property name="HoverImage" value="TaharezLook/MiniVertScrollUpHover" />
+            <Property name="PushedImage" value="TaharezLook/MiniVertScrollUpNormal" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="Height" ><UnifiedDim scale="0.1" type="Height" /></Dim>
+            </Area>
+            <Property name="MinSize" value="{{0,0},{0,25}}" />
+        </Child>
+        <ImagerySection name="main">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="TopEdge" ><ImageDim name="TaharezLook/MiniVertScrollUpNormal" dimension="Height" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="BottomEdge" />
+                            <ImageDim name="TaharezLook/MiniVertScrollDownNormal" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/MiniVertScrollBarSegment" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="CentreAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Listbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Listbox">
+        <Property name="Size" value="{{0, 256}, {0, 256}}" />
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/ListboxTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/ListboxTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/ListboxBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/ListboxBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/ListboxLeft" />
+                <Image component="RightEdge" name="TaharezLook/ListboxRight" />
+                <Image component="TopEdge" name="TaharezLook/ListboxTop" />
+                <Image component="BottomEdge" name="TaharezLook/ListboxBottom" />
+                <Image component="Background" name="TaharezLook/ListboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ComboDropList
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ComboDropList">
+        <Property name="Size" value="{{0, 256}, {0, 256}}" />
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ComboboxListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ComboboxListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ComboboxListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ComboboxListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ComboboxListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ComboboxListTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/ComboboxListTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/ComboboxListTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/ComboboxListBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/ComboboxListBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/ComboboxListLeft" />
+                <Image component="RightEdge" name="TaharezLook/ComboboxListRight" />
+                <Image component="TopEdge" name="TaharezLook/ComboboxListTop" />
+                <Image component="BottomEdge" name="TaharezLook/ComboboxListBottom" />
+                <Image component="Background" name="TaharezLook/ComboboxListBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ComboEditbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ComboEditbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="MouseCursorImage" value="TaharezLook/MouseTextBar" />
+        <Property name="Size" value="{{0, 256}, {0, 32}}" />
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="container_normal">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/ComboboxEditLeft" />
+                <Image component="Background" name="TaharezLook/ComboboxEditMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <Image name="TaharezLook/TextSelectionBrush" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="Width" ><ImageDim name="TaharezLook/EditBoxCaret" dimension="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/EditBoxCaret" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="container_normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="container_normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="container_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ActiveSelection">
+            <Layer>
+                <Section section="selection">
+                    <ColourProperty name="ActiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="InactiveSelection">
+            <Layer>
+                <Section section="selection">
+                    <ColourProperty name="InactiveSelectionColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Combobox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Combobox">
+        <PropertyLinkDefinition name="NormalEditTextColour" widget="__auto_editbox__" targetProperty="NormalTextColour" initialValue="FFFFFFFF" type="ColourRect"/>
+        <PropertyLinkDefinition name="SelectedEditTextColour" widget="__auto_editbox__" targetProperty="SelectedTextColour" initialValue="FF000000" type="ColourRect"/>
+        <PropertyLinkDefinition name="ActiveEditSelectionColour" widget="__auto_editbox__" targetProperty="ActiveSelectionColour" initialValue="FF6060FF" type="ColourRect"/>
+        <PropertyLinkDefinition name="InactiveEditSelectionColour" widget="__auto_editbox__" targetProperty="InactiveSelectionColour" initialValue="FF808080" type="ColourRect"/>
+        <Property name="Size" value="{{0, 256}, {0, 256}}" />
+        <Child  type="TaharezLook/ComboEditbox" nameSuffix="__auto_editbox__">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <FontDim type="LineSpacing" padding="10" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height" >
+                    <FontDim type="LineSpacing" padding="10" />
+                </Dim>
+            </Area>
+        </Child>
+        <Child  type="TaharezLook/ComboDropList" nameSuffix="__auto_droplist__">
+            <Area>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_editbox__" dimension="BottomEdge" /></Dim>
+            </Area>
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_button__">
+            <Area>
+                <Dim type="Width" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>
+                <Dim type="Height" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="TaharezLook/ComboboxListButtonNormal" />
+            <Property name="HoverImage" value="TaharezLook/ComboboxListButtonHover" />
+            <Property name="PushedImage" value="TaharezLook/ComboboxListButtonHover" />
+            <Property name="DisabledImage" value="TaharezLook/ComboboxListButtonNormal" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Spinner
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Spinner">
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <Child  type="TaharezLook/Editbox" nameSuffix="__auto_editbox__">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="Width" ><ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="TaharezLook/VertScrollUpNormal" />
+            <Property name="HoverImage" value="TaharezLook/VertScrollUpHover" />
+            <Property name="PushedImage" value="TaharezLook/VertScrollUpNormal" />
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge" /></Dim>
+                <Dim type="Width" ><ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Width" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NormalImage" value="TaharezLook/VertScrollDownNormal" />
+            <Property name="HoverImage" value="TaharezLook/VertScrollDownHover" />
+            <Property name="PushedImage" value="TaharezLook/VertScrollDownNormal" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/StaticShared
+        (Shared imagery components for static widgets)
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/StaticShared">
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/StaticTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/StaticTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/StaticBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/StaticBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/StaticLeft" />
+                <Image component="RightEdge" name="TaharezLook/StaticRight" />
+                <Image component="TopEdge" name="TaharezLook/StaticTop" />
+                <Image component="BottomEdge" name="TaharezLook/StaticBottom" />
+                <ColourRectProperty name="FrameColours" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="background">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="TaharezLook/StaticRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="TaharezLook/StaticBottom" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/StaticBackdrop" />
+                <!--<ColourRectProperty name="BackgroundColours" />-->
+                <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="background_noframe">
+            <ImageryComponent>
+                <Image name="TaharezLook/StaticBackdrop" />
+                <!--<ColourRectProperty name="BackgroundColours" />-->
+                <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/StaticImage
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/StaticImage">
+        <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" type="VerticalFormatting"/>
+        <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" type="HorizontalFormatting"/>
+        <Property name="BackgroundEnabled" value="True" />
+        <Property name="FrameEnabled" value="True" />
+        <Property name="Size" value="{{0, 128}, {0, 128}}" />
+        <ImagerySection name="image_withframe">
+            <ImageryComponent>
+                <Area>
+					<Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+					<Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+					<Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+    						<UnifiedDim scale="1" type="RightEdge" />
+	        				<ImageDim name="TaharezLook/StaticRight" dimension="Width" />
+						</OperatorDim>
+					</Dim>
+					<Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+    						<UnifiedDim scale="1" type="BottomEdge" />
+	    					<ImageDim name="TaharezLook/StaticBottom" dimension="Height" />
+						</OperatorDim>
+					</Dim>
+				</Area>
+                <ImageProperty name="Image" />
+                <ColourRectProperty name="ImageColours" />
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="image_noframe">
+            <ImageryComponent>
+                <ImageProperty name="Image" />
+                <ColourRectProperty name="ImageColours" />
+                <VertFormatProperty name="VertFormatting" />
+                <HorzFormatProperty name="HorzFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+        <StateImagery name="EnabledFrame">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledFrame">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameEnabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameDisabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameEnabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameDisabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameImage">
+            <Layer>
+                <Section section="image_withframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameImage">
+            <Layer>
+                <Section section="image_noframe" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/StaticText
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/StaticText">
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+
+        <PropertyLinkDefinition name="HorzScrollPosition" widget="__auto_hscrollbar__" targetProperty="ScrollPosition" type="float" />
+        <PropertyLinkDefinition name="HorzScrollPageSize" widget="__auto_hscrollbar__" targetProperty="PageSize" type="float" />
+        <PropertyLinkDefinition name="HorzScrollDocumentSize" widget="__auto_hscrollbar__" targetProperty="DocumentSize" type="float" />
+
+        <PropertyLinkDefinition name="VertScrollPosition" widget="__auto_vscrollbar__" targetProperty="ScrollPosition" type="float" />
+        <PropertyLinkDefinition name="VertScrollPageSize" widget="__auto_vscrollbar__" targetProperty="PageSize" type="float" />
+        <PropertyLinkDefinition name="VertScrollDocumentSize" widget="__auto_vscrollbar__" targetProperty="DocumentSize" type="float" />
+
+        <Property name="FrameEnabled" value="True" />
+        <Property name="BackgroundEnabled" value="True" />
+        <Property name="Size" value="{{0, 256}, {0, 128}}" />
+        <NamedArea name="WithFrameTextRenderArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/StaticRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/StaticBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="WithFrameTextRenderAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/StaticRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="WithFrameTextRenderAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/StaticBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="WithFrameTextRenderAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/StaticLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/StaticTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderArea" />
+        <NamedArea name="NoFrameTextRenderAreaHScroll">
+            <Area>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderAreaVScroll">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="NoFrameTextRenderAreaHVScroll">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+        <StateImagery name="EnabledFrame">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledFrame">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameEnabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="WithFrameDisabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameEnabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="NoFrameDisabledBackground">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="background_noframe" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ListHeaderSegment
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ListHeaderSegment">
+        <Property name="SizingCursorImage" value="TaharezLook/MouseEsWeCursor" />
+        <Property name="MovingCursorImage" value="TaharezLook/MouseMoveCursor" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 192}, {0, 32}}" />
+        <ImagerySection name="segment_normal">
+            <Colours topLeft="FFDDDDDD" topRight="FFDDDDDD" bottomLeft="FFDDDDDD" bottomRight="FFDDDDDD" />
+            <ImageryComponent>
+                <Area>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="TaharezLook/HeaderBarSplitterNormal" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/HeaderBarBackdropNormal" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="segment_hover">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="TaharezLook/HeaderBarSplitterNormal" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/HeaderBarBackdropHover" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="splitter_normal">
+            <ImageryComponent>
+                <Image name="TaharezLook/HeaderBarSplitterNormal" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="splitter_hover">
+            <ImageryComponent>
+                <Image name="TaharezLook/HeaderBarSplitterHover" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="ascend_icon">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" ><ImageDim name="TaharezLook/HeaderBarSortUp" dimension="Width" /></Dim>
+                    <Dim type="Height" ><ImageDim name="TaharezLook/HeaderBarSortUp" dimension="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/HeaderBarSortDown" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="descend_icon">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
+                    <Dim type="Width" ><ImageDim name="TaharezLook/HeaderBarSortDown" dimension="Width" /></Dim>
+                    <Dim type="Height" ><ImageDim name="TaharezLook/HeaderBarSortDown" dimension="Height" /></Dim>
+                </Area>
+                <Image name="TaharezLook/HeaderBarSortUp" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" >
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/HeaderBarSortUp" dimension="Width" />
+                            <AbsoluteDim value="5" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="segment_normal" />
+                <Section section="splitter_normal" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="segment_hover" />
+                <Section section="splitter_normal" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SplitterHover">
+            <Layer>
+                <Section section="segment_normal" />
+                <Section section="splitter_hover" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DragGhost" clipped="false" >
+            <Layer priority="1" >
+                <Section section="segment_normal">
+                    <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
+                </Section>
+                <Section section="splitter_normal">
+                    <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
+                </Section>
+                <Section section="label">
+                    <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="AscendingSortIcon">
+            <Layer>
+                <Section section="ascend_icon" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DescendingSortIcon">
+            <Layer>
+                <Section section="descend_icon" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="GhostAscendingSortIcon" clipped="false">
+            <Layer priority="1" >
+                <Section section="ascend_icon">
+                    <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="GhostDescendingSortIcon" clipped="false">
+            <Layer priority="1" >
+                <Section section="descend_icon">
+                    <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="segment_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="splitter_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ListHeader
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ListHeader">
+        <Property name="SegmentWidgetType" value="TaharezLook/ListHeaderSegment" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/MultiColumnList
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/MultiColumnList">
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/MultiListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/MultiListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/MultiListRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/MultiListBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderingAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiListLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/ListHeader" nameSuffix="__auto_listheader__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="2" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="2" /></Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1" offset="-2" type="RightEdge" /></Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Multiply">
+                        <FontDim type="LineSpacing" />
+                        <AbsoluteDim value="1.5" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="BottomEdge" ><UnifiedDim scale="1" offset="-12" type="BottomEdge" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/MultiListTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/MultiListTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/MultiListBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/MultiListBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/MultiListLeft" />
+                <Image component="RightEdge" name="TaharezLook/MultiListRight" />
+                <Image component="TopEdge" name="TaharezLook/MultiListTop" />
+                <Image component="BottomEdge" name="TaharezLook/MultiListBottom" />
+                <Image component="Background" name="TaharezLook/MultiListBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/MultiLineEditbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/MultiLineEditbox">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="MouseCursorImage" value="TaharezLook/MouseTextBar" />
+        <Property name="SelectionBrushImage" value="TaharezLook/MultiLineEditboxSelectionBrush" />
+        <Property name="Size" value="{{0, 256}, {0, 256}}" />
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/MultiLineEditboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/MultiLineEditboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/MultiLineEditboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/MultiLineEditboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="TextAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MultiLineEditboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/MultiLineEditboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/MultiLineEditboxTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/MultiLineEditboxTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/MultiLineEditboxBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/MultiLineEditboxBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/MultiLineEditboxLeft" />
+                <Image component="RightEdge" name="TaharezLook/MultiLineEditboxRight" />
+                <Image component="TopEdge" name="TaharezLook/MultiLineEditboxTop" />
+                <Image component="BottomEdge" name="TaharezLook/MultiLineEditboxBottom" />
+                <Image component="Background" name="TaharezLook/MultiLineEditboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="Caret">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="Width" ><ImageDim name="TaharezLook/EditBoxCaret" dimension="Width" /></Dim>
+                </Area>
+                <Image name="TaharezLook/EditBoxCaret" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="ReadOnly">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/Tooltip
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Tooltip">
+        <Property name="Alpha" value="0" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <NamedArea name="TextArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/TooltipLeftEdge" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/TooltipTopEdge" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/TooltipRightEdge" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/TooltipBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TooltipTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/TooltipTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TooltipBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/TooltipBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/TooltipLeftEdge" />
+                <Image component="RightEdge" name="TaharezLook/TooltipRightEdge" />
+                <Image component="TopEdge" name="TaharezLook/TooltipTopEdge" />
+                <Image component="BottomEdge" name="TaharezLook/TooltipBottomEdge" />
+                <Image component="Background" name="TaharezLook/TooltipMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/TooltipLeftEdge" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="TaharezLook/TooltipTopEdge" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="TaharezLook/TooltipRightEdge" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="TaharezLook/TooltipBottomEdge" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Colours topLeft="FF000000" topRight="FF000000" bottomLeft="FF000000" bottomRight="FF000000" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main" />
+                <Section section="label" />
+            </Layer>
+        </StateImagery>
+        
+        <AnimationDefinition name="FadeIn" duration="0.33" replayMode="once">
+            <Affector property="Alpha" interpolator="float">
+                <KeyFrame position="0" sourceProperty="Alpha" />
+                <KeyFrame position="0.33" value="1" progression="linear" />
+            </Affector>
+            
+            <Subscription event="TooltipActive" action="Start" />
+        </AnimationDefinition>
+        
+        <AnimationDefinition name="FadeOut" duration="0.33" replayMode="once">
+            <Affector property="Alpha" interpolator="float">
+                <KeyFrame position="0" sourceProperty="Alpha" />
+                <KeyFrame position="0.33" value="0" progression="linear" />
+            </Affector>
+            <Affector property="Visible" interpolator="bool">
+                <KeyFrame position="0" sourceProperty="Visible" />
+                <KeyFrame position="0.33" value="false" progression="discrete" />
+            </Affector>
+            
+            <Subscription event="TooltipInactive" action="Start" />
+        </AnimationDefinition>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ScrollablePane
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ScrollablePane">
+        <NamedArea name="ViewableArea" />
+        <NamedArea name="ViewableAreaHScroll">
+            <Area>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaVScroll">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ViewableAreaHVScroll">
+            <Area>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/TabButton
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/TabButton">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect"/>
+        <ImagerySection name="label">
+            <TextComponent>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="CentreAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="top_normal">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TabButtonUpperLeftNormal" />
+                <Image component="TopRightCorner" name="TaharezLook/TabButtonUpperRightNormal" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TabButtonLowerLeftNormal" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabButtonLowerRight2Normal" />
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightNormal" />
+                <Image component="TopEdge" name="TaharezLook/TabButtonUpperNormal" />
+                <Image component="BottomEdge" name="TaharezLook/TabButtonLowerNormal" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="bot_normal">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TabButtonUpperLeft2Normal" />
+                <Image component="TopRightCorner" name="TaharezLook/TabButtonUpperRightNormal" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TabButtonLowerLeftNormal" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabButtonLowerRightNormal" />
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightNormal" />
+                <Image component="TopEdge" name="TaharezLook/TabButtonUpperNormal" />
+                <Image component="BottomEdge" name="TaharezLook/TabButtonLowerNormal" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="top_hover">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TabButtonUpperLeftNormal" />
+                <Image component="TopRightCorner" name="TaharezLook/TabButtonUpperRightNormal" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TabButtonLowerLeftNormal" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabButtonLowerRight2Normal" />
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightNormal" />
+                <Image component="TopEdge" name="TaharezLook/TabButtonUpperNormal" />
+                <Image component="BottomEdge" name="TaharezLook/TabButtonLowerNormal" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="bot_hover">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TabButtonUpperLeft2Normal" />
+                <Image component="TopRightCorner" name="TaharezLook/TabButtonUpperRightNormal" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TabButtonLowerLeftNormal" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabButtonLowerRightNormal" />
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftNormal" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightNormal" />
+                <Image component="TopEdge" name="TaharezLook/TabButtonUpperNormal" />
+                <Image component="BottomEdge" name="TaharezLook/TabButtonLowerNormal" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="top_selected">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/TabButtonUpperLeftSelected" />
+                <Image component="TopEdge" name="TaharezLook/TabButtonUpperSelected" />
+                <Image component="TopRightCorner" name="TaharezLook/TabButtonUpperRightSelected" />
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftSelected" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleSelected" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightSelected" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="bot_selected">
+            <FrameComponent>
+                <Image component="LeftEdge" name="TaharezLook/TabButtonLeftSelected" />
+                <Image component="Background" name="TaharezLook/TabButtonMiddleSelected" />
+                <Image component="RightEdge" name="TaharezLook/TabButtonRightSelected" />
+                <Image component="BottomLeftCorner" name="TaharezLook/TabButtonLowerLeftNormal" />
+                <Image component="BottomEdge" name="TaharezLook/TabButtonLowerNormal" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabButtonLowerRightNormal" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="TopNormal">
+            <Layer>
+                <Section section="top_normal" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomNormal">
+            <Layer>
+                <Section section="bot_normal" />
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="TopHover">
+            <Layer>
+                <Section section="top_hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomHover">
+            <Layer>
+                <Section section="bot_hover" />
+                <Section section="label">
+                    <ColourProperty name="HoverTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="TopSelected">
+            <Layer>
+                <Section section="top_selected" />
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomSelected">
+            <Layer>
+                <Section section="bot_selected" />
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="TopPushed">
+            <Layer>
+                <Section section="top_normal" />
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomPushed">
+            <Layer>
+                <Section section="bot_normal" />
+                <Section section="label">
+                    <ColourProperty name="PushedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="TopDisabled">
+            <Layer>
+                <Section section="top_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="BottomDisabled">
+            <Layer>
+                <Section section="bot_normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/TabContentPane
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/TabContentPane">
+        <PropertyDefinition name="EnableTop" initialValue="0" redrawOnWrite="true" layoutOnWrite="true" type="uint"/>
+        <PropertyDefinition name="EnableBottom" initialValue="0" redrawOnWrite="true" layoutOnWrite="true" type="uint"/>
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/TabContentPaneUpperLeft" dimension="Height" />
+                            <PropertyDim name="EnableTop" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopLeftCorner" name="TaharezLook/TabContentPaneUpperLeft" />
+                <Image component="TopEdge" name="TaharezLook/TabContentPaneUpper" />
+                <Image component="TopRightCorner" name="TaharezLook/TabContentPaneUpperRight" />
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/TabContentPaneUpperLeft" dimension="Height" />
+                            <PropertyDim name="EnableTop" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/TabContentPaneLowerLeft" dimension="Height"/>
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="LeftEdge" name="TaharezLook/TabContentPaneLeft" />
+                <Image component="Background" name="TaharezLook/TabContentPaneMiddle" />
+                <Image component="RightEdge" name="TaharezLook/TabContentPaneRight" />
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/TabContentPaneLowerLeft" dimension="Height"/>
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="BottomLeftCorner" name="TaharezLook/TabContentPaneLowerLeft" />
+                <Image component="BottomEdge" name="TaharezLook/TabContentPaneLower" />
+                <Image component="BottomRightCorner" name="TaharezLook/TabContentPaneLowerRight" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/TabButtonPane
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/TabButtonPane">
+        <PropertyDefinition name="EnableTop" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" type="uint"/>
+        <PropertyDefinition name="EnableBottom" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" type="uint"/>
+        <ImagerySection name="normal">
+            <FrameComponent>
+                <Area>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/TabHorizontalFiller" dimension="Height" />
+                            <PropertyDim name="EnableTop" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="TopEdge" name="TaharezLook/TabHorizontalFiller" />
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/TabHorizontalFiller" dimension="Height" />
+                            <PropertyDim name="EnableTop" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/TabHorizontalFiller" dimension="Height" />
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+            </FrameComponent>
+            <FrameComponent>
+                <Area>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/TabHorizontalFiller" dimension="Height" />
+                                <PropertyDim name="EnableBottom" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image component="BottomEdge" name="TaharezLook/TabHorizontalFiller" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/TabControl
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/TabControl">
+        <Property name="TabButtonType" value="TaharezLook/TabButton" />
+        <Property name="TabTextPadding" value="{0,6}" />
+        <Child type="TaharezLook/TabContentPane" nameSuffix="__auto_TabPane__">
+            <Area>
+                <Dim type="TopEdge">
+                    <OperatorDim op="Multiply">
+                        <PropertyDim widget="__auto_TabPane__" name="EnableBottom" />
+                        <PropertyDim name="TabHeight" type="Height" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Height" />
+                        <PropertyDim name="TabHeight" type="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        <Child  type="TaharezLook/TabButtonPane" nameSuffix="__auto_TabPane__Buttons">
+            <Area>
+                <Dim type="TopEdge">
+                    <OperatorDim op="Multiply">
+                        <PropertyDim widget="__auto_TabPane__Buttons" name="EnableTop"/>
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Height" />
+                            <PropertyDim name="TabHeight" type="Height" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height"><PropertyDim name="TabHeight" type="Height" /></Dim>
+            </Area>
+        </Child>
+        <Child type="TaharezLook/Button" nameSuffix="__auto_TabPane__ScrollLeft">
+            <Area>
+                <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
+                <Dim type="TopEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
+                </Dim>
+                <Dim type="Width">
+                    <OperatorDim op="Multiply">
+                        <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/TabButtonScrollLeftNormal" dimension="Width" />
+                            <ImageDim name="TaharezLook/TabButtonScrollLeftNormal" dimension="Height" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="BottomEdge" />
+                </Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="NormalImage" value="TaharezLook/TabButtonScrollLeftNormal" />
+            <Property name="HoverImage" value="TaharezLook/TabButtonScrollLeftHover" />
+            <Property name="PushedImage" value="TaharezLook/TabButtonScrollLeftHover" />
+        </Child>
+        <Child type="TaharezLook/Button" nameSuffix="__auto_TabPane__ScrollRight">
+            <Area>
+                <Dim type="Width">
+                    <OperatorDim op="Multiply">
+                        <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/TabButtonScrollRightNormal" dimension="Width" />
+                            <ImageDim name="TaharezLook/TabButtonScrollRightNormal" dimension="Height" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="LeftEdge">
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="Width" />
+                        <WidgetDim widget="__auto_TabPane__ScrollRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
+                </Dim>
+                <Dim type="Height">
+                    <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
+                </Dim>
+            </Area>
+            <Property name="AlwaysOnTop" value="True" />
+            <Property name="NormalImage" value="TaharezLook/TabButtonScrollRightNormal" />
+            <Property name="HoverImage" value="TaharezLook/TabButtonScrollRightHover" />
+            <Property name="PushedImage" value="TaharezLook/TabButtonScrollRightHover" />
+        </Child>
+        <StateImagery name="Enabled" />
+        <StateImagery name="Disabled" />
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/MenuItem
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/MenuItem">
+        <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="HoverColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="PushedColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="OpenedColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="WantsMultiClickEvents" value="False" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <NamedArea name="ContentSize">
+            <Area>
+                <Dim type="Width">
+                    <OperatorDim op="Add">
+                        <FontDim type="HorzExtent" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/MenuLeft" dimension="Width" />
+                            <ImageDim name="TaharezLook/MenuRight" dimension="Width" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <OperatorDim op="Add">
+                        <FontDim type="LineSpacing" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/MenuTop" dimension="Height" />
+                            <ImageDim name="TaharezLook/MenuBottom" dimension="Height" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="HasPopupContentSize">
+            <Area>
+                <Dim type="Width">
+                    <OperatorDim op="Add">
+                        <FontDim type="HorzExtent" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/MenuLeft" dimension="Width" />
+                            <OperatorDim op="Add">
+                                <ImageDim name="TaharezLook/MenuRight" dimension="Width" />
+                                <OperatorDim op="Multiply">
+                                    <ImageDim name="TaharezLook/PopupMenuArrowLeft" dimension="Width" />
+                                    <AbsoluteDim value="3" />
+                                </OperatorDim>
+                            </OperatorDim>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Height">
+                    <OperatorDim op="Add">
+                        <FontDim type="LineSpacing" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/MenuTop" dimension="Height" />
+                            <ImageDim name="TaharezLook/MenuBottom" dimension="Height" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><ImageDim name="TaharezLook/MenuLeft" dimension="Width" /></Dim>
+                    <Dim type="TopEdge" ><ImageDim name="TaharezLook/MenuTop" dimension="Height" /></Dim>
+                    <Dim type="RightEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="RightEdge" />
+                            <ImageDim name="TaharezLook/MenuRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="BottomEdge" />
+                            <ImageDim name="TaharezLook/MenuBottom" dimension="Height" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="LeftAligned" />
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/MenuTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/MenuTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/MenuBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/MenuBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/MenuLeft" />
+                <Image component="RightEdge" name="TaharezLook/MenuRight" />
+                <Image component="TopEdge" name="TaharezLook/MenuTop" />
+                <Image component="BottomEdge" name="TaharezLook/MenuBottom" />
+                <Image component="Background" name="TaharezLook/MenuMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <ImagerySection name="popup_arrow_right">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <ImageDim name="TaharezLook/PopupMenuArrowRight" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/PopupMenuArrowRight" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="popup_arrow_left">
+            <ImageryComponent>
+                <Area>
+                    <Dim type="Width" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1" type="Width" />
+                            <ImageDim name="TaharezLook/PopupMenuArrowLeft" dimension="Width" />
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/PopupMenuArrowLeft" />
+                <VertFormat type="CentreAligned" />
+                <HorzFormat type="RightAligned" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="EnabledNormal">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledHover">
+            <Layer>
+                <Section section="frame">
+                    <ColourProperty name="HoverColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledPushed">
+            <Layer>
+                <Section section="frame">
+                    <ColourProperty name="PushedColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="EnabledPopupOpen">
+            <Layer>
+                <Section section="frame">
+                    <ColourProperty name="OpenedColour" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="NormalTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledNormal">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledHover">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledPushed">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="DisabledPopupOpen">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+                <Section section="label">
+                    <ColourProperty name="DisabledTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PopupClosedIcon">
+            <Layer>
+                <Section section="popup_arrow_right" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PopupOpenIcon">
+            <Layer>
+                <Section section="popup_arrow_left" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/PopupMenu
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/PopupMenu">
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="BorderWidth" initialValue="0" layoutOnWrite="true" type="uint"/>
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <NamedArea name="ItemRenderArea">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <OperatorDim op="Add">
+                        <ImageDim name="TaharezLook/PopupMenuFrameLeft" dimension="Width" />
+                        <PropertyDim name="BorderWidth" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Add">
+                        <ImageDim name="TaharezLook/PopupMenuFrameTop" dimension="Height" />
+                        <PropertyDim name="BorderWidth" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/PopupMenuFrameRight" dimension="Width" />
+                            <PropertyDim name="BorderWidth" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/PopupMenuFrameBottom" dimension="Height" />
+                            <PropertyDim name="BorderWidth" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/PopupMenuFrameTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/PopupMenuFrameTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/PopupMenuFrameBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/PopupMenuFrameBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/PopupMenuFrameLeft" />
+                <Image component="RightEdge" name="TaharezLook/PopupMenuFrameRight" />
+                <Image component="TopEdge" name="TaharezLook/PopupMenuFrameTop" />
+                <Image component="BottomEdge" name="TaharezLook/PopupMenuFrameBottom" />
+                <Image component="Background" name="TaharezLook/PopupMenuMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame">
+                    <ColourRectProperty name="BackgroundColours" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        TaharezLook/Menubar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/Menubar">
+        <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="BorderWidth" initialValue="5" layoutOnWrite="true" type="uint"/>
+        <Property name="Size" value="{{1, 0}, {0, 32}}" />
+        <NamedArea name="ItemRenderArea">
+            <Area>
+                <Dim type="LeftEdge" >
+                    <OperatorDim op="Add">
+                        <ImageDim name="TaharezLook/PopupMenuFrameLeft" dimension="Width" />
+                        <PropertyDim name="BorderWidth" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Add">
+                        <ImageDim name="TaharezLook/PopupMenuFrameTop" dimension="Height" />
+                        <PropertyDim name="BorderWidth" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/PopupMenuFrameRight" dimension="Width" />
+                            <PropertyDim name="BorderWidth" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <OperatorDim op="Add">
+                            <ImageDim name="TaharezLook/PopupMenuFrameBottom" dimension="Height" />
+                            <PropertyDim name="BorderWidth" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="frame">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/PopupMenuFrameTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/PopupMenuFrameTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/PopupMenuFrameBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/PopupMenuFrameBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/PopupMenuFrameLeft" />
+                <Image component="RightEdge" name="TaharezLook/PopupMenuFrameRight" />
+                <Image component="TopEdge" name="TaharezLook/PopupMenuFrameTop" />
+                <Image component="BottomEdge" name="TaharezLook/PopupMenuFrameBottom" />
+                <Image component="Background" name="TaharezLook/PopupMenuMiddle" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="frame">
+                    <ColourRectProperty name="BackgroundColours" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/LargeVerticalScrollbarThumb
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/LargeVerticalScrollbarThumb">
+        <Property name="VertFree" value="True" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 10}, {0, 32}}" />
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <Image name="TaharezLook/VertScrollThumbNormal" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <Image name="TaharezLook/VertScrollThumbHover" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="normal">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/LargeVerticalScrollbar
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/LargeVerticalScrollbar">
+        <Property name="VerticalScrollbar" value="True" />
+        <Property name="Size" value="{{0, 16}, {1, 0}}" />
+        <NamedArea name="ThumbTrackArea">
+            <Area>
+                <Dim type="LeftEdge" ><UnifiedDim scale="0.325" type="LeftEdge" /></Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Add">
+                        <WidgetDim widget="__auto_decbtn__" dimension="Height" />
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                            <AbsoluteDim value="0.5" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1.0" type="BottomEdge" />
+                        <OperatorDim op="Add">
+                            <WidgetDim widget="__auto_decbtn__" dimension="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                                <AbsoluteDim value="0.5" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><UnifiedDim scale="0.25" type="LeftEdge" /></Dim>
+                <Dim type="TopEdge" >
+                    <OperatorDim op="Multiply">
+                        <AbsoluteDim value="-1" />
+                        <OperatorDim op="Multiply">
+                            <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                            <AbsoluteDim value="0.5" />
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.6" type="Width" /></Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Multiply">
+                        <UnifiedDim scale="0.6" type="Width" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Width" />
+                            <ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Height"/>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NormalImage" value="TaharezLook/VertScrollDownNormal" />
+            <Property name="HoverImage" value="TaharezLook/VertScrollDownHover" />
+            <Property name="PushedImage" value="TaharezLook/VertScrollDownNormal" />
+        </Child>
+        <Child  type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
+            <Area>
+                <Dim type="LeftEdge" ><UnifiedDim scale="0.25" type="LeftEdge" /></Dim>
+                <Dim type="TopEdge">
+                    <OperatorDim op="Multiply">
+                        <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                        <AbsoluteDim value="0.5" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="Width" ><UnifiedDim scale="0.6" type="Width" /></Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Multiply">
+                        <UnifiedDim scale="0.6" type="Width" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Width" />
+                            <ImageDim name="TaharezLook/VertScrollUpNormal" dimension="Height"/>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+            <Property name="NormalImage" value="TaharezLook/VertScrollUpNormal" />
+            <Property name="HoverImage" value="TaharezLook/VertScrollUpHover" />
+            <Property name="PushedImage" value="TaharezLook/VertScrollUpNormal" />
+        </Child>
+        <Child  type="TaharezLook/LargeVerticalScrollbarThumb" nameSuffix="__auto_thumb__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="0.4" type="Width" /></Dim>
+                <Dim type="Height" >
+                    <OperatorDim op="Multiply">
+                        <UnifiedDim scale="0.4" type="Width" />
+                        <OperatorDim op="Divide">
+                            <ImageDim name="TaharezLook/VertScrollThumbNormal" dimension="Height" />
+                            <ImageDim name="TaharezLook/VertScrollThumbNormal" dimension="Width"/>
+                        </OperatorDim>
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopEdge" name="TaharezLook/VertScrollTop" />
+                <Image component="BottomEdge" name="TaharezLook/VertScrollBottom" />
+                <Image component="Background" name="TaharezLook/VertScrollMiddle" />
+            </FrameComponent>
+            <ImageryComponent>
+                <Area>
+                    <Dim type="LeftEdge" ><UnifiedDim scale="0.45" type="LeftEdge" /></Dim>
+                    <Dim type="TopEdge" >
+                        <OperatorDim op="Add">
+                            <WidgetDim widget="__auto_decbtn__" dimension="Height" />
+                            <OperatorDim op="Multiply">
+                                <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                                <AbsoluteDim value="0.5" />
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                    <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
+                    <Dim type="BottomEdge" >
+                        <OperatorDim op="Subtract">
+                            <UnifiedDim scale="1.0" type="BottomEdge" />
+                            <OperatorDim op="Add">
+                                <WidgetDim widget="__auto_decbtn__" dimension="Height" />
+                                <OperatorDim op="Multiply">
+                                    <ImageDim name="TaharezLook/VertScrollTop" dimension="Height" />
+                                    <AbsoluteDim value="0.5" />
+                                </OperatorDim>
+                            </OperatorDim>
+                        </OperatorDim>
+                    </Dim>
+                </Area>
+                <Image name="TaharezLook/VertScrollBarSegment" />
+                <VertFormat type="Tiled" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ImageButton
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ImageButton">
+        <PropertyDefinition name="NormalImageColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect" />
+        <PropertyDefinition name="HoverImageColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect" />
+        <PropertyDefinition name="PushedImageColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect" />
+        <PropertyDefinition name="DisabledImageColour" initialValue="FF7F7F7F" redrawOnWrite="true" type="ColourRect" />
+        <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" type="VerticalFormatting" />
+        <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" type="HorizontalFormatting" />
+        <ImagerySection name="normal">
+            <ImageryComponent>
+                <ImageProperty name="NormalImage" />
+                <ColourProperty name="NormalImageColour" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="hover">
+            <ImageryComponent>
+                <ImageProperty name="HoverImage" />
+                <ColourProperty name="HoverImageColour" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="pushed">
+            <ImageryComponent>
+                <ImageProperty name="PushedImage" />
+                <ColourProperty name="PushedImageColour" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="disabled">
+            <ImageryComponent>
+                <ImageProperty name="DisabledImage" />
+                <ColourProperty name="DisabledImageColour" />
+                <VertFormatProperty name="VertImageFormatting" />
+                <HorzFormatProperty name="HorzImageFormatting" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Normal">
+            <Layer>
+                <Section section="normal" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Hover">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Pushed">
+            <Layer>
+                <Section section="pushed" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="PushedOff">
+            <Layer>
+                <Section section="hover" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="disabled" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+    <!--
+    ***************************************************
+        TaharezLook/ItemListbox
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ItemListbox">
+        <Property name="Size" value="{{0, 256}, {0, 256}}" />
+        <NamedArea name="ItemRenderArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaHScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/ListboxRight" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <UnifiedDim scale="1" offset="-12" type="BottomEdge" />
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <UnifiedDim scale="1" offset="-12" type="RightEdge" />
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/ListboxBottom" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <NamedArea name="ItemRenderAreaHVScroll">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/ListboxLeft" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/ListboxTop" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <UnifiedDim scale="1" offset="-12" type="RightEdge" />
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <UnifiedDim scale="1" offset="-12" type="BottomEdge" />
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+            <Property name="NonClient" value="True" />
+        </Child>
+        <ImagerySection name="main">
+            <FrameComponent>
+                <Image component="TopLeftCorner" name="TaharezLook/ListboxTopLeft" />
+                <Image component="TopRightCorner" name="TaharezLook/ListboxTopRight" />
+                <Image component="BottomLeftCorner" name="TaharezLook/ListboxBottomLeft" />
+                <Image component="BottomRightCorner" name="TaharezLook/ListboxBottomRight" />
+                <Image component="LeftEdge" name="TaharezLook/ListboxLeft" />
+                <Image component="RightEdge" name="TaharezLook/ListboxRight" />
+                <Image component="TopEdge" name="TaharezLook/ListboxTop" />
+                <Image component="BottomEdge" name="TaharezLook/ListboxBottom" />
+                <Image component="Background" name="TaharezLook/ListboxBackdrop" />
+            </FrameComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="main" />
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+    <!--
+    ***************************************************
+        TaharezLook/ListboxItem
+    ***************************************************
+    -->
+    <WidgetLook name="TaharezLook/ListboxItem">
+        <PropertyDefinition name="TextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <PropertyDefinition name="SelectionBrush" initialValue="TaharezLook/ListboxSelectionBrush" redrawOnWrite="true" type="Image"/>
+        <PropertyDefinition name="SelectionColour" initialValue="FF4444AA" redrawOnWrite="true" type="ColourRect"/>
+        <Property name="Selectable" value="True" />
+        <Property name="MouseInputPropagationEnabled" value="True" />
+        <Property name="Size" value="{{0, 128}, {0, 32}}" />
+        <NamedArea name="ContentSize">
+            <Area>
+                <Dim type="Width" >
+                    <FontDim type="HorzExtent" padding="6" />
+                </Dim>
+                <Dim type="Height" >
+                    <FontDim type="LineSpacing" />
+                </Dim>
+            </Area>
+        </NamedArea>
+        <ImagerySection name="label">
+            <TextComponent>
+                <Area>
+                    <Dim type="LeftEdge">
+                        <AbsoluteDim value="3" />
+                    </Dim>
+                    <Dim type="RightEdge">
+                        <UnifiedDim scale="1" offset="-3" type="RightEdge" />
+                    </Dim>
+                </Area>
+            </TextComponent>
+        </ImagerySection>
+        <ImagerySection name="selection">
+            <ImageryComponent>
+                <ImageProperty name="SelectionBrush" />
+                <ColourProperty name="SelectionColour" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="TextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section section="label">
+                    <ColourProperty name="TextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedEnabled">
+            <Layer>
+                <Section section="selection" />
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="SelectedDisabled">
+            <Layer>
+                <Section section="selection" />
+                <Section section="label">
+                    <ColourProperty name="SelectedTextColour" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+<!--
+/**********************************************************************************************************
+	TaharezLook/Tree
+***********************************************************************************************************/
+-->
+<WidgetLook name="TaharezLook/Tree">
+        <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" type="ColourRect"/>
+        <NamedArea name="ItemRenderingArea">
+            <Area>
+                <Dim type="LeftEdge" ><ImageDim name="TaharezLook/WindowLeftEdge" dimension="Width" /></Dim>
+                <Dim type="TopEdge" ><ImageDim name="TaharezLook/WindowTopEdge" dimension="Height" /></Dim>
+                <Dim type="RightEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="RightEdge" />
+                        <ImageDim name="TaharezLook/WindowRightEdge" dimension="Width" />
+                    </OperatorDim>
+                </Dim>
+                <Dim type="BottomEdge" >
+                    <OperatorDim op="Subtract">
+                        <UnifiedDim scale="1" type="BottomEdge" />
+                        <ImageDim name="TaharezLook/WindowBottomEdge" dimension="Height" />
+                    </OperatorDim>
+                </Dim>
+            </Area>
+        </NamedArea>
+        <Child  type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
+                <Dim type="Width" ><UnifiedDim scale="1" offset="-25" type="Width" /></Dim>
+                <Dim type="Height" ><AbsoluteDim value="10" /></Dim>
+            </Area>
+            <VertAlignment type="BottomAligned" />
+        </Child>
+        <Child  type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
+            <Area>
+                <Dim type="LeftEdge" ><AbsoluteDim value="-5" /></Dim>
+                <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
+                <Dim type="Width" ><AbsoluteDim value="10" /></Dim>
+                <Dim type="Height" ><UnifiedDim scale="1" offset="-10" type="Height" /></Dim>
+            </Area>
+            <HorzAlignment type="RightAligned" />
+        </Child>
+        <ImagerySection name="OpenTreeButton">
+            <ImageryComponent>
+                <Image name="TaharezLook/TreeListClosed" />
+              <!--  <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" /> -->
+            </ImageryComponent>
+        </ImagerySection>
+        <ImagerySection name="CloseTreeButton">
+            <ImageryComponent>
+                <Image name="TaharezLook/TreeListOpened" />
+                <VertFormat type="Stretched" />
+                <HorzFormat type="Stretched" />
+            </ImageryComponent>
+        </ImagerySection>
+        <StateImagery name="Enabled">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+        <StateImagery name="Disabled">
+            <Layer>
+                <Section look="TaharezLook/StaticShared" section="frame">
+                    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
+                </Section>
+            </Layer>
+        </StateImagery>
+    </WidgetLook>
+
+
+</Falagard>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/GUIScheme.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,56 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="GUIScheme" type="SchemeType" />
+	<xsd:complexType name="SchemeType">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+			<xsd:element name="Imageset" type="NamedDataType" />
+            <xsd:element name="ImagesetFromImage" type="NamedDataType" />
+			<xsd:element name="Font" type="NamedDataType" />
+            <xsd:element name="LookNFeel" type="FileDataType" />
+			<xsd:element name="WindowSet" type="WindowSetType" />
+			<xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
+			<xsd:element name="WindowAlias" type="WindowAliasType" />
+            <xsd:element name="FalagardMapping" type="FalagardMapType" />
+		</xsd:choice>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FileDataType">
+        <xsd:attribute name="filename" type="xsd:string" use="required" />
+        <xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+    </xsd:complexType>
+	<xsd:complexType name="NamedDataType">
+		<xsd:attribute name="name" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowFactoryType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererFactoryType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowAliasType">
+		<xsd:attribute name="alias" type="xsd:string" use="required" />
+		<xsd:attribute name="target" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FalagardMapType">
+        <xsd:attribute name="windowType" type="xsd:string" use="required" />
+        <xsd:attribute name="targetType" type="xsd:string" use="required" />
+		<xsd:attribute name="renderer" type="xsd:string" use="required" />
+        <xsd:attribute name="lookNFeel" type="xsd:string" use="required" />
+        <xsd:attribute name="renderEffect" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/SWB.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,80 @@
+<GUIScheme version="5" name="SWB">
+  <Imageset name="SWB" filename="SWB.imageset" />
+  <Imageset name="SWBCursors" filename="SWBCursors.imageset" />
+  <Imageset name="ControlPanel" filename="ControlPanel.imageset" />
+  <Imageset name="Inventory" filename="Inventory.imageset" />
+  <Imageset name="MainMenu" filename="MainMenu.imageset" />
+  <Imageset name="OptionsWindow" filename="OptionsWindow.imageset" />
+
+  <Font name="DejaVuSans-10" filename="DejaVuSans-10.font" />
+  <Font name="DejaVuSerif-8" filename="DejaVuSerif-8.font" />
+  <Font name="DejaVuSerif-10" filename="DejaVuSerif-10.font" />
+  <Font name="DejaVuSerif-12" filename="DejaVuSerif-12.font" />
+  <Font name="DejaVuSerif-16" filename="DejaVuSerif-16.font" />
+
+  <Font name="SWB-XS" filename="SWB-XS.font" />
+  <Font name="SWB-S" filename="SWB-S.font" />
+  <Font name="SWB-M" filename="SWB-M.font" />
+  <Font name="SWB-L" filename="SWB-L.font" />
+  <Font name="SWB-XL" filename="SWB-XL.font" />
+
+  <LookNFeel filename="SWB.looknfeel" />
+  <WindowRendererSet filename="CEGUICoreWindowRendererSet" />
+  <FalagardMapping windowType="SWB/BackgroundButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/BackgroundButton" />
+  <FalagardMapping windowType="SWB/Button"      targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/Button" />
+  <FalagardMapping windowType="SWB/Checkbox"    targetType="CEGUI/ToggleButton"    renderer="Core/ToggleButton" lookNFeel="SWB/Checkbox" />
+  <FalagardMapping windowType="SWB/ComboDropList" targetType="CEGUI/ComboDropList" renderer="Core/Listbox" lookNFeel="SWB/ComboDropList" />
+  <FalagardMapping windowType="SWB/ComboEditbox"  targetType="CEGUI/Editbox"   renderer="Core/Editbox" lookNFeel="SWB/ComboEditbox" />
+  <FalagardMapping windowType="SWB/Combobox"  targetType="CEGUI/Combobox"   renderer="Core/Default" lookNFeel="SWB/Combobox" />
+  <FalagardMapping windowType="SWB/DoubleImageButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/DoubleImageButton" />
+  <FalagardMapping windowType="SWB/Editbox"          targetType="CEGUI/Editbox"          renderer="Core/Editbox"          lookNFeel="SWB/Editbox" />
+  <FalagardMapping windowType="SWB/FrameWindow"  targetType="CEGUI/FrameWindow" renderer="Core/FrameWindow"  lookNFeel="SWB/FrameWindow" />
+  <FalagardMapping windowType="SWB/GlyphButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/GlyphButton" />
+  <FalagardMapping windowType="SWB/GlyphButtonCombo" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/GlyphButtonCombo" />
+  <FalagardMapping windowType="SWB/GroupBox" targetType="CEGUI/GroupBox"   renderer="Core/Default"   lookNFeel="SWB/GroupBox" />
+  <FalagardMapping windowType="SWB/HorizontalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="SWB/HorizontalScrollbar" />
+  <FalagardMapping windowType="SWB/HorizontalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="SWB/HorizontalScrollbarThumb" />
+  <FalagardMapping windowType="SWB/ImageButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SWB/ImageButton" />
+  <FalagardMapping windowType="SWB/ImageCheckbox"    targetType="CEGUI/Checkbox"    renderer="Core/ToggleButton" lookNFeel="SWB/ImageCheckbox" />
+  <FalagardMapping windowType="SWB/ItemListbox" targetType="CEGUI/ItemListbox" renderer="Core/ItemListbox" lookNFeel="SWB/ItemListbox" />
+  <FalagardMapping windowType="SWB/Label" targetType="DefaultWindow" renderer="Falagard/Default" lookNFeel="SWB/Label" />
+  <FalagardMapping windowType="SWB/Listbox"           targetType="CEGUI/Listbox"           renderer="Core/Listbox"           lookNFeel="SWB/Listbox" />
+  <FalagardMapping windowType="SWB/ListboxItem" targetType="CEGUI/ItemEntry"   renderer="Core/ItemEntry"   lookNFeel="SWB/ListboxItem" />
+  <FalagardMapping windowType="SWB/ListHeader"        targetType="CEGUI/ListHeader"        renderer="Core/ListHeader"        lookNFeel="SWB/ListHeader" />
+  <FalagardMapping windowType="SWB/ListHeaderSegment" targetType="CEGUI/ListHeaderSegment" renderer="Core/ListHeaderSegment" lookNFeel="SWB/ListHeaderSegment" />
+  <FalagardMapping windowType="SWB/MultiColumnList"   targetType="CEGUI/MultiColumnList"   renderer="Core/MultiColumnList"   lookNFeel="SWB/MultiColumnList" />
+  <FalagardMapping windowType="SWB/MultiLineEditbox" targetType="CEGUI/MultiLineEditbox" renderer="Core/MultiLineEditbox" lookNFeel="SWB/MultiLineEditbox" />
+  <FalagardMapping windowType="SWB/ProgressBar"          targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="SWB/ProgressBar" />
+  <FalagardMapping windowType="SWB/RadioButton" targetType="CEGUI/RadioButton" renderer="Core/ToggleButton" lookNFeel="SWB/Checkbox" />
+  <FalagardMapping windowType="SWB/RoundedPanelFrame"      targetType="DefaultWindow"  renderer="Core/Button"       lookNFeel="SWB/RoundedPanelFrame" />
+  <FalagardMapping windowType="SWB/ScrollablePane" targetType="CEGUI/ScrollablePane" renderer="Core/ScrollablePane" lookNFeel="SWB/ScrollablePane" />
+  <FalagardMapping windowType="SWB/SimplePanelFrame"      targetType="DefaultWindow"  renderer="Core/Button"       lookNFeel="SWB/SimplePanelFrame" />
+  <FalagardMapping windowType="SWB/Spinner" targetType="CEGUI/Spinner" renderer="Core/Default" lookNFeel="SWB/Spinner" />
+  <FalagardMapping windowType="SWB/StaticImage" targetType="DefaultWindow" renderer="Core/StaticImage" lookNFeel="SWB/StaticImage" />
+  <FalagardMapping windowType="SWB/StaticText"  targetType="DefaultWindow" renderer="Core/StaticText"  lookNFeel="SWB/StaticText" />
+  <FalagardMapping windowType="SWB/SystemButton" targetType="CEGUI/PushButton"  renderer="Core/Button" lookNFeel="SWB/GlyphButton" />
+  <FalagardMapping windowType="SWB/TabButton"  targetType="CEGUI/TabButton"  renderer="Core/TabButton"  lookNFeel="SWB/TabButton" />
+  <FalagardMapping windowType="SWB/TabButtonBotOnly"  targetType="CEGUI/TabButton"  renderer="Core/TabButton"  lookNFeel="SWB/TabButtonBotOnly" />
+  <FalagardMapping windowType="SWB/TabButtonPane"    targetType="DefaultWindow"    renderer="Core/Default"    lookNFeel="SWB/TabButtonPane" />
+  <FalagardMapping windowType="SWB/TabButtonTopOnly"  targetType="CEGUI/TabButton"  renderer="Core/TabButton"  lookNFeel="SWB/TabButtonTopOnly" />
+  <FalagardMapping windowType="SWB/TabControl" targetType="CEGUI/TabControl" renderer="Core/TabControl" lookNFeel="SWB/TabControl" />
+  <FalagardMapping windowType="SWB/TabContentPane"    targetType="DefaultWindow"    renderer="Core/Default"    lookNFeel="SWB/TabContentPane" />
+  <FalagardMapping windowType="SWB/TimerProgressBar"          targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="SWB/TimerProgressBar" />
+  <FalagardMapping windowType="SWB/Titlebar"     targetType="CEGUI/Titlebar"    renderer="Core/Titlebar"     lookNFeel="SWB/Titlebar" />
+  <FalagardMapping windowType="SWB/VerticalScrollbar"   targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="SWB/VerticalScrollbar" />
+  <FalagardMapping windowType="SWB/VerticalScrollbarThumb"   targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="SWB/VerticalScrollbarThumb" />
+  <FalagardMapping windowType="SWB/XPProgressBar"          targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="SWB/ProgressBar" />
+
+  <FalagardMapping windowType="SWB/Tooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="SWB/Tooltip" />
+  <FalagardMapping windowType="SWB/CustomTooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="SWB/CustomTooltip" />
+  <FalagardMapping windowType="SumwarsTooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="SWB/CustomTooltip" />
+
+</GUIScheme>
+<!--
+SWB - SumWarsBase
+SWB is licensed under the terms of the LGPL license.
+-->
+<!--
+version:      0.1
+Last change:  $LastChangedDate: 2012-12-25 20:55:19 +0200 (Ma, 25 dec. 2012) $
+-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/SumWarsExtras.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,30 @@
+<!--
+Extra images for SumWars
+-->
+<!--
+version:      0.1
+Last change:  $LastChangedDate: 2012-12-25 20:55:19 +0200 (Ma, 25 dec. 2012) $
+-->
+<GUIScheme version="5" name="SumWarsExtras">
+  <Imageset name="SumWarsExtras" filename="SumWarsExtras.imageset" />
+  <Imageset name="ControlPanel" filename="ControlPanel.imageset" /> <!-- TODO: this is also in SWB. Should be in a single place -->
+  <Imageset name="CharScreen" filename="CharacterScreen.imageset" /> <!-- TODO: rename to CharacterScreen -->
+  <Imageset name="Misc" filename="misc.imageset" /> <!-- TODO: rename to CharacterScreen -->
+  <Imageset name="Portrait" filename="portrait.imageset" />
+  <Imageset name="skills" filename="skills.imageset" />
+  <Imageset name="SkillTree" filename="SkillTree.imageset" />
+  <Imageset name="TradeWindow" filename="TradeWindow.imageset" />
+
+  <LookNFeel filename="SumWarsExtras.looknfeel" />
+  <WindowRendererSet filename="CEGUICoreWindowRendererSet" />
+  
+  <FalagardMapping windowType="SumWarsExtras/HPProgressBar" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="SumWarsExtras/HPProgressBar" />
+  <FalagardMapping windowType="SumWarsExtras/HPProgressOrbHighlight" targetType="CEGUI/PushButton" renderer="Core/Button" lookNFeel="SumWarsExtras/HPProgressOrbHighlight" />
+  <FalagardMapping windowType="SumWarsExtras/ScrollablePaneNoBar" targetType="CEGUI/ScrollablePane" renderer="Core/ScrollablePane" lookNFeel="SumWarsExtras/ScrollablePaneNoBar" />
+  <FalagardMapping windowType="SumWarsExtras/VerticalScrollbar"   targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="SumWarsExtras/VerticalScrollbar" />
+  <FalagardMapping windowType="SumWarsExtras/HorizontalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="SumWarsExtras/HorizontalScrollbar" />
+  <FalagardMapping windowType="SumWarsExtras/VerticalScrollbarThumb"   targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="SumWarsExtras/VerticalScrollbarThumb" />
+  <FalagardMapping windowType="SumWarsExtras/HorizontalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="SumWarsExtras/HorizontalScrollbarThumb" />
+  <FalagardMapping windowType="SumWarsExtras/ImageButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="SumWarsExtras/ImageButton" />
+
+</GUIScheme>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/TaharezLook.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,52 @@
+<?xml version="1.0" ?>
+<GUIScheme version="5" name="TaharezLook">
+	<Imageset filename="TaharezLook.imageset" />
+	<Font filename="DejaVuSans-12.font" />
+	<LookNFeel filename="TaharezLook.looknfeel" />
+	<WindowRendererSet filename="CEGUICoreWindowRendererSet" />
+
+	<FalagardMapping windowType="TaharezLook/Label"       targetType="DefaultWindow"     renderer="Core/Default"      lookNFeel="TaharezLook/Label" />
+	<FalagardMapping windowType="TaharezLook/Button"      targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="TaharezLook/Button" />
+	<FalagardMapping windowType="TaharezLook/Checkbox"    targetType="CEGUI/ToggleButton"    renderer="Core/ToggleButton" lookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping windowType="TaharezLook/ImageButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping windowType="TaharezLook/RadioButton" targetType="CEGUI/RadioButton" renderer="Core/ToggleButton" lookNFeel="TaharezLook/RadioButton" />
+	<FalagardMapping windowType="TaharezLook/FrameWindow"  targetType="CEGUI/FrameWindow" renderer="Core/FrameWindow"  lookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping windowType="TaharezLook/Titlebar"     targetType="CEGUI/Titlebar"    renderer="Core/Titlebar"     lookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping windowType="TaharezLook/Editbox"          targetType="CEGUI/Editbox"          renderer="Core/Editbox"          lookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping windowType="TaharezLook/MultiLineEditbox" targetType="CEGUI/MultiLineEditbox" renderer="Core/MultiLineEditbox" lookNFeel="TaharezLook/MultiLineEditbox" />
+	<FalagardMapping windowType="TaharezLook/Menubar"   targetType="CEGUI/Menubar"   renderer="Core/Menubar"   lookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping windowType="TaharezLook/PopupMenu" targetType="CEGUI/PopupMenu" renderer="Core/PopupMenu" lookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping windowType="TaharezLook/MenuItem"  targetType="CEGUI/MenuItem"  renderer="Core/MenuItem"  lookNFeel="TaharezLook/MenuItem" />
+	<FalagardMapping windowType="TaharezLook/AlternateProgressBar" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping windowType="TaharezLook/ProgressBar"          targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping windowType="TaharezLook/VUMeter"              targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/VUMeter" />
+	<FalagardMapping windowType="TaharezLook/VerticalScrollbar"   targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/HorizontalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/HorizontalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/VerticalScrollbarThumb"   targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/VerticalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/HorizontalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbar"      targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/LargeVerticalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbarThumb" targetType="CEGUI/Thumb"     renderer="Core/Button"    lookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/TabButton"  targetType="CEGUI/TabButton"  renderer="Core/TabButton"  lookNFeel="TaharezLook/TabButton" />
+	<FalagardMapping windowType="TaharezLook/TabControl" targetType="CEGUI/TabControl" renderer="Core/TabControl" lookNFeel="TaharezLook/TabControl" />
+	<FalagardMapping windowType="TaharezLook/TabContentPane"    targetType="DefaultWindow"    renderer="Core/Default"    lookNFeel="TaharezLook/TabContentPane" />
+	<FalagardMapping windowType="TaharezLook/TabButtonPane"    targetType="DefaultWindow"    renderer="Core/Default"    lookNFeel="TaharezLook/TabButtonPane" />
+	<FalagardMapping windowType="TaharezLook/ComboDropList" targetType="CEGUI/ComboDropList" renderer="Core/Listbox" lookNFeel="TaharezLook/ComboDropList" />
+	<FalagardMapping windowType="TaharezLook/ComboEditbox"  targetType="CEGUI/Editbox"	 renderer="Core/Editbox" lookNFeel="TaharezLook/ComboEditbox" />
+	<FalagardMapping windowType="TaharezLook/Combobox" targetType="CEGUI/Combobox"	 renderer="Core/Default" lookNFeel="TaharezLook/Combobox" />
+	<FalagardMapping windowType="TaharezLook/Listbox"           targetType="CEGUI/Listbox"           renderer="Core/Listbox"           lookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping windowType="TaharezLook/ListHeader"        targetType="CEGUI/ListHeader"        renderer="Core/ListHeader"        lookNFeel="TaharezLook/ListHeader" />
+	<FalagardMapping windowType="TaharezLook/ListHeaderSegment" targetType="CEGUI/ListHeaderSegment" renderer="Core/ListHeaderSegment" lookNFeel="TaharezLook/ListHeaderSegment" />
+	<FalagardMapping windowType="TaharezLook/MultiColumnList"   targetType="CEGUI/MultiColumnList"   renderer="Core/MultiColumnList"   lookNFeel="TaharezLook/MultiColumnList" />
+	<FalagardMapping windowType="TaharezLook/Slider"      targetType="CEGUI/Slider"      renderer="Core/Slider"  lookNFeel="TaharezLook/Slider" />
+	<FalagardMapping windowType="TaharezLook/SliderThumb" targetType="CEGUI/Thumb" renderer="Core/Button"  lookNFeel="TaharezLook/SliderThumb" />
+	<FalagardMapping windowType="TaharezLook/ScrollablePane" targetType="CEGUI/ScrollablePane" renderer="Core/ScrollablePane" lookNFeel="TaharezLook/ScrollablePane" />
+	<FalagardMapping windowType="TaharezLook/Spinner" targetType="CEGUI/Spinner" renderer="Core/Default" lookNFeel="TaharezLook/Spinner" />
+	<FalagardMapping windowType="TaharezLook/Tooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="TaharezLook/Tooltip" />
+	<FalagardMapping windowType="TaharezLook/StaticImage" targetType="DefaultWindow" renderer="Core/StaticImage" lookNFeel="TaharezLook/StaticImage" />
+	<FalagardMapping windowType="TaharezLook/StaticText"  targetType="DefaultWindow" renderer="Core/StaticText"  lookNFeel="TaharezLook/StaticText" />
+	<FalagardMapping windowType="TaharezLook/ItemListbox" targetType="CEGUI/ItemListbox" renderer="Core/ItemListbox" lookNFeel="TaharezLook/ItemListbox" />
+	<FalagardMapping windowType="TaharezLook/ListboxItem" targetType="CEGUI/ItemEntry"   renderer="Core/ItemEntry"   lookNFeel="TaharezLook/ListboxItem" />
+	<FalagardMapping windowType="TaharezLook/GroupBox" targetType="DefaultWindow"   renderer="Core/Default"   lookNFeel="TaharezLook/GroupBox" />
+      <FalagardMapping windowType="TaharezLook/Tree" targetType="CEGUI/Tree"   renderer="Core/Tree"   lookNFeel="TaharezLook/Tree" />
+</GUIScheme>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/TaharezLookWidgetAliases.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,34 @@
+<?xml version="1.0" ?>
+<GUIScheme version="5" name="TaharezLookWidgetAliases">
+	<WindowAlias Alias="Taharez AltProgressBar" Target="TaharezLook/AlternateProgressBar" />
+	<WindowAlias Alias="Taharez Button" Target="TaharezLook/Button" />
+	<WindowAlias Alias="Taharez Checkbox" Target="TaharezLook/Checkbox" />
+	<WindowAlias Alias="Taharez System Button" Target="TaharezLook/SystemButton" />
+	<WindowAlias Alias="Taharez Combobox" Target="TaharezLook/Combobox" />
+	<WindowAlias Alias="Taharez ComboDropList" Target="TaharezLook/ComboDropList" />
+	<WindowAlias Alias="Taharez ComboEditbox" Target="TaharezLook/ComboEditbox" />
+	<WindowAlias Alias="Taharez Editbox" Target="TaharezLook/Editbox" />
+	<WindowAlias Alias="Taharez Frame Window" Target="TaharezLook/FrameWindow" />
+	<WindowAlias Alias="Taharez Listbox" Target="TaharezLook/Listbox" />
+	<WindowAlias Alias="Taharez ListHeader" Target="TaharezLook/ListHeader" />
+	<WindowAlias Alias="Taharez ListHeaderSegment" Target="TaharezLook/ListHeaderSegment" />
+	<WindowAlias Alias="Taharez MiniHorzScrollbar" Target="TaharezLook/HorizontalScrollbar" />
+	<WindowAlias Alias="Taharez MiniHorzScrollbarThumb" Target="TaharezLook/HorizontalScrollbarThumb" />
+	<WindowAlias Alias="Taharez MiniVertScrollbar" Target="TaharezLook/VerticalScrollbar" />
+	<WindowAlias Alias="Taharez MiniVertScrollbarThumb" Target="TaharezLook/VerticalScrollbarThumb" />
+	<WindowAlias Alias="Taharez MultiColumnList" Target="TaharezLook/MultiColumnList" />
+	<WindowAlias Alias="Taharez MultiLineEditbox" Target="TaharezLook/MultiLineEditbox" />
+	<WindowAlias Alias="Taharez ProgressBar" Target="TaharezLook/ProgressBar" />
+	<WindowAlias Alias="Taharez RadioButton" Target="TaharezLook/RadioButton" />
+	<WindowAlias Alias="Taharez Slider" Target="TaharezLook/Slider" />
+	<WindowAlias Alias="Taharez Slider Thumb" Target="TaharezLook/SliderThumb" />
+	<WindowAlias Alias="Taharez StaticImage" Target="TaharezLook/StaticImage" />
+	<WindowAlias Alias="Taharez StaticText" Target="TaharezLook/StaticText" />
+	<WindowAlias Alias="Taharez Tab Button" Target="TaharezLook/TabButton" />
+	<WindowAlias Alias="Taharez Tab Pane" Target="TaharezLook/TabPane" />
+	<WindowAlias Alias="Taharez Tab Control" Target="TaharezLook/TabControl" />
+	<WindowAlias Alias="Taharez Titlebar" Target="TaharezLook/Titlebar" />
+	<WindowAlias Alias="Taharez VertScrollbar" Target="TaharezLook/LargeVerticalScrollbar" />
+	<WindowAlias Alias="Taharez VertScrollbarThumb" Target="TaharezLook/LargeVerticalScrollbarThumb" />
+</GUIScheme>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/schemes/TaharezLookWidgets.scheme	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" ?>
+<GUIScheme version="5" name="TaharezLookWidgets">
+	<WindowRendererSet filename="CEGUICoreWindowRendererSet" />
+	<FalagardMapping windowType="TaharezLook/Button"      targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="TaharezLook/Button" />
+	<FalagardMapping windowType="TaharezLook/Checkbox"    targetType="CEGUI/Checkbox"    renderer="Core/ToggleButton" lookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping windowType="TaharezLook/ImageButton" targetType="CEGUI/PushButton"  renderer="Core/Button"       lookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping windowType="TaharezLook/RadioButton" targetType="CEGUI/RadioButton" renderer="Core/ToggleButton" lookNFeel="TaharezLook/RadioButton" />
+	<FalagardMapping windowType="TaharezLook/FrameWindow"  targetType="CEGUI/FrameWindow" renderer="Core/FrameWindow"  lookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping windowType="TaharezLook/Titlebar"     targetType="CEGUI/Titlebar"    renderer="Core/Titlebar"     lookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping windowType="TaharezLook/SystemButton" targetType="CEGUI/PushButton"  renderer="Core/SystemButton" lookNFeel="TaharezLook/Button" />
+	<FalagardMapping windowType="TaharezLook/Editbox"          targetType="CEGUI/Editbox"          renderer="Core/Editbox"          lookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping windowType="TaharezLook/MultiLineEditbox" targetType="CEGUI/MultiLineEditbox" renderer="Core/MultiLineEditbox" lookNFeel="TaharezLook/MultiLineEditbox" />
+	<FalagardMapping windowType="TaharezLook/Menubar"   targetType="CEGUI/Menubar"   renderer="Core/Menubar"   lookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping windowType="TaharezLook/PopupMenu" targetType="CEGUI/PopupMenu" renderer="Core/PopupMenu" lookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping windowType="TaharezLook/MenuItem"  targetType="CEGUI/MenuItem"  renderer="Core/MenuItem"  lookNFeel="TaharezLook/MenuItem" />
+	<FalagardMapping windowType="TaharezLook/AlternateProgressBar" targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping windowType="TaharezLook/ProgressBar"          targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping windowType="TaharezLook/VUMeter"              targetType="CEGUI/ProgressBar" renderer="Core/ProgressBar" lookNFeel="TaharezLook/VUMeter" />
+	<FalagardMapping windowType="TaharezLook/VerticalScrollbar"   targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/HorizontalScrollbar" targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/HorizontalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/VerticalScrollbarThumb"   targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/VerticalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/HorizontalScrollbarThumb" targetType="CEGUI/Thumb" renderer="Core/Button" lookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbar"      targetType="CEGUI/Scrollbar" renderer="Core/Scrollbar" lookNFeel="TaharezLook/LargeVerticalScrollbar" />
+	<FalagardMapping windowType="TaharezLook/LargeVerticalScrollbarThumb" targetType="CEGUI/Thumb"     renderer="Core/Button"    lookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+	<FalagardMapping windowType="TaharezLook/TabButton"  targetType="CEGUI/TabButton"  renderer="Core/TabButton"  lookNFeel="TaharezLook/TabButton" />
+	<FalagardMapping windowType="TaharezLook/TabControl" targetType="CEGUI/TabControl" renderer="Core/TabControl" lookNFeel="TaharezLook/TabControl" />
+	<FalagardMapping windowType="TaharezLook/TabPane"    targetType="DefaultWindow"    renderer="Core/Default"    lookNFeel="TaharezLook/TabPane" />
+	<FalagardMapping windowType="TaharezLook/ComboDropList" targetType="CEGUI/ComboDropList" renderer="Core/Listbox" lookNFeel="TaharezLook/ComboDropList" />
+	<FalagardMapping windowType="TaharezLook/ComboEditbox"  targetType="CEGUI/Editbox"	 renderer="Core/Editbox" lookNFeel="TaharezLook/ComboEditbox" />
+	<FalagardMapping windowType="TaharezLook/Combobox"	TargetType="CEGUI/Combobox"	 renderer="Core/Default" lookNFeel="TaharezLook/Combobox" />
+	<FalagardMapping windowType="TaharezLook/Listbox"           targetType="CEGUI/Listbox"           renderer="Core/Listbox"           lookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping windowType="TaharezLook/ListHeader"        targetType="CEGUI/ListHeader"        renderer="Core/ListHeader"        lookNFeel="TaharezLook/ListHeader" />
+	<FalagardMapping windowType="TaharezLook/ListHeaderSegment" targetType="CEGUI/ListHeaderSegment" renderer="Core/ListHeaderSegment" lookNFeel="TaharezLook/ListHeaderSegment" />
+	<FalagardMapping windowType="TaharezLook/MultiColumnList"   targetType="CEGUI/MultiColumnList"   renderer="Core/MultiColumnList"   lookNFeel="TaharezLook/MultiColumnList" />
+	<FalagardMapping windowType="TaharezLook/Slider"      targetType="CEGUI/Slider" renderer="Core/Slider"  lookNFeel="TaharezLook/Slider" />
+	<FalagardMapping windowType="TaharezLook/SliderThumb" targetType="CEGUI/Thumb"  renderer="Core/Button"  lookNFeel="TaharezLook/SliderThumb" />
+	<FalagardMapping windowType="TaharezLook/ScrollablePane" targetType="CEGUI/ScrollablePane" renderer="Core/ScrollablePane" lookNFeel="TaharezLook/ScrollablePane" />
+	<FalagardMapping windowType="TaharezLook/Spinner" targetType="CEGUI/Spinner" renderer="Core/Default" lookNFeel="TaharezLook/Spinner" />
+	<FalagardMapping windowType="TaharezLook/Tooltip" targetType="CEGUI/Tooltip" renderer="Core/Tooltip" lookNFeel="TaharezLook/Tooltip" />
+	<FalagardMapping windowType="TaharezLook/StaticImage" targetType="DefaultWindow" renderer="Core/StaticImage" lookNFeel="TaharezLook/StaticImage" />
+	<FalagardMapping windowType="TaharezLook/StaticText"  targetType="DefaultWindow" renderer="Core/StaticText"  lookNFeel="TaharezLook/StaticText" />
+    <FalagardMapping windowType="TaharezLook/ItemListbox" targetType="CEGUI/ItemListbox" renderer="Core/ItemListbox" lookNFeel="TaharezLook/ItemListbox" />
+    <FalagardMapping windowType="TaharezLook/ListboxItem" targetType="CEGUI/ItemEntry"   renderer="Core/ItemEntry"   lookNFeel="TaharezLook/ListboxItem" />
+</GUIScheme>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/Animation.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,69 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Animations" type="animAnimationsType" />
+	<xsd:complexType name="animAnimationsType">
+        <xsd:sequence>
+            <xsd:element name="AnimationDefinition" type="animAnimationDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="animAnimationDefinitionType">
+        <xsd:sequence>
+            <xsd:element name="Affector" type="animAffectorType" minOccurs="1" maxOccurs="unbounded" />
+            <xsd:element name="Subscription" type="animSubscriptionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="duration" type="xsd:decimal" use="required" />
+		<xsd:attribute name="replayMode" type="animReplayModeEnum" use="optional" default="loop" />
+		<xsd:attribute name="autoStart" type="xsd:boolean" use="optional" default="false" />
+	</xsd:complexType>
+	<xsd:complexType name="animAffectorType">
+        <xsd:sequence>
+            <xsd:element name="KeyFrame" type="animKeyFrameType" minOccurs="1" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="applicationMethod" type="animApplicationMethodEnum" use="optional" default="absolute" />
+		<xsd:attribute name="property" type="xsd:string" use="required" />
+		<xsd:attribute name="interpolator" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="animKeyFrameType">
+		<xsd:attribute name="position" type="xsd:decimal" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="progression" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="sourceProperty" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+	<xsd:complexType name="animSubscriptionType">
+		<xsd:attribute name="event" type="xsd:string" use="required" />
+		<xsd:attribute name="action" type="animActionEnum" use="required" />
+	</xsd:complexType>
+    <xsd:simpleType name="animReplayModeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="once" />
+            <xsd:enumeration value="loop" />
+            <xsd:enumeration value="bounce" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animApplicationMethodEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="absolute" />
+            <xsd:enumeration value="relative" />
+            <xsd:enumeration value="relative multiply" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animProgressionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="linear" />
+            <xsd:enumeration value="discrete" />
+            <xsd:enumeration value="quadratic accelerating" />
+            <xsd:enumeration value="quadratic decelerating" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animActionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Start" />
+            <xsd:enumeration value="Stop" />
+            <xsd:enumeration value="Pause" />
+            <xsd:enumeration value="Unpause" />
+            <xsd:enumeration value="TogglePause" />
+        </xsd:restriction>
+    </xsd:simpleType>
+</xsd:schema>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/CEGUIConfig.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+    <xsd:element name="CEGUIConfig" type="CEGUIConfigType"/>
+
+    <xsd:complexType name="CEGUIConfigType">
+        <xsd:sequence>
+            <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                <xsd:element name="Logging" type="loggingType" />
+                <xsd:element name="AutoLoad" type="autoLoadType" />
+                <xsd:element name="ResourceDirectory" type="resourceDirectoryType" />
+                <xsd:element name="DefaultResourceGroup" type="defaultResourceGroupType" />
+                <xsd:element name="Scripting" type="scriptingType" />
+                <xsd:element name="DefaultXMLParser" type="defaultObjectType" />
+                <xsd:element name="DefaultImageCodec" type="defaultObjectType" />
+                <xsd:element name="DefaultFont" type="defaultObjectType" />
+                <xsd:element name="DefaultMouseCursor" type="defaultMouseCursorType" />
+                <xsd:element name="DefaultTooltip" type="defaultObjectType" />
+                <xsd:element name="DefaultGUISheet" type="defaultObjectType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="loggingType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="filename" type="xsd:string" use="optional" default="CEGUI.log" />
+                <xsd:attribute name="level" type="logLevel" use="optional" default="Standard" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="autoLoadType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="type" type="resourceType" use="required" />
+                <xsd:attribute name="group" type="xsd:string" use="optional" default="" />
+                <xsd:attribute name="pattern" type="xsd:string" use="optional" default="*" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="resourceDirectoryType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="group" type="xsd:string" use="required" />
+                <xsd:attribute name="directory" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultResourceGroupType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="type" type="resourceType" use="optional" default="Default" />
+                <xsd:attribute name="group" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="scriptingType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="initScript" type="xsd:string" use="optional" default="" />
+                <xsd:attribute name="terminateScript" type="xsd:string" use="optional" default="" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultObjectType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="defaultMouseCursorType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="imageset" type="xsd:string" use="required" />
+                <xsd:attribute name="image" type="xsd:string" use="required" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:simpleType name="logLevel">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Errors"/>
+            <xsd:enumeration value="Standard"/>
+            <xsd:enumeration value="Informative"/>
+            <xsd:enumeration value="Insane"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:simpleType name="resourceType">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Imageset"/>
+            <xsd:enumeration value="Font"/>
+            <xsd:enumeration value="Scheme"/>
+            <xsd:enumeration value="LookNFeel"/>
+            <xsd:enumeration value="Layout"/>
+            <xsd:enumeration value="Script"/>
+            <xsd:enumeration value="XMLSchema"/>
+            <xsd:enumeration value="Default"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/Falagard.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,540 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Falagard" type="falagardSpecificationType" />
+	<xsd:complexType name="falagardSpecificationType">
+		<xsd:sequence>
+			<xsd:element name="WidgetLook" type="widgetLookType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="widgetLookType">
+		<xsd:sequence>
+            <xsd:element name="EventLinkDefinition" type="eventLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="PropertyDefinition" type="propertyDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="PropertyLinkDefinition" type="propertyLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="NamedArea" type="namedAreaType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Child" type="widgetComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImagerySection" type="imagerySectionType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="StateImagery" type="stateType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="AnimationDefinition" type="animAnimationDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="inherits" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+    <xsd:complexType name="propertyDefinitionType">
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="help" type="xsd:string" use="optional" default="Falagard custom property definition - gets/sets a named user string." />
+        <xsd:attribute name="fireEvent" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyLinkDefinitionType">
+		<xsd:sequence>
+			<xsd:element name="PropertyLinkTarget" type="propertyLinkTargetType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="targetProperty" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="fireEvent" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyLinkTargetType">
+        <xsd:attribute name="widget" type="xsd:string" use="required" />
+        <xsd:attribute name="property" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="eventLinkDefinitionType">
+		<xsd:sequence>
+			<xsd:element name="EventLinkTarget" type="eventLinkTargetType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="event" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="eventLinkTargetType">
+        <xsd:attribute name="widget" type="xsd:string" use="required" />
+        <xsd:attribute name="event" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="namedAreaType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="stateType">
+		<xsd:sequence>
+			<xsd:element name="Layer" type="layerType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="clipped" type="xsd:boolean" use="optional" default="true" />
+	</xsd:complexType>
+	<xsd:complexType name="layerType">
+		<xsd:sequence>
+			<xsd:element name="Section" type="sectionSpecType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="priority" type="xsd:integer" use="optional" default="0" />
+	</xsd:complexType>
+    <xsd:complexType name="sectionSpecType">
+        <xsd:choice  minOccurs="0" maxOccurs="1">
+            <xsd:element name="Colour" type="colourType" />
+            <xsd:element name="Colours" type="colourRectType" />
+            <xsd:element name="ColourProperty" type="settingByPropertyType" />
+            <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+        </xsd:choice>
+        <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="section" type="xsd:string" use="required" />
+        <xsd:attribute name="controlProperty" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="controlValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="controlWidget" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+	<xsd:complexType name="imagerySectionType">
+		<xsd:sequence>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:element name="FrameComponent" type="frameComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImageryComponent" type="imageryComponentType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="TextComponent" type="textComponentType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice  minOccurs="0" maxOccurs="9">
+                <xsd:element name="Image" type="frameImageType" />
+                <xsd:element name="ImageProperty" type="frameImageType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="3">
+                <xsd:element name="VertFormat" type="frameVertFormatType" />
+                <xsd:element name="VertFormatProperty" type="frameFormatPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="3">
+                <xsd:element name="HorzFormat" type="frameHorzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="frameFormatPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="textComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="Text" type="textStringType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="TextProperty" type="textPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="FontProperty" type="fontPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertTextFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzTextFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+	<xsd:complexType name="imageryComponentType">
+		<xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice>
+                <xsd:element name="Image" type="imageType" />
+                <xsd:element name="ImageProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="widgetComponentType">
+		<xsd:sequence>
+            <xsd:element name="EventAction" type="eventActionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="Area" type="componentAreaType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="VertAlignment" type="vertAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="HorzAlignment" type="horzAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="type" type="xsd:string" use="required" />
+		<xsd:attribute name="nameSuffix" type="xsd:string" use="required" />
+		<xsd:attribute name="renderer" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="autoWindow" type="xsd:boolean" use="optional" default="true" />
+	</xsd:complexType>
+	<xsd:complexType name="horzFormatType">
+		<xsd:attribute name="type" type="horzFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertFormatType">
+		<xsd:attribute name="type" type="vertFormatEnum" use="required" />
+	</xsd:complexType>
+        <xsd:complexType name="horzTextFormatType">
+		<xsd:attribute name="type" type="horzTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertTextFormatType">
+		<xsd:attribute name="type" type="vertTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="horzAlignmentType">
+		<xsd:attribute name="type" type="horzAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertAlignmentType">
+		<xsd:attribute name="type" type="vertAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="propertyType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="imageType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameImageType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="required" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="frameVertFormatType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="type" type="vertFormatEnum" use="optional" default="Stretched" />
+    </xsd:complexType>
+    <xsd:complexType name="frameHorzFormatType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="type" type="horzFormatEnum" use="optional" default="Stretched" />
+    </xsd:complexType>
+    <xsd:complexType name="frameFormatPropertyType">
+        <xsd:attribute name="component" type="frameImageComponentEnum" use="optional" default="Background" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="componentAreaType">
+        <xsd:choice>
+            <xsd:sequence>
+                <xsd:element name="Dim" type="dimensionType" minOccurs="1" maxOccurs="4" />
+            </xsd:sequence>
+            <xsd:element name="AreaProperty" type="settingByPropertyType" />
+            <xsd:element name="NamedAreaSource" type="namedAreaSourceType" />
+        </xsd:choice>
+	</xsd:complexType>
+	<xsd:complexType name="dimensionType">
+		<xsd:choice>
+			<xsd:element name="UnifiedDim" type="unifiedDimType" />
+			<xsd:element name="AbsoluteDim" type="absoluteDimType" />
+			<xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="ImagePropertyDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+            <xsd:element name="OperatorDim" type="operatorDimType" />
+		</xsd:choice>
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="fontDimType">
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="type" type="fontMetricTypeEnum" use="required" />
+        <xsd:attribute name="padding" type="xsd:decimal" use="optional" default="0" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyDimType">
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="type" type="propertyDimensionTypeEnum" use="optional" default="" />
+    </xsd:complexType>
+	<xsd:complexType name="unifiedDimType">
+		<xsd:attribute name="scale" type="xsd:decimal" use="optional" default="0" />
+		<xsd:attribute name="offset" type="xsd:integer" use="optional" default="0" />
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="absoluteDimType">
+		<xsd:attribute name="value" type="xsd:decimal" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="imageDimType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="widgetDimType">
+		<xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="operatorDimType">
+        <xsd:choice minOccurs="2" maxOccurs="2">
+			<xsd:element name="UnifiedDim" type="unifiedDimType" />
+			<xsd:element name="AbsoluteDim" type="absoluteDimType" />
+			<xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="ImagePropertyDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+            <xsd:element name="OperatorDim" type="operatorDimType" />
+        </xsd:choice>
+        <xsd:attribute name="op" type="dimensionOperatorEnum" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="settingByPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="colourRectType">
+		<xsd:attribute name="topLeft" type="colourValType" use="required" />
+		<xsd:attribute name="topRight" type="colourValType" use="required" />
+		<xsd:attribute name="bottomLeft" type="colourValType" use="required" />
+		<xsd:attribute name="bottomRight" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="colourType">
+		<xsd:attribute name="colour" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:simpleType name="colourValType">
+		<xsd:restriction base="xsd:string">
+			<xsd:pattern value="[a-fA-F0-9]{8}" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:complexType name="textStringType">
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="textPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="fontPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="namedAreaSourceType">
+        <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="eventActionType">
+        <xsd:attribute name="event" type="xsd:string" use="required" />
+        <xsd:attribute name="action" type="eventActionTypeEnum" use="required" />
+    </xsd:complexType>
+    <xsd:simpleType name="propertyDimensionTypeEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="" />
+			<xsd:enumeration value="Width" />
+			<xsd:enumeration value="Height" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="dimensionTypeEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftEdge" />
+			<xsd:enumeration value="TopEdge" />
+			<xsd:enumeration value="RightEdge" />
+			<xsd:enumeration value="BottomEdge" />
+			<xsd:enumeration value="XPosition" />
+			<xsd:enumeration value="YPosition" />
+			<xsd:enumeration value="Width" />
+			<xsd:enumeration value="Height" />
+			<xsd:enumeration value="XOffset" />
+			<xsd:enumeration value="YOffset" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:simpleType name="horzTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LeftAligned" />
+            <xsd:enumeration value="RightAligned" />
+            <xsd:enumeration value="CentreAligned" />
+            <xsd:enumeration value="Justified" />
+            <xsd:enumeration value="WordWrapLeftAligned" />
+            <xsd:enumeration value="WordWrapRightAligned" />
+            <xsd:enumeration value="WordWrapCentreAligned" />
+            <xsd:enumeration value="WordWrapJustified" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="vertTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="TopAligned" />
+            <xsd:enumeration value="BottomAligned" />
+            <xsd:enumeration value="CentreAligned" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="propertyTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Colour" />
+            <xsd:enumeration value="ColourRect" />
+            <xsd:enumeration value="UBox" />
+            <xsd:enumeration value="URect" />
+            <xsd:enumeration value="USize" />
+            <xsd:enumeration value="UDim" />
+            <xsd:enumeration value="UVector2" />
+            <xsd:enumeration value="Sizef" />
+            <xsd:enumeration value="Vector2f" />
+            <xsd:enumeration value="Vector3f" />
+            <xsd:enumeration value="Rectf" />
+            <xsd:enumeration value="Font" />
+            <xsd:enumeration value="Image" />
+            <xsd:enumeration value="Quaternion" />
+            <xsd:enumeration value="AspectMode" />
+            <xsd:enumeration value="HorizontalAlignment" />
+            <xsd:enumeration value="VerticalAlignment" />
+            <xsd:enumeration value="HorizontalTextFormatting" />
+            <xsd:enumeration value="VerticalTextFormatting" />
+            <xsd:enumeration value="WindowUpdateMode" />
+            <xsd:enumeration value="bool" />
+            <xsd:enumeration value="uint" />
+            <xsd:enumeration value="unsigned long" />
+            <xsd:enumeration value="int" />
+            <xsd:enumeration value="float" />
+            <xsd:enumeration value="double" />
+            <xsd:enumeration value="TabControl::TabPanePosition" />
+            <xsd:enumeration value="Spinner::TextInputMode" />
+            <xsd:enumeration value="ItemListBase::SortMode" />
+            <xsd:enumeration value="ListHeaderSegment::SortDirection" />
+            <xsd:enumeration value="MultiColumnList::SelectionMode" />
+            <xsd:enumeration value="VerticalFormatting" />
+            <xsd:enumeration value="HorizontalFormatting" />
+            <xsd:enumeration value="Range" />
+            <xsd:enumeration value="String" />
+            <xsd:enumeration value="Generic" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="fontMetricTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LineSpacing" />
+            <xsd:enumeration value="Baseline" />
+            <xsd:enumeration value="HorzExtent" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="dimensionOperatorEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Noop" />
+            <xsd:enumeration value="Add" />
+            <xsd:enumeration value="Subtract" />
+            <xsd:enumeration value="Multiply" />
+            <xsd:enumeration value="Divide" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="frameImageComponentEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Background" />
+            <xsd:enumeration value="TopLeftCorner" />
+            <xsd:enumeration value="TopRightCorner" />
+            <xsd:enumeration value="BottomLeftCorner" />
+            <xsd:enumeration value="BottomRightCorner" />
+            <xsd:enumeration value="LeftEdge" />
+            <xsd:enumeration value="RightEdge" />
+            <xsd:enumeration value="TopEdge" />
+            <xsd:enumeration value="BottomEdge" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="eventActionTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Redraw" />
+            <xsd:enumeration value="Layout" />
+        </xsd:restriction>
+    </xsd:simpleType>
+
+
+
+	<xsd:complexType name="animAnimationDefinitionType">
+        <xsd:sequence>
+            <xsd:element name="Affector" type="animAffectorType" minOccurs="1" maxOccurs="unbounded" />
+            <xsd:element name="Subscription" type="animSubscriptionType" minOccurs="0" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="duration" type="xsd:decimal" use="required" />
+		<xsd:attribute name="replayMode" type="animReplayModeEnum" use="optional" default="loop" />
+		<xsd:attribute name="autoStart" type="xsd:boolean" use="optional" default="false" />
+	</xsd:complexType>
+	<xsd:complexType name="animAffectorType">
+        <xsd:sequence>
+            <xsd:element name="KeyFrame" type="animKeyFrameType" minOccurs="1" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="applicationMethod" type="animApplicationMethodEnum" use="optional" default="absolute" />
+		<xsd:attribute name="property" type="xsd:string" use="required" />
+		<xsd:attribute name="interpolator" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="animKeyFrameType">
+		<xsd:attribute name="position" type="xsd:decimal" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="progression" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="sourceProperty" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+	<xsd:complexType name="animSubscriptionType">
+		<xsd:attribute name="event" type="xsd:string" use="required" />
+		<xsd:attribute name="action" type="animActionEnum" use="required" />
+	</xsd:complexType>
+    <xsd:simpleType name="animReplayModeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="once" />
+            <xsd:enumeration value="loop" />
+            <xsd:enumeration value="bounce" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animApplicationMethodEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="absolute" />
+            <xsd:enumeration value="relative" />
+            <xsd:enumeration value="relative multiply" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animProgressionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="linear" />
+            <xsd:enumeration value="discrete" />
+            <xsd:enumeration value="quadratic accelerating" />
+            <xsd:enumeration value="quadratic decelerating" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="animActionEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Start" />
+            <xsd:enumeration value="Stop" />
+            <xsd:enumeration value="Pause" />
+            <xsd:enumeration value="Unpause" />
+            <xsd:enumeration value="TogglePause" />
+        </xsd:restriction>
+    </xsd:simpleType>
+
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/Font.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Font" type="FontType" />
+
+	<xsd:complexType name="FontType">
+		<xsd:sequence>
+			<xsd:element name="Mapping" type="MapType" maxOccurs="unbounded" minOccurs="0" />
+		</xsd:sequence>
+		<xsd:attributeGroup ref="FontAttrs" />
+	</xsd:complexType>
+	<xsd:complexType name="MapType">
+		<xsd:attribute name="codepoint" type="xsd:nonNegativeInteger" use="required" />
+		<xsd:attribute name="image" type="xsd:string" use="required" />
+		<xsd:attribute name="horzAdvance" type="xsd:integer" use="optional" default="-1" />
+	</xsd:complexType>
+	<xsd:attributeGroup name="FontAttrs">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="type" use="required">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="FreeType" />
+					<xsd:enumeration value="Pixmap" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="size" type="xsd:nonNegativeInteger" use="optional" default="12" />
+		<xsd:attribute name="nativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="nativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="autoScaled" default="false">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="false" />
+					<xsd:enumeration value="vertical" />
+					<xsd:enumeration value="horizontal" />
+					<xsd:enumeration value="min" />
+					<xsd:enumeration value="max" />
+					<xsd:enumeration value="true" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="antiAlias" type="xsd:boolean" use="optional" default="true" />
+		<xsd:attribute name="lineSpacing" type="xsd:decimal" use="optional" default="0" />
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:attributeGroup>
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/GUILayout.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="GUILayout" type="GUILayoutType"/>
+	
+	<xsd:complexType name="GUILayoutType">
+		<xsd:sequence>
+			<xsd:element name="Window" type="WindowType" />
+		</xsd:sequence>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	
+	<xsd:complexType name="WindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="UserString" type="UserStringType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="type" type="xsd:string" use="required"/>
+		<xsd:attribute name="name" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="AutoWindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="namePath" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="PropertyType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="name" type="xsd:string" use="required"/>
+				<xsd:attribute name="value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+	
+	<xsd:complexType name="UserStringType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="name" type="xsd:string" use="required"/>
+				<xsd:attribute name="value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+	
+	<xsd:complexType name="LayoutImportType">
+		<xsd:attribute name="filename" type="xsd:string" use="required"/>
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="EventType">
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="function" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+</xsd:schema>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/GUIScheme.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,56 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="GUIScheme" type="SchemeType" />
+	<xsd:complexType name="SchemeType">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+			<xsd:element name="Imageset" type="NamedDataType" />
+            <xsd:element name="ImagesetFromImage" type="NamedDataType" />
+			<xsd:element name="Font" type="NamedDataType" />
+            <xsd:element name="LookNFeel" type="FileDataType" />
+			<xsd:element name="WindowSet" type="WindowSetType" />
+			<xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
+			<xsd:element name="WindowAlias" type="WindowAliasType" />
+            <xsd:element name="FalagardMapping" type="FalagardMapType" />
+		</xsd:choice>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FileDataType">
+        <xsd:attribute name="filename" type="xsd:string" use="required" />
+        <xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+    </xsd:complexType>
+	<xsd:complexType name="NamedDataType">
+		<xsd:attribute name="name" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="filename" type="xsd:string" use="required" />
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowFactoryType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererFactoryType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowAliasType">
+		<xsd:attribute name="alias" type="xsd:string" use="required" />
+		<xsd:attribute name="target" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FalagardMapType">
+        <xsd:attribute name="windowType" type="xsd:string" use="required" />
+        <xsd:attribute name="targetType" type="xsd:string" use="required" />
+		<xsd:attribute name="renderer" type="xsd:string" use="required" />
+        <xsd:attribute name="lookNFeel" type="xsd:string" use="required" />
+        <xsd:attribute name="renderEffect" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/resources/gui_0.8/xml_schemas/Imageset.xsd	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="Imageset" type="ImagesetType"/>
+	
+	<xsd:complexType name="ImagesetType">
+		<xsd:sequence>
+			<xsd:element name="Image" type="ImageType" maxOccurs="unbounded"/>
+		</xsd:sequence>
+		<xsd:attribute name="imagefile" type="xsd:string" use="required"/>
+		<xsd:attribute name="resourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="nativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="nativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="autoScaled" default="false">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="false" />
+					<xsd:enumeration value="vertical" />
+					<xsd:enumeration value="horizontal" />
+					<xsd:enumeration value="min" />
+					<xsd:enumeration value="max" />
+					<xsd:enumeration value="true" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="optional" default="0" />
+	</xsd:complexType>
+	
+	<xsd:complexType name="ImageType">
+        <xsd:sequence>
+            <xsd:any minOccurs="0" processContents="skip" maxOccurs="unbounded" />
+        </xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required"/>
+		<xsd:attribute name="type" type="xsd:string" use="optional" default="BasicImage" />
+		<xsd:anyAttribute processContents="skip" />
+	</xsd:complexType>
+
+</xsd:schema>
Binary file share/resources/gui_common/imagesets/CharacterScreen.png has changed
Binary file share/resources/gui_common/imagesets/ControlPanel.png has changed
Binary file share/resources/gui_common/imagesets/Inventory.png has changed
Binary file share/resources/gui_common/imagesets/OptionsWindow.png has changed
Binary file share/resources/gui_common/imagesets/Resummoned.png has changed
Binary file share/resources/gui_common/imagesets/ResummonedCursors.png has changed
Binary file share/resources/gui_common/imagesets/SWB.png has changed
Binary file share/resources/gui_common/imagesets/SWBCursors.png has changed
Binary file share/resources/gui_common/imagesets/SkillTree.png has changed
Binary file share/resources/gui_common/imagesets/SumWarsExtras.png has changed
Binary file share/resources/gui_common/imagesets/SumWarsLogo.png has changed
Binary file share/resources/gui_common/imagesets/TaharezLook.png has changed
Binary file share/resources/gui_common/imagesets/TaharezLook.tga has changed
Binary file share/resources/gui_common/imagesets/TradeWindow.png has changed
Binary file share/resources/gui_common/imagesets/main_menu.png has changed
Binary file share/resources/gui_common/imagesets/misc.png has changed
Binary file share/resources/gui_common/imagesets/portrait.png has changed
Binary file share/resources/gui_common/imagesets/skills.png has changed
Binary file share/resources/gui_common/imagesets/worldMap.png has changed
Binary file share/resources/music/goblin_rituals.ogg has changed
Binary file share/resources/music/reluctant_hero.ogg has changed
Binary file share/resources/sound/gui_sound_effects/menu_click_deep.wav has changed
Binary file share/resources/sound/gui_sound_effects/menu_click_item.wav has changed
Binary file share/resources/sound/gui_sound_effects/menu_hover_deep.wav has changed
Binary file share/resources/sound/gui_sound_effects/menu_hover_item.wav has changed
Binary file share/resources/sound/gui_sound_effects/menu_item_horn.wav has changed
Binary file share/resources/sound/gui_sound_effects/menu_time_click.wav has changed
Binary file share/resources/sound/skill_sound_effects/hero_level_up.wav has changed
--- a/src/core/action.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/action.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -62,7 +62,7 @@
 	}
 	else
 	{
-		DEBUG("Failed to load file %s", pFilename);
+		SW_DEBUG("Failed to load file %s", pFilename);
 		return false;
 	}
 }
@@ -216,7 +216,7 @@
 			}
 			else if (child->Type()!=TiXmlNode::TINYXML_COMMENT)
 			{
-				DEBUG("unexpected element of <Ability>: %s",child->Value());
+				SW_DEBUG("unexpected element of <Ability>: %s",child->Value());
 			}
 		}
 	}
--- a/src/core/action.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/action.h	Thu Mar 20 19:04:28 2014 +0100
@@ -30,7 +30,7 @@
 
 /**
  * \struct Action
- * \brief Beschreibt eine Aktion, welche eine Figur ausf&uuml;hren kann. Eine Aktion ist dabei die kleinste Einheit einer Handlung.
+ * \brief Describes an action which an actor can perform. An action is the smallest unit of an act.
  */
 struct Action {
 //Public stuff
@@ -39,14 +39,14 @@
 
 	/**
 	 * \enum ActionType
-	 * \brief Aufzaehlung verschiedener Aktionen
+     * \brief Enum of different actions
 	 */
 
 	typedef  std::string ActionType;
 
 	/**
 	 * \enum TargetType
-	 * \brief Aufzaehlung verschiedener Zieltypen fuer Aktionen
+     * \brief Enum of different target types for actions
 	 */
 	enum TargetType
 	{
@@ -62,7 +62,7 @@
 
 	/**
 	 * \enum Flags
-	 * \brief Aufzaehlung von Sondereigenschaften von Aktionen
+     * \brief Enum of special properties of actions
 	 */
 	enum Flags
 	{
@@ -71,129 +71,129 @@
 
 	/**
 	 * \struct ActionInfo
-	 * \brief Enthaelt einige grundlegende Informationen zu einer Aktion
+     * \brief Holds basic information for an action
 	 */
 	struct ActionInfo
 	{
 		/**
 		 * \var int m_timer_nr
-		 * \brief Nummer des Timers, der bei benutzen der Aktion gestartet wird. Moegliche Werte sind 0,1,2
+         * \brief Number of the timer which will be started with the action. Prossible values are 1, 2 ,3
 		 */
 		int m_timer_nr;
 
 		/**
 		 * \var float m_standard_time
-		 * \brief Zeit in ms, die die Aktion ohne Modifikatoren in Anspruch nimmt
+         * \brief Time the action lasts in ms, not affected by any modifications
 		 */
 		float m_standard_time;
 
 		/**
 		 * \var float m_timer
-		 * \brief Gibt die Zeitdauer in ms an, die der Timer laeuft, der beim Benutzen dieser Aktion gestartet wird.
+         * \brief Current running time since start of the action
 		 */
 		float m_timer;
 
 		/**
 		 * \var ActionType m_base_action
-		 * \brief Gibt die Aktion an, die stattdessen ausgefuehrt wird, wenn die Aktion selbst nicht benutzt werden kann weil der Timer noch lauft
+         * \brief Holds the action that will be performed instead when the timer is running
 		 */
 		ActionType m_base_action;
 
 		/**
 		 * \var float m_critial_perc
-		 * \brief Prozentsatz zu dem die Aktion abgeschlossen ist, wenn der eigentliche Effekt der Aktion ausgeloest wird
+         * \brief Percentage of completion when the actual effect will be executed
 		 */
 		float m_critical_perc;
 
 		/**
 		 * \var TargetType m_target_type
-		 * \brief Gibt die Art des Zielobjekts an
+         * \brief Type of the target object
 		 */
 		TargetType m_target_type;
 
 		/**
 		 * \var char m_flags
-		 * \brief verschiedene Eigenschaften der Aktion in Bitkodierung
+         * \brief different properties of the action in bit encoded
 		 */
 		char m_flags;
 
 		/**
 		 * \var std::string m_name
-		 * \brief Name der Aktion
+         * \brief Name of the action
 		 */
 		std::string m_name;
 
 		/**
 		 * \var std::string m_description
-		 * \brief Abkuerzung der Beschreibung als String
+         * \brief Shortcut of the description as a string
 		 **/
 		std::string m_description;
 
 		/**
 		 * \var float m_radius
-		 * \brief Wirkungsradius der Aktion. Genaue Verwendung des Wertes haengt von der Implementation der Aktion ab
+         * \brief Effective radius of the action. Exact value is dependand of the implementation.
 		 */
 		float m_radius;
 
 
 		/**
 		 * \var std::string m_projectile_type
-		 * \brief Typ eines erzeugten Geschosses
+         * \brief Type of the created projectile.
 		 */
 		std::string m_projectile_type;
 
 		/**
 		 * \var float m_projectile_speed
-		 * \brief Geschwindigkeit des Geschosses
+         * \brief Speed of the projectile
 		 */
 		float m_projectile_speed;
 
 		/**
 		 * \var char m_projectile_flags
-		 * \brief Flags des Geschosses
+         * \brief Flags of the projectile
 		 */
 		char m_projectile_flags;
 
 		/**
 		 * \var int m_projectile_counter
-		 * \brief Zaehler fuer das Geschoss. Genaue Verwendung haengt vom Geschosstyp ab
+         * \brief Counter of the projectile. Exact usage is dependand on the implementation.
 		 */
 		int m_projectile_counter;
 
 		/**
 		 * \var float m_projectile_radius
-		 * \brief Radius eines Geschosses
+         * \brief Radius of the projectile
 		 */
 		float m_projectile_radius;
 
 		/**
 		 * \var HybridImplementation m_effect
-		 * \brief Effekt der Aktion
+         * \brief Effect of the action
 		 */
 		HybridImplementation m_effect;
 
 		/**
 		 * \var HybridImplementation m_damage
-		 * \brief Schaden der Aktion
+         * \brief Damage of the action
 		 */
 		HybridImplementation m_damage;
 
 		/**
 		 * \var HybridImplementation m_base_mod
-		 * \brief BasisModifikation der Aktion
+         * \brief Base modifications of the action
 		 */
 		HybridImplementation m_base_mod;
 
 		/**
 		 * \var HybridImplementation m_dyn_mod
-		 * \brief Modifikation dynamischer Attribute durch die Aktion
+         * \brief Modification of dynamic attributes through this action.
 		 */
 		HybridImplementation m_dyn_mod;
 	};
 
 	/**
 	 * \fn enum ActionEquip
-	 * \brief Aufzaehlung, welche Ausruestungsgegenstaende fuer die Aktion verwendet werden
+     * \brief Enum which equipment items will be used for the action.
 	 */
 	enum ActionEquip
 	{
@@ -206,8 +206,8 @@
 	//Constructors
 	/**
 	 * \fn Action(ActionType type)
-	 * \brief Legt ein neues Action Objekt an
-	 * \param type initialisiert den Typ der Aktion
+     * \brief Constructs a new action object
+     * \param type Initializes the action type
 	 */
 	Action(ActionType type = "noaction"):
 		m_elapsed_time(0),
@@ -219,21 +219,21 @@
 
 	/**
 	 * \fn static void init()
-	 * \brief initialisiert die statischen Variablen
+     * \brief Initializes the static variables
 	 */
 	static void init();
 
 	/**
 	 * \fn static void cleanup()
-	 * \brief loescht alle Daten
+     * \brief Deletes all data
 	 */
 	static void cleanup();
 
 	/**
 	 * \fn static ActionInfo* getActionInfo(ActionType type)
-	 * \brief Gibt zu einer Aktion die Basisinformationen aus
-	 * \param type die Aktion
-	 * \return Zeiger auf die Daten
+     * \brief Returns the base information of an action
+     * \param type Type of the action
+     * \return Pointer to the action
 	 */
 	static ActionInfo* getActionInfo(ActionType type)
 	{
@@ -247,68 +247,68 @@
 
 	/**
 	 * \fn static std::string getName(ActionType type)
-	 * \brief Gibt zu einer Aktion den Namen aus
-	 * \param type die Aktion
-	 * \return Name der Aktion
+     * \brief Returns the name of the action
+     * \param type Type of the action
+     * \return Name of the action
 	 */
 	static std::string getName(ActionType type);
 
 	/**
 	 * \fn static std::string getDescription(ActionType type)
-	 * \brief Gibt zu einer Aktion die Beschreibung aus
-	 * \param type die Aktion
-	 * \return Beschreibung der Aktion
+     * \brief Returns the description of an action
+     * \param type Type of the action
+     * \return Description of the action
 	 */
 	static std::string getDescription(ActionType type);
 
 	/**
 	 * \fn static ActionType getType(std::string name)
-	 * \brief Gibt zu einem Name einer Aktion den enum Wert aus
-	 * \param name Name der Aktion
+     * \brief Returns the enum value to an action name
+     * \param name Name of the action
 	 */
 	static ActionType getActionType(std::string name);
 
 	/**
 	 * \fn void toString(CharConv* cv)
-	 * \brief Konvertiert das Objekt in einen String und schreibt ihn in der Puffer
-	 * \param cvAusgabepuffer
+     * \brief Converts the object into a string and writes it to the buffer
+     * \param cv Output buffer
 	 */
 	void toString(CharConv* cv);
 
 
 	/**
 	 * \fn void fromString(CharConv* cv)
-	 * \brief Erzeugt das Objekt aus einem String
-	 * \param cv Eingabepuffer
+     * \brief Creates the object from a string
+     * \param cv input buffer
 	 */
 	void fromString(CharConv* cv);
 
 	/**
 	 * \fn static void loadAbilities(TiXmlNode* node)
-	 * \brief Laedt die Faehigkeiten aus dem angegebenen XML Dokument
-	 * \param node XML Dokument
+     * \brief Loads the abilities for an action for an XML document
+     * \param node XML document
 	 */
 	static void loadAbilities(TiXmlNode* node);
 
 	/**
 	 * \fn 	static void loadAbility(TiXmlNode* node)
-	 * \brief Laedt eine Faehigkeit aus dem angegebenen XML Knoten
-	 * \param node XML Knoten
+     * \brief Loads the abilities from an XML node
+     * \param node XML node
 	 */
 	static void loadAbility(TiXmlNode* node);
 
 	/**
 	 * \fn loadAbilityData(const char* pFilename);
-	 * \brief Liest die Daten zu einer Faehigkeit aus einer XML Datei
-	 * \param pFilename Name der XML Datei
+     * \brief Loads data for an ability from an XML file
+     * \param pFilename Name of the XML file
 	 */
 	static bool loadAbilityData(const char* pFilename);
 
 	/**
 	 * \fn static bool loadHybridImplementation(TiXmlNode* node, HybridImplementation& impl)
-	 * \brief laedt Daten fuer eine hybride Implementation
-	 * \param node XML Knoten
-	 * \param impl Struktur in die die Daten geladen werden
+     * \brief Loads data for a hybrid implementation
+     * \param node XML node
+     * \param impl Input structure in which the data will be loaded
 	 */
 	static bool loadHybridImplementation(TiXmlNode* node, HybridImplementation& impl);
 
@@ -317,44 +317,44 @@
 	//Fields
 	/**
 	 * \var m_type;
-	 * \brief Typ der Aktion
+     * \brief Type of the action
 	 */
 	ActionType m_type;
 
 	/**
 	 * \var m_elapsed_time;
-	 * \brief bereits vergangene Zeit der Aktion
+     * \brief Elapsed time
 	*/
 	float m_elapsed_time;
 
 	/**
 	 * \var m_time;
-	 * \brief Gesamtdauer der Aktion
+     * \brief Finish time of the action
 	 */
 	float m_time;
 
 	/**
 	 * \var ActionEquip m_action_equip
-	 * \brief Ausruestung mit der die Aktion ausgefuehrt wird
+     * \brief Equipment type with which the action will be executed
 	 */
 	ActionEquip m_action_equip;
 
 
 	/**
 	 * \var Vector m_goal
-	 * \brief Ziel der Aktion
+     * \brief Goal of the action
 	 */
 	Vector m_goal;
 
 	/**
 	 * \var m_goal_object_id;
-	 * \brief ID des Zielobjekts
+     * \brief ID of the target object
 	 */
 	int  m_goal_object_id;
 
 	/**
 	 * \var static std::map<ActionType,ActionInfo> m_action_info
-	 * \brief Enthaelt Basisinformationen fuer alle Aktionen
+     * \brief Holds base information for all actions
 	 */
 	static std::map<ActionType,ActionInfo> m_action_info;
 
--- a/src/core/command.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/command.h	Thu Mar 20 19:04:28 2014 +0100
@@ -24,7 +24,7 @@
 
 /**
  * \class Command
- * \brief Beschreibt ein Kommando, welches eine Figur erhalten kann. Zur Ausf&uuml;hrung des Kommandos wird die Anweisung in mehrere Aktionen unterteilt, die hintereinander ausgefuehrt werden.
+ * \brief Describes an action which an actor can receive. The execution will be split into multiple actions which will be executed sequentially
  */
 class Command {
 /**
@@ -44,11 +44,11 @@
 	 */
 	/**
 	 * \fn Command(Action::ActionType type, Vector goal, int goal_object_id)
-	 * \brief Konstruktor
-	 * \param type initialisiert den Typ des Kommandos
-	 * \param goal Zielpunkt der Aktion
-	 * \param goal_object_id initialisiert ID des Zielobjekts
-	 * Legt ein neues Command Objekt an
+     * \brief Constructor
+     * \param type Initializes the type of the command
+     * \param goal Goal of the command
+     * \param goal_object_id Initializes the ID of the goal object
+     * Creates a new command object
 	 */
 	Command(Action::ActionType type, Vector goal, int goal_object_id)
 	{
@@ -62,7 +62,7 @@
 
 	/**
 	 * \fn Command()
-	 * \brief Konstruktor
+     * \brief Constructor
 	 */
 	Command()
 	{
@@ -76,27 +76,27 @@
 
 	/**
 	 * \fn void toString(CharConv* cv)
-	 * \brief Konvertiert das Objekt in einen String und schreibt ihn in der Puffer
-	 * \param cv Eingabepuffer
+     * \brief Converts the object into a string and writes it to the buffer
+     * \param cv output buffer
 	 */
 	void toString(CharConv* cv);
 
 	/**
 	 * \fn void fromString(CharConv* cv)
-	 * \brief Erzeugt das Objekt aus einem String
-	 * \param cv Ausgabepuffer
+     * \brief Creates the object from a string
+     * \param cv input buffer
 	 */
 	void fromString(CharConv* cv);
 
 	/**
 	 * \fn bool operator!=(Command& other)
-	 * \brief Vergleichsoperator auf Ungleichheit
+     * \brief not equals operator
 	 */
 	bool operator!=(Command& other);
 
 	/**
 	 * \fn void operator=(Command& other)
-	 * \brief Zuweisungsoperator
+     * \brief assignment operator
 	 */
 	void operator=(Command& other);
 
@@ -105,37 +105,37 @@
 	 */
 	/**
 	 * \var m_type
-	 * \brief Typ des Kommandos
+     * \brief Type of the command
 	 */
 	 Action::ActionType m_type;
 
 	/**
 	 * \var Vector m_goal
-	 * \brief Ziel des Kommandos
+     * \brief Goald of the command
 	 */
 	Vector m_goal;
 
 	/**
 	 * \var m_goal_object_id
-	 * \brief ID des Zielobjekts
+     * \brief ID of the goal object
 	 */
 	int  m_goal_object_id;
 
 	/**
 	 * \var float m_range
-	 * \brief Reichweite der Aktion
+     * \brief Range of the action
 	 */
 	float m_range;
 
 	/**
 	 * \var m_damage_mult;
-	 * \brief Multiplikator auf den Schaden der die Aktion abschließt
+     * \brief Multiplyer to the damage resulting from this action
 	 */
 	float m_damage_mult;
 
 	/**
 	 * \var char m_flags
-	 * \brief bitkodierte Flags
+     * \brief bit encoded flags
 	 */
 	char m_flags;
 	/**
--- a/src/core/creature.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/creature.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -27,7 +27,7 @@
 {
 	if (!Creature::init())
 	{
-		DEBUG("Creature::init() hat false zurückgeliefert");
+		SW_DEBUG("Creature::init() hat false zurückgeliefert");
 	}
 }
 
@@ -246,13 +246,13 @@
 		Action::ActionInfo* aci = Action::getActionInfo(action);
 		if (aci ==0)
 		{
-			DEBUG("Information for action %s missing ",action.c_str());
+			SW_DEBUG("Information for action %s missing ",action.c_str());
 			return 0;
 		}
 
 		return aci->m_standard_time;
 	}
-	DEBUG("creature %s cant use action %s",getSubtype().c_str(), action.c_str());
+	SW_DEBUG("creature %s cant use action %s",getSubtype().c_str(), action.c_str());
 	return 0;
 }
 
@@ -280,7 +280,7 @@
 		{
 			// use the base action
 			m_action.m_type = aci->m_base_action;
-			DEBUG("using Base Action due to mute");
+			SW_DEBUG("using Base Action due to mute");
 		}
 	}
 
@@ -2216,7 +2216,7 @@
 
 	if (m_action.m_elapsed_time> m_action.m_time)
 	{
-		DEBUG("elapsed time %f all time %f",m_action.m_elapsed_time,	m_action.m_time);
+		SW_DEBUG("elapsed time %f all time %f",m_action.m_elapsed_time,	m_action.m_time);
 	}
 
 	DEBUGX("Update des Creatureobjekts [%i] wird gestartet", getId());
@@ -4050,7 +4050,7 @@
 
 	if (delay>1000)
 	{
-		DEBUG("got packet with delay %f %f",cv->getDelay(),delay);
+		SW_DEBUG("got packet with delay %f %f",cv->getDelay(),delay);
 	}
 
 
--- a/src/core/damage.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/damage.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -250,7 +250,9 @@
 		if (m_max_damage[i]>0)
 		{
 			if (!first)
+			{
 				out_stream << "\n";
+			}
 
 			if (magic_mods && magic_mods->test(ItemFactory::DAMAGE_PHYS_MOD+ elemmap[i])) 
 				out_stream << rarityColor;
@@ -288,6 +290,7 @@
 				out_stream << defaultColor;
 		}
 	}
+
 	if (usage != NORMAL)
 	{
 		// Attackewert anzeigen
@@ -329,7 +332,7 @@
 				if (magic_mods && magic_mods->test(ItemFactory::POWER_MOD)) 
 					out_stream << rarityColor;
 				
-				out_stream <<gettext("Power")<<": "<<(int) m_power << "\n";
+				out_stream <<gettext("Power")<<": "<<(int) m_power;// << "\n";
 				
 				if (magic_mods && magic_mods->test(ItemFactory::POWER_MOD)) 
 					out_stream << defaultColor;
--- a/src/core/debug.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/debug.h	Thu Mar 20 19:04:28 2014 +0100
@@ -64,7 +64,7 @@
  * \def DEBUG( format, ... )
  * \brief Gibt Debug-Informationen aus
  */
-#define DEBUG( format, ... ) \
+#define SW_DEBUG( format, ... ) \
 	LOGGER( Log::MSG_DEBUG,format, ##__VA_ARGS__ )
 
 
--- a/src/core/document.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/document.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -21,8 +21,9 @@
 #include "fstream"
 #include "document.h"
 
-#include "sound.h"
-#include "music.h"
+// TODO: remove when no longer needed.
+//#include "sound.h"
+//#include "music.h"
 
 #include "networkstruct.h"
 #include "projectile.h"
@@ -46,6 +47,11 @@
 
 #include <physfs.h>
 
+// Sound operations helper.
+#include "soundhelper.h"
+
+#include "ceguiutility.h"
+
 #ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
 #include "onlineservicesmanager.h"
 #include "OgreResourceGroupManager.h"
@@ -129,10 +135,10 @@
 	m_state = LOAD_SAVEGAME;
 }
 
-void Document::setSaveFile(std::string s)
+void Document::setSaveFile(std::string saveFile)
 {
 	// we are using std::streams here, not PHYSFS, therefore we also have to use absolute paths
-	std::string savePath = SumwarsHelper::getStorageBasePath() + "/" + SumwarsHelper::savePath() + "/" + s;
+	std::string savePath = SumwarsHelper::getStorageBasePath() + "/" + SumwarsHelper::savePath() + "/" + saveFile;
 
 	std::fstream file(savePath.c_str(),std::ios::in| std::ios::binary);
 	if (file.is_open())
@@ -141,7 +147,7 @@
 		unsigned char* data=0;
 		m_save_file = savePath;
 
-		DEBUG ("Loaded save file %s", s.c_str());
+		SW_DEBUG ("Loaded save file %s", saveFile.c_str());
 
 		file.get(bin);
 
@@ -168,7 +174,7 @@
 		if (data)
 			delete[] data;
 		
-		Options::getInstance()->setDefaultSavegame(s);
+		Options::getInstance()->setDefaultSavegame (saveFile);
 	}
 	else
 	{
@@ -177,7 +183,7 @@
 			delete m_temp_player;
 			m_temp_player =0;
 		}
-		WARNING("Could not load file %s", s.c_str());
+		WARNING("Could not load file [%s]", saveFile.c_str());
 	}
 	m_modified |= SAVEGAME_MODIFIED;
 	file.close();
@@ -187,7 +193,7 @@
 {
 	// read savegame
 	std::string fname = m_save_file;
-	DEBUG("savegame is %s",fname.c_str());
+	SW_DEBUG("savegame is %s",fname.c_str());
 
 	std::fstream file(fname.c_str(),std::ios::in| std::ios::binary);
 	if (file.is_open())
@@ -229,7 +235,7 @@
 		}
 
 		m_temp_player->toSavegame(&cv2);
-		DEBUG("sending savegame");
+		SW_DEBUG("sending savegame");
 		World::getWorld()->handleSavegame(&cv2);
 		DEBUGX("sent savegame");
 
@@ -390,6 +396,8 @@
 	getGUIState()->m_shown_windows = SAVE_EXIT;
 	m_modified |= WINDOWS_MODIFIED;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	if (m_state == INACTIVE)
 	{
 		saveSettings();
@@ -400,7 +408,7 @@
 
 void Document::onButtonSaveExitConfirm()
 {
-
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 
 	if (m_state!=SHUTDOWN_REQUEST)
 	{
@@ -431,12 +439,16 @@
 
 void Document::onButtonSaveExitAbort()
 {
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	getGUIState()->m_shown_windows = CONTROL_PANEL;
 	m_modified |= WINDOWS_MODIFIED;
 }
 
 void Document::onButtonCredits()
 {
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	getGUIState ()->m_shown_windows = CREDITS;
 	m_modified = WINDOWS_MODIFIED;
 }
@@ -825,7 +837,7 @@
 	if (m_temp_player == 0)
 	{
 		showWarning (gettext("Please select a character first!"));
-		DEBUG ("Warning: Tried to start a game without a selected char!");
+		SW_DEBUG ("Warning: Tried to start a game without a selected char!");
 		return;
 	}
 	
@@ -841,18 +853,18 @@
 
 void Document::onButtonHostGame()
 {
-	DEBUG("Host Game");
+	SW_DEBUG("Host Game");
 	if (m_temp_player == 0)
 	{
 		// Show a notification.
 		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("WarningDialogWindow");
+		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow("WarningDialogWindow");
 		message->setInheritsAlpha(false);
 		message->setVisible(true);
 		message->setModalState(true);
-		win_mgr.getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("Please select a character first!"));
+		CEGUIUtility::getWindow ("WarningDialogWindow/WarningDialogLabel")->setText((CEGUI::utf8*) gettext ("Please select a character first!"));
 
-		DEBUG ("Warning: Tried to host a game without a selected char!");
+		SW_DEBUG ("Warning: Tried to host a game without a selected char!");
 		return;
 	}
 	getGUIState()->m_shown_windows |= HOST_GAME;
@@ -867,13 +879,13 @@
 	{
 		// Show a notification.
 		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("WarningDialogWindow");
+		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow("WarningDialogWindow");
 		message->setInheritsAlpha(false);
 		message->setVisible(true);
 		message->setModalState(true);
-		win_mgr.getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("Please select a character first!"));
+		CEGUIUtility::getWindow ("WarningDialogWindow/WarningDialogLabel")->setText((CEGUI::utf8*) gettext("Please select a character first!"));
 
-		DEBUG ("Warning: Tried to join a game without a selected char!");
+		SW_DEBUG ("Warning: Tried to join a game without a selected char!");
 		return;
 	}
 	getGUIState()->m_shown_windows |= JOIN_GAME;
@@ -883,7 +895,7 @@
 
 void Document::onButtonStartHostGame()
 {
-	DEBUG("start multiplayer game");
+	SW_DEBUG("start multiplayer game");
 	// Spieler ist selbst der Host
 	setServer(true);
 	m_single_player = false;
@@ -908,6 +920,7 @@
 	if (!checkSubwindowsAllowed())
 		return;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 	
 	getGUIState()->m_shown_windows ^= INVENTORY;
 	if (getGUIState()->m_shown_windows & INVENTORY)
@@ -939,6 +952,7 @@
 	if (!checkSubwindowsAllowed())
 		return;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 	
 	getGUIState()->m_shown_windows ^= CHARINFO;
 	if (getGUIState()->m_shown_windows & CHARINFO)
@@ -955,6 +969,8 @@
 	if (!checkSubwindowsAllowed())
 		return;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	getGUIState()->m_shown_windows ^= PARTY;
 	// PartyInfo oeffnen wenn es gerade geschlossen ist und schliessen, wenn er geoeffnet ist
 	if (getGUIState()->m_shown_windows & PARTY)
@@ -974,6 +990,8 @@
 	if (!checkSubwindowsAllowed())
 		return;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	getGUIState()->m_shown_windows ^= SKILLTREE;
 	if (getGUIState()->m_shown_windows & SKILLTREE)
 	{
@@ -997,6 +1015,8 @@
 
 void Document::onButtonOpenChatClicked()
 {
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	// fuer Debugging sehr nuetzlich, das zuzulassen
 	//if (!checkSubwindowsAllowed())
 	//		return;
@@ -1012,6 +1032,8 @@
 	if (!checkSubwindowsAllowed())
 		return;
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	getGUIState()->m_shown_windows ^= QUEST_INFO;
 	// Charakterinfo oeffnen wenn es gerade geschlossen ist und schliessen, wenn es geoeffnet ist
 	if (getGUIState()->m_shown_windows & QUEST_INFO)
@@ -1037,9 +1059,11 @@
 
 void Document::onButtonOptionsClicked()
 {
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	if (!checkSubwindowsAllowed() && getGUIState()->m_sheet ==  Document::GAME_SCREEN)
 	{
-		DEBUG ("Subwindows are allowed, and Current state: GAME_SCREEN; so you're not allowed to toggle this window... for some reason");
+		SW_DEBUG ("Subwindows are allowed, and Current state: GAME_SCREEN; so you're not allowed to toggle this window... for some reason");
 		return;
 	}
 
@@ -1047,7 +1071,7 @@
 	// Opened windows have changed.
 	m_modified |= WINDOWS_MODIFIED;
 
-	DEBUG ("Set internal state data for options button toggle");
+	SW_DEBUG ("Set internal state data for options button toggle");
 }
 
 
@@ -1183,6 +1207,11 @@
 
 void Document::setRightAction(Action::ActionType act)
 {
+	// Make sure that the world pointer is not a null.
+	if (! World::getWorld ())
+	{
+		return;
+	}
 
 	// wenn kein Spieler gesetzt ist, dann keine Faehigkeit setzen
 	// der lokale Spieler
@@ -1963,17 +1992,17 @@
 {
 	// Show a notification.
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	if (! win_mgr.isWindowPresent ("WarningDialogWindow"))
+	if (! CEGUIUtility::isWindowPresent ("WarningDialogWindow"))
 	{
-		DEBUG ("Could not display the warning widget: [WarningDialogWindow]");
+		SW_DEBUG ("Could not display the warning widget: [WarningDialogWindow]");
 		return;
 	}
 
-	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("WarningDialogWindow");
+	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow("WarningDialogWindow");
 	message->setInheritsAlpha(false);
 	message->setVisible(true);
 	message->setModalState(true);
-	win_mgr.getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) textMessage.c_str ());
+	CEGUIUtility::getWindow ("WarningDialogWindow/WarningDialogLabel")->setText((CEGUI::utf8*) textMessage.c_str ());
 
 	getGUIState()->m_shown_windows |= MESSAGE;
 	m_modified |= WINDOWS_MODIFIED;
@@ -1986,9 +2015,9 @@
 	// Show a notification.
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 
-	if (win_mgr.isWindowPresent ("WarningDialogWindow"))
+	if (CEGUIUtility::isWindowPresent ("WarningDialogWindow"))
 	{
-		CEGUI::Window* widget = win_mgr.getWindow("WarningDialogWindow");
+		CEGUI::Window* widget = CEGUIUtility::getWindow("WarningDialogWindow");
 		if (widget->isVisible ())
 		{
 			widget->setVisible (false);
@@ -2008,13 +2037,14 @@
 {
 	// Show a notification.
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	if (! win_mgr.isWindowPresent ("QuestionInfoRoot"))
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget ("MainMenu/MainMenuRoot/QuestionInfoRoot");
+	if (! CEGUIUtility::isWindowPresent (widgetName))
 	{
-		DEBUG ("Could not display the warning widget: [QuestionInfoRoot]");
+		SW_DEBUG ("Could not display the warning widget: [%s]", widgetName.c_str ());
 		return;
 	}
 
-	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("QuestionInfoRoot");
+	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::getWindow (widgetName);
 	message->setInheritsAlpha(false);
 	message->setVisible(true);
 	message->setModalState(true);
@@ -2029,10 +2059,10 @@
 {
 	// Show a notification.
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	if (win_mgr.isWindowPresent ("QuestionInfoRoot"))
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget ("MainMenu/MainMenuRoot/QuestionInfoRoot");
+	if (CEGUIUtility::isWindowPresent (widgetName))
 	{
-		CEGUI::Window* widget = win_mgr.getWindow("QuestionInfoRoot");
+		CEGUI::Window* widget = CEGUIUtility::getWindow (widgetName);
 		if (widget && widget->isVisible ())
 		{
 			widget->setVisible (false);
@@ -2046,4 +2076,4 @@
 		getGUIState()->m_shown_windows ^= QUESTION_DIALOG;
 		m_modified |= WINDOWS_MODIFIED;
 	}
-}
\ No newline at end of file
+}
--- a/src/core/eventsystem.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/eventsystem.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -26,11 +26,14 @@
 #include "dialogue.h"
 #include "scriptobject.h"
 #include "options.h"
-#include "sound.h"
+//#include "sound.h"
 #include "sumwarshelper.h"
 #include <algorithm> 
 #include <cctype>
 
+// Helper for sound operations
+#include "soundhelper.h"
+
 #ifdef DEBUG_DATABASE
 		std::map<int, std::string> EventSystem::m_code_fragments;
 #endif
@@ -382,7 +385,7 @@
 		}
 		if (reg ==0)
 		{
-			DEBUG("region for timedExecute does not exist");
+			SW_DEBUG("region for timedExecute does not exist");
 			return 0;
 		}
 		
@@ -1474,7 +1477,7 @@
 		if (m_region !=0)
 		{
 			WorldObject* wo = m_region->getObjectAt(pos);
-			DEBUG("pos %f %f wo %p",pos.m_x, pos.m_y,wo);
+			SW_DEBUG("pos %f %f wo %p",pos.m_x, pos.m_y,wo);
 			if (wo !=0)
 			{
 				lua_pushnumber(L,wo->getId());
@@ -2510,7 +2513,7 @@
 			bool repeat = lua_toboolean(L, 4);
 			if (repeat)
 			{
-				DEBUG("repeat");
+				SW_DEBUG("repeat");
 				txt="#animation_r#";
 			}
 		}
@@ -2901,7 +2904,7 @@
 		}
 		if (reg ==0)
 		{
-			DEBUG("region for createEvent does not exist");
+			SW_DEBUG("region for createEvent does not exist");
 			return 0;
 		}
 		
@@ -3080,7 +3083,8 @@
 	int argc = lua_gettop(L);
 	if (argc>=1 && lua_isstring(L,1))
 	{
-		SoundName sname = lua_tostring(L,1);
+		std::string sname = lua_tostring(L,1);
+		//SoundName sname = lua_tostring(L,1);
 		float volume = 1.0;
 		if (argc>=2 && lua_isnumber(L,2))
 		{
@@ -3095,7 +3099,13 @@
 			ppos = &position;
 		}
 		
-		SoundSystem::playAmbientSound(sname, volume, ppos);
+		//SoundSystem::playAmbientSound(sname, volume, ppos);
+		float posX = position.m_x;
+		float posY = position.m_y;
+		float posZ = 0.0;
+		SoundHelper::playSoundGroupAtPosition (sname, posX, posY, posZ);
+
+
 	}
 	else
 	{
--- a/src/core/fixedobject.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/fixedobject.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -21,7 +21,7 @@
 	bool tmp=FixedObject::init();
 	if (!tmp)
 	{
-		DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!");
+		SW_DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!");
 	}
 }
 
@@ -33,7 +33,7 @@
 	bool tmp=FixedObject::init();
 	if (!tmp)
 	{
-		DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!");
+		SW_DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!");
 	}
 }
 
--- a/src/core/gettext.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/gettext.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -133,7 +133,7 @@
          locale = loc;
     }
 
-    DEBUG ("set new language [%s]",locale.c_str());
+    SW_DEBUG ("set new language [%s]",locale.c_str());
 
 	if (locale != m_locale)
 	{
@@ -159,7 +159,7 @@
 
 			if (setWinThreadLocale (win_locale) == 0)
 			{
-				DEBUG ("Could not change locale to %s", win_locale.c_str ());
+				SW_DEBUG ("Could not change locale to %s", win_locale.c_str ());
 				return;
 			}
 
@@ -207,9 +207,9 @@
 		// But what if the locales are both identical and empty? A special case for Windows environments.
 		if (locale.empty())
 		{
-			DEBUG ("Gettext received empty locale. Initializing with OS default");
+			SW_DEBUG ("Gettext received empty locale. Initializing with OS default");
 			locale = getDefaultUsableLocale ();
-			DEBUG ("Gettext received empty locale. Initialized with OS default: %s", locale.c_str ());
+			SW_DEBUG ("Gettext received empty locale. Initialized with OS default: %s", locale.c_str ());
 		}
 
 
@@ -228,7 +228,7 @@
 
 			if (setWinThreadLocale (win_locale) == 0)
 			{
-				DEBUG ("Could not change locale to %s", win_locale.c_str ());
+				SW_DEBUG ("Could not change locale to %s", win_locale.c_str ());
 				return;
 			}
 
@@ -257,7 +257,7 @@
 	if (newCode == -1)
 		return false;
 	
-	DEBUG ("Setting locale to : %s", newLocale.c_str ());
+	SW_DEBUG ("Setting locale to : %s", newLocale.c_str ());
 	result = SetThreadLocale (newCode);
 
 	return result;
--- a/src/core/gridunit.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/gridunit.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -59,17 +59,21 @@
 	std::vector<WorldObject*>& arr = getObjects(g);
 
 	int size = arr.size();
-
-	DEBUGX("deleting obj %i from group %i",object->getId(),g);
+	//DEBUG ("deleting obj %i (%s) from group %i", object->getId (), object->getName ().getRawText ().c_str (), g);
 	if (index != -1 && arr[index]==object)
 	{
-		// Stelle an der geloescht werden soll ist explizit vorgegeben
-		
-		// Letztes Objekt an die Stelle des geloeschten kopieren
+		// Overwrite the object that will be deleted.
 		arr[index] = arr[size-1];
 		arr[index]->getGridLocation()->m_index = index;
-			
-		arr.resize(size-1);
+
+		if (size == 1)
+		{
+			arr.clear ();
+		}
+		else
+		{
+			arr.pop_back();
+		}
 		return true;
 	}
 	else
@@ -84,8 +88,15 @@
 				// Letztes Objekt an die Stelle des geloeschten kopieren
 				arr[i] = arr[size-1];
 				arr[i]->getGridLocation()->m_index = i;
-			
-				arr.resize(size-1);
+				//DEBUG ("resizing (v2) arr to new size: %d", size - 1);
+				if (size == 1)
+				{
+					arr.clear ();
+				}
+				else
+				{
+					arr.pop_back();
+				}
 				return true;
 			}
 		}
--- a/src/core/item.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/item.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -952,7 +952,7 @@
 
 	if (cv->getVersion() >= 16)
 	{
-		std::string magicmods;
+		std::string magicmods ("");
 		cv->fromBuffer(magicmods);
 		m_magic_mods = std::bitset<32>(magicmods);
 	}
@@ -976,7 +976,7 @@
 {
 	
 	std::string defaultColor = TooltipSettings::getDefaultCeguiColour ();
-    std::string rarityColor;
+    std::string rarityColor ("");
     switch (m_rarity)
     {
         case MAGICAL:
@@ -1023,7 +1023,7 @@
 		size_t pos=0,pos2;
 		out_stream << "\n" << gettext ("Required class") << ": ";
 		
-		std::string type;
+		std::string type ("");
 		bool end = false;
 		
 		// alle Klassen ermitteln, die das Item verwenden koennen
@@ -1114,13 +1114,14 @@
 
 		// Schaden
 		std::string dmgstring = m_weapon_attr->m_damage.getDamageString(Damage::ITEM);
+		
 		if (dmgstring != "")
 		{
 			if (m_type == WEAPON)
 			{
-				out_stream << "\n" << gettext("Damage")<<":";
+				out_stream << "\n" << gettext("Damage") << ":";
 			}
-			out_stream<<"\n"<<dmgstring;
+			out_stream << "\n" << dmgstring;
 		}
 
 	}
@@ -1198,7 +1199,7 @@
 	
     std::list<std::string> itemDescList;
     std::string defaultColor = TooltipSettings::getDefaultCeguiColour ();
-    std::string rarityColor;
+    std::string rarityColor ("");
     switch (m_rarity)
     {
         case MAGICAL:
@@ -1220,19 +1221,19 @@
     // String fuer die Beschreibung
     std::ostringstream out_stream;
     out_stream.str("");
-    out_stream<<rarityColor<<getName() << defaultColor << "\n";
+    out_stream<<rarityColor<<getName() << defaultColor;
     itemDescList.push_back(out_stream.str());
     out_stream.str("");
     
     int i;
     // Levelbeschraenkung
-    out_stream <<gettext("Value")<<": "<<m_price << "\n";
+    out_stream <<gettext("Value")<<": "<<m_price;
     itemDescList.push_back(out_stream.str());
     out_stream.str("");
     
     if (price_factor != 0 && price_factor != 1)
     {
-        out_stream << gettext("Selling Value")<<": "<<MathHelper::Max(1,int(m_price*price_factor)) << "\n";
+        out_stream << gettext("Selling Value")<<": "<<MathHelper::Max(1,int(m_price*price_factor));
         itemDescList.push_back(out_stream.str());
         out_stream.str("");
     }
@@ -1240,13 +1241,13 @@
     {
         if (irm.m_level)
         {
-            out_stream<<gettext("Required level")<<": "<<(int) m_level_req << "\n";
+            out_stream<<gettext("Required level")<<": "<<(int) m_level_req;
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
         else
         {
-			out_stream << TooltipSettings::getLevelRequirementCeguiColour () << gettext("Required level")<<": "<<(int) m_level_req << TooltipSettings::getDefaultCeguiColour () << "\n"; // Augustin Preda, 2013.02.08: replaced previous colour (FF2F2F2F)
+			out_stream << TooltipSettings::getLevelRequirementCeguiColour () << gettext("Required level")<<": "<<(int) m_level_req << TooltipSettings::getDefaultCeguiColour (); // Augustin Preda, 2013.02.08: replaced previous colour (FF2F2F2F)
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1256,14 +1257,14 @@
     {
         if (!irm.m_class)
         {
-            out_stream << TooltipSettings::getLevelRequirementCeguiColour () << "\n";
+            out_stream << TooltipSettings::getLevelRequirementCeguiColour ();
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
         size_t pos=0,pos2;
         out_stream<< gettext("Required class")<<": ";
         
-        std::string type;
+        std::string type ("");
         bool end = false;
         
         // alle Klassen ermitteln, die das Item verwenden koennen
@@ -1310,7 +1311,7 @@
             
             first = false;
         }
-        out_stream<< defaultColor << "\n";
+        out_stream<< defaultColor;
         itemDescList.push_back(out_stream.str());
         out_stream.str("");
     }
@@ -1321,7 +1322,7 @@
         // HP Heilung
         if (m_useup_effect->m_dhealth>0)
         {
-            out_stream << gettext("Heals ")<<(int) m_useup_effect->m_dhealth<<gettext(" hitpoints") << "\n";
+            out_stream << gettext("Heals ")<<(int) m_useup_effect->m_dhealth<<gettext(" hitpoints");
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1331,7 +1332,7 @@
         {
             if (    m_useup_effect->m_dstatus_mod_immune_time[i]>0)
             {
-                out_stream << gettext("Heals ")<<Damage::getStatusModName((Damage::StatusMods) i) << "\n";
+                out_stream << gettext("Heals ")<<Damage::getStatusModName((Damage::StatusMods) i);
                 itemDescList.push_back(out_stream.str());
                 out_stream.str("");
                 
@@ -1351,14 +1352,14 @@
     {
         if (m_weapon_attr->m_two_handed)
         {
-            out_stream << gettext("Two-handed weapon") << "\n";
+            out_stream << gettext("Two-handed weapon");
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
         // Reichweite / Angriffsgeschwindigkeit
         if (m_type == WEAPON)
         {
-            out_stream << gettext("Range")<<": "<<m_weapon_attr->m_attack_range << "\n";
+            out_stream << gettext("Range")<<": "<<m_weapon_attr->m_attack_range;
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1371,7 +1372,7 @@
         {
             if (m_type == WEAPON)
             {
-                out_stream << gettext("Damage")<<":" << "\n";
+                out_stream << gettext("Damage")<<":";
                 itemDescList.push_back(out_stream.str());
                 out_stream.str("");
             }
@@ -1380,13 +1381,13 @@
             std::string::size_type pos = dmgstring.find("\n");
             while(pos != std::string::npos)
             {
-                out_stream << dmgstring.substr(0, pos+1);
+                out_stream << dmgstring.substr(0, pos); // Augustin Preda, 2014.01.20: removed last char (newline)
                 itemDescList.push_back(out_stream.str());
                 out_stream.str("");
                 dmgstring.erase(0,pos+1);
                 pos = dmgstring.find("\n");
             }
-            out_stream << dmgstring << "\n";
+            out_stream << dmgstring;// << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1402,7 +1403,7 @@
             out_stream<< gettext("Armor")<<": "<<m_equip_effect->m_darmor ;
 			if (m_magic_mods.test(ItemFactory::ARMOR_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1414,7 +1415,7 @@
             out_stream<< gettext("Block")<<": "<<m_equip_effect->m_dblock;
 			if (m_magic_mods.test(ItemFactory::BLOCK_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1426,7 +1427,7 @@
             out_stream<< "+" <<(int) m_equip_effect->m_dmax_health<< " "<<gettext("max hitpoints");
 			if (m_magic_mods.test(ItemFactory::HEALTH_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1438,7 +1439,7 @@
             out_stream<< "+"<<m_equip_effect->m_dstrength<< " "<<gettext("Strength");
 			if (m_magic_mods.test(ItemFactory::STRENGTH_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1450,7 +1451,7 @@
             out_stream<<"+"<<m_equip_effect->m_ddexterity<< " "<<gettext("Dexterity");
 			if (m_magic_mods.test(ItemFactory::DEXTERITY_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1462,7 +1463,7 @@
             out_stream<< "+"<<m_equip_effect->m_dmagic_power<< " "<<gettext("Magic Power");
 			if (m_magic_mods.test(ItemFactory::MAGIC_POWER_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1474,7 +1475,7 @@
             out_stream<< "+"<<m_equip_effect->m_dwillpower<< " "<<gettext("Willpower");
 			if (m_magic_mods.test(ItemFactory::WILLPOWER_MOD)) 
 				out_stream << defaultColor;
-			out_stream << "\n";
+			//out_stream << "\n";
             itemDescList.push_back(out_stream.str());
             out_stream.str("");
         }
@@ -1490,7 +1491,7 @@
 				
 				if (m_magic_mods.test(ItemFactory::RESIST_PHYS_MOD+elemmap[i])) 
 					out_stream << defaultColor;
-				out_stream << "\n";
+				//out_stream << "\n";
                 itemDescList.push_back(out_stream.str());
                 out_stream.str("");
             }
@@ -1505,7 +1506,7 @@
                 out_stream<< "+"<<m_equip_effect->m_dresistances_cap[i]<<gettext(" max. ")<<Damage::getDamageResistanceName((Damage::DamageType) i);
 				
 				out_stream << defaultColor;
-				out_stream << "\n";
+				//out_stream << "\n";
 				
                 itemDescList.push_back(out_stream.str());
                 out_stream.str("");
--- a/src/core/itemfactory.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/itemfactory.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -367,7 +367,7 @@
 
 void ItemFactory::cleanup()
 {
-	DEBUG("cleanup");
+	SW_DEBUG("cleanup");
 
 	std::map<Item::Subtype,ItemBasicData*>::iterator it;
 	for (it = m_item_data.begin(); it != m_item_data.end(); ++it)
--- a/src/core/itemlist.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/itemlist.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -737,7 +737,7 @@
 	short pos;
 	Item* it;
 
-	std::string subtype;
+	std::string subtype ("");
 	char type;
 	int id;
 
@@ -845,7 +845,7 @@
 	int i;
 	short pos;
 	Item* it;
-	std::string subtype;
+	std::string subtype ("");
 	char type;
 	int id;
 
--- a/src/core/itemloader.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/itemloader.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -61,7 +61,7 @@
 	ElementAttrib attr;
 	attr.parseElement(node->ToElement());
 	
-	std::string type;
+	std::string type ("");
 	attr.getString("type", type);
 	if (type == "armor")
 		item_data->m_type = Item::ARMOR;
@@ -97,7 +97,7 @@
 	}
 	
 	
-	std::string size;
+	std::string size ("");
 	attr.getString("size", size);
 	if (size == "small")
 		item_data->m_size = Item::SMALL;
@@ -114,7 +114,7 @@
 	}
 	
 					
-	std::string consumable;
+	std::string consumable ("");
 	attr.getString("consumable",consumable ,"false");
 	item_data->m_consumable = (consumable == "true");
 	attr.getFloat("consume_timer",item_data->m_consume_timer,0);
@@ -129,7 +129,7 @@
 			
 			if (!strcmp(child->Value(), "Image"))
 			{
-				std::string image;
+				std::string image ("");
 				attr.getString("image", image);
 				if (item_data->m_subtype != "")
 				{
@@ -139,7 +139,7 @@
 			}
 			else if (!strcmp(child->Value(), "Mesh"))
 			{
-				std::string file;
+				std::string file ("");
 				attr.getString("file", file);
 				if (item_data->m_subtype != "")
 				{
@@ -150,7 +150,7 @@
 			}
 			else if (!strcmp(child->Value(), "RenderInfo"))
 			{
-				std::string file;
+				std::string file ("");
 				attr.getString("name", file);
 				if (item_data->m_subtype != "")
 				{
@@ -261,7 +261,7 @@
 				if (item_data->m_weapon_attr == 0)
 					item_data->m_weapon_attr = new WeaponAttr;
 				
-				std::string type;
+				std::string type ("");
 				attr.getString("type",type);
 
 			}
@@ -270,7 +270,7 @@
 				if (item_data->m_equip_effect == 0)
 					item_data->m_equip_effect = new CreatureBaseAttrMod;
 				
-				std::string type;
+				std::string type ("");
 				attr.getString("type",type);
 				
 				if (type == "blind")
@@ -295,7 +295,7 @@
 				if (item_data->m_equip_effect == 0)
 					item_data->m_equip_effect = new CreatureBaseAttrMod;
 				
-				std::string type;
+				std::string type ("");
 				attr.getString("type",type);
 				item_data->m_equip_effect->m_xabilities.insert(type);
 			}
@@ -335,7 +335,7 @@
 				attr.getShort("damage_burning_power", dmg.m_status_mod_power[Damage::BURNING]);
 				
 				attr.getShort("dattack_speed", item_data->m_weapon_attr->m_dattack_speed);
-				std::string twohanded;
+				std::string twohanded ("");
 				attr.getString("two_handed",twohanded);
 				item_data->m_weapon_attr->m_two_handed = (twohanded == "yes");
 				attr.getFloat("attack_range", item_data->m_weapon_attr->m_attack_range);
@@ -343,7 +343,7 @@
 			}
 			else if (child->Type()!=TiXmlNode::TINYXML_COMMENT)
 			{
-				DEBUG("unexpected element of <Item>: %s",child->Value());
+				SW_DEBUG("unexpected element of <Item>: %s",child->Value());
 			}
 		}
 	}
--- a/src/core/mapgenerator.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/mapgenerator.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,1340 +1,1352 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "mapgenerator.h"
-#include "world.h"
-
-
-bool operator<(WeightedLocation first, WeightedLocation second)
-{
-	return first.m_value< second.m_value;
-}
-
-TemplateMap::TemplateMap(int dimx, int dimy)
-	: m_template_map(dimx,dimy) , m_template_index_map(dimx,dimy)
-{
-	m_dimx = dimx;
-	m_dimy = dimy;
-}
-
-void TemplateMap::init(Matrix2d<char>* base_map)
-{
-	// Dimension der Basiskarte
-	int bdimx = m_dimx/2;
-	int bdimy = m_dimy/2;
-	
-	m_template_map.clear();
-	m_template_index_map.clear();
-	int val;
-	
-	// 8x8 Feld Informationen aus der Basiskarte in
-	// 4x4 Karte uebertragen
-	for (int i=0; i<bdimx; i++)
-	{
-		for (int j=0; j<bdimy; j++)
-		{
-			if ((*base_map)[i][j] <= 0)
-			{
-				val = -1;
-			}
-			else
-			{
-				val =0;
-			}
-			
-			m_template_map[2*i][2*j] = val;
-			m_template_map[2*i][2*j+1] = val;
-			m_template_map[2*i+1][2*j+1] = val;
-			m_template_map[2*i+1][2*j] = val;
-		}
-	}
-	
-	// unterer und linker Rand mit -1 fuellen
-	for (int i=0; i<m_dimx; i++)
-	{
-		m_template_map[i][m_dimy-1] = -1;
-	}
-	for (int j=0; j<m_dimy; j++)
-	{
-		m_template_map[m_dimx-1][j] = -1;
-	}
-	
-	// restliche Karte berechnen
-	for (int i=m_dimx-2; i>=0; i--)
-	{
-		for (int j=m_dimy-2; j>=0; j--)
-		{
-			recalcMapElement(i,j);
-		}
-	}
-}
-
-void TemplateMap::recalcMapElement(int i,int j)
-{
-	int val;
-	if (i >= m_dimx || j >= m_dimy)
-		return;
-	
-	if (i== m_dimx-1 || j == m_dimy-1)
-	{
-		val = -1;	// Rand immer blockiert
-	}
-	else if (m_template_map[i][j] == -1)
-	{
-		val = -1;	// blockiert bleibt blockiert
-	}
-	else
-	{
-		// Minimum aus den Felden darunter, daneben, diagonal darunter; plus 1
-		val = m_template_map[i+1][j];
-		val = MathHelper::Min(val, m_template_map[i][j+1]);
-		val = MathHelper::Min(val, m_template_map[i+1][j+1]);
-		val ++;
-		
-		if (val == 0)
-			val = 1;
-	}
-	
-	if (val != -1)
-	{
-		setMapElement(i,j,val);
-	}
-}
-
-void TemplateMap::setMapElement(int i, int j, int template_max_size)
-{
-	int oldval = m_template_map[i][j];
-	
-	if (oldval == template_max_size || oldval == -1)
-		return;
-	
-	// aus Datenstrukturen entfernen falls alter Wert > 0
-	if (oldval > 0)
-	{
-		// geloescht wird, indem das letzte Element des Vektors
-		// ueber das zu loeschende kopiert wird
-		int oldindex = m_template_index_map[i][j];
-		int vecsize = m_template_places[oldval].size();
-		if (oldindex != vecsize -1)
-		{
-			int lastx = m_template_places[oldval][vecsize-1].first;
-			int lasty = m_template_places[oldval][vecsize-1].second;
-			m_template_places[oldval][oldindex].first = lastx;
-			m_template_places[oldval][oldindex].second = lasty;
-			m_template_index_map[lastx][lasty] = oldindex;
-		}
-		
-		m_template_places[oldval].resize(vecsize-1);
-	}
-	
-	m_template_map[i][j] = template_max_size;
-	
-	// Eintragen des neuen Wertes in die Datenstrukturen
-	if (template_max_size > 0)
-	{
-		int vecsize = m_template_places[template_max_size].size();
-		m_template_places[template_max_size].resize(vecsize +1);
-		m_template_places[template_max_size][vecsize].first = i;
-		m_template_places[template_max_size][vecsize].second = j;
-		m_template_index_map[i][j] = vecsize;
-	}
-	
-}
-
-bool TemplateMap::getTemplatePlace(Shape* shape, Vector & place)
-{
-	if (shape ==0)
-	{
-		return false;
-	}
-
-	bool success = false;
-
-	// Groesse des Templates in 4x4 Feldern
-	Vector ext = shape->getAxisExtent();
-	int ex = int(ceil(ext.m_x/2));
-	int ey = int(ceil(ext.m_y/2));
-	
-	int size = MathHelper::Max(ex,ey);
-	DEBUGX("template size %i %i angle %f extent %f %f",ex,ey,shape->m_angle,shape->m_extent.m_x, shape->m_extent.m_y);
-	std::map< int, std::vector< std::pair<int, int> > >::iterator mt, mt2;
-	std::vector<int>::iterator st;
-	
-	int px,py;
-	
-	while (!success)
-	{
-		int nr;
-		// Anzahl der in Frage kommenden Orte ermitteln
-		// alle Orte aufsummieren mit Abstandsindex mindens size
-		nr =0;
-		mt2 = mt = m_template_places.lower_bound(size);
-
-		while (mt != m_template_places.end())
-		{
-			nr += mt->second.size();
-			++mt;
-		}
-
-		if (nr == 0)
-		{
-			// kein Platz fuer das Template vorhanden
-			return false;
-		}
-		
-		// Ort auswuerfeln und ermitteln
-		nr = Random::randi(nr);
-		mt = mt2;
-		while (nr >= int(mt->second.size()))
-		{
-			nr -= mt->second.size();
-			++mt;
-		}
-		
-		px = mt->second[nr].first;
-		py = mt->second[nr].second;
-		
-		// Flaeche die durch das Template ueberdeckt wird bestimmen
-		int imin = px;
-		int jmin = py;
-		int imax = imin + ex -1;
-		int jmax = jmin + ey -1;
-		// Ort eines eventuellen Hindernisses
-		int obi = -1, obj= -1;
-
-		// Pruefen ob die Flaeche keine Hindernisse enthaelt
-		for (int i = imin; i<= imax; i++)
-		{
-			for (int j= jmin; j<= jmax; j++)
-			{
-				if (m_template_map[i][j] <0)
-				{
-					obi = i;
-					obj = j;
-					DEBUGX("found obstacle at %i %i",i,j);
-					break;
-				}
-			}
-			if (obi != -1)
-			{
-				break;
-			}
-		}
-		
-		if (obi != -1)
-		{
-			// Hindernis gefunden
-
-			// dieses Hindernis verhindert das platzieren der Templates in seiner Umgebung
-			// in dieser Umgebung werden die Zahlen fuer den minimalen Abstand zum naechsten Hindernis aktualisiert
-			imin = MathHelper::Max(0,obi - size+1);
-			jmin = MathHelper::Max(0,obj - size+1);
-			imax = obi;
-			jmax = obj;
-
-			// Schleife ueber die Umgebung des Hindernisses
-			for (int i = imax; i>= imin; i--)
-			{
-				for (int j= jmax; j>= jmin; j--)
-				{
-					recalcMapElement(i,j);
-				}
-			}
-		}
-		else
-		{
-			// Erfolg
-			// Orte die von dem Template ueberdeckt werden aus der Liste der freien Orte entfernen
-
-			// Objekt auf der Template Karte eintragen
-			for (int i = imin; i<= imax; i++)
-			{
-				for (int j= jmin; j<= jmax; j++)
-				{
-					setMapElement(i,j,-1);
-				}
-			}
-			
-			place.m_x = px*4+2*ex;
-			place.m_y = py*4+2*ey;
-
-			DEBUGX("found place %i %i",px,py);
-
-			success = true;
-		}
-	}
-	return true;
-}
-
-void TemplateMap::print()
-{
-	for (int i=0; i< m_dimx; i++)
-	{
-		for (int j=0; j<m_dimy; j++)
-		{
-			if (m_template_map[i][j]>0)
-				std::cout << m_template_map[i][j] << " ";
-			else
-				std::cout << "# ";
-		}
-		std::cout << "\n";
-	}
-	std::cout << "\n";
-	
-	std::map< int, std::vector< std::pair<int, int> > >::iterator it;
-	for (it = m_template_places.begin(); it != m_template_places.end(); ++it)
-	{
-		DEBUG("places of size %i : %i",it->first, it->second.size());
-	}
-}
-
-Region* MapGenerator::createRegion(RegionData* rdata)
-{
-	// set Random seed based on the region information
-	// surely, we need a better hash funcion
-	unsigned int seed = World::getWorld()->getBaseRandomSeed() + rdata->m_id*84859;
-	unsigned int oldseed = Random::randi(INT_MAX);
-	Random::setRandomSeed(seed);
-	
-	// temporaere Daten fuer die Erzeugung der Region
-	MapGenerator::MapData mdata;
-
-	bool success = false;
-	int counter =0;
-	while (!success)
-	{
-		counter ++;
-		if (counter > 10)
-			return 0;
-		
-		// Speicher anfordern
-		MapGenerator::createMapData(&mdata,rdata);
-		
-
-		// grundlegende Karte anfertigen
-		if (rdata->m_region_template =="")
-		{
-			MapGenerator::createBaseMap(&mdata,rdata);
-		}
-		
-		// Umgebungen in die Region einfuegen
-		std::list<std::pair<float, EnvironmentName> >::iterator et;
-		for (et = rdata->m_environments.begin(); et != rdata->m_environments.end(); ++et)
-		{
-			mdata.m_region->insertEnvironment(et->first,et->second);
-		}
-		
-		// Umgebungskarte generieren
-		createPerlinNoise(&mdata.m_region->getHeight(), rdata->m_dimx, rdata->m_dimy,MathHelper::Min(rdata->m_dimx,rdata->m_dimy)/4 , 0.4,false);
-
-		if (rdata->m_region_template =="")
-		{
-			// Objektgruppen platzieren
-			success = MapGenerator::insertGroupTemplates(&mdata,rdata);
-		}
-		else
-		{
-			DEBUGX("region template %s",rdata->m_region_template.c_str());
-			// Region besteht aus einer einzelnen Objektgruppe
-			// Objektgruppe anhand des Namens suchen
-			ObjectGroup* templ;
-			templ = ObjectFactory::getObjectGroup(rdata->m_region_template);
-			if (templ ==0)
-			{
-				ERRORMSG("unknown object group %s",rdata->m_region_template.c_str());
-				return 0;
-			}
-
-			Vector pos(rdata->m_dimx*2, rdata->m_dimy*2);
-			mdata.m_region->createObjectGroup(rdata->m_region_template,pos,0);
-			success = true;
-		}
-		
-		// Events kopieren
-		mdata.m_region->copyEventsFromRegionData(rdata);
-		
-		mdata.m_region->setReviveLocation(rdata->m_revive_location);
-		mdata.m_region->setGroundMaterial(rdata->m_ground_material);
-		
-		// Wenn der Versuch nicht erfolgreich war alles loeschen und von vorn beginnen
-		if (!success)
-		{
-			DEBUG("not successful");
-
-			delete mdata.m_base_map;
-			delete mdata.m_region;
-		}
-	}
-
-	if (rdata->m_region_template =="")
-	{
-		// Berandungen einfuegen
-		MapGenerator::createBorder(&mdata,rdata);
-	}
-	
-	// Ausgaenge erzeugen
-	MapGenerator::createExits(&mdata,rdata);
-	
-	if (rdata->m_region_template =="")
-	{
-		// Monster einfuegen
-		MapGenerator::insertSpawnpoints(&mdata,rdata);
-	}
-
-	// Speicher freigeben
-	delete mdata.m_base_map;
-	
-	// Zufallszahlengenerator zuruecksetzen
-	Random::setRandomSeed(oldseed);
-	
-	return mdata.m_region;
-}
-
-void MapGenerator::createMapData(MapData* mdata, RegionData* rdata)
-{
-	mdata->m_base_map = new Matrix2d<char>(rdata->m_dimx/2,rdata->m_dimy/2);
-	mdata->m_base_map->clear();
-	mdata->m_region = new Region(rdata->m_dimx,rdata->m_dimy,rdata->m_id,rdata->m_name,rdata);
-	mdata->m_border.clear();
-}
-
-void MapGenerator::createBaseMap(MapData* mdata, RegionData* rdata)
-{
-
-	
-
-	float size = rdata->m_area_percent;
-
-	// Karte wird in 8x8 Felder erzeugt, Region rechnet aber in 4x4 Gridunits
-	int dimx = rdata->m_dimx/2;
-	int dimy = rdata->m_dimy/2;
-
-	// temporaere Karte anlegen
-	Matrix2d<float>* hmap = new Matrix2d<float>(dimx, dimy);
-
-	hmap->clear();
-
-	// Karte erzeugen mit Perlin Noise
-	// erhaltenes Feld wird als Hoehenkarte interpretiert
-	// alle Felder die unterhalb eines kritischen Niveaus liegen sind begehbar
-	createPerlinNoise(hmap,dimx, dimy, rdata->m_granularity/2, rdata->m_complexity,true);
-
-
-	// Delta zu Nachbarfeldern
-	int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
-	int dnb[8][2] = {{-1,0},{1,0},{0,-1},{0,1},{-1,1},{1,1},{1,-1},{-1,-1}};
-
-	// Suchen eine Niveaus das eine hinreichend grosse zusammenhaengende Flaeche erzeugt
-	// Idee: alle Felder werden in einer PriorityQueue eingeordnet
-	// alle Felder werden in einen UnionFind Baum eingeordnet
-	// von kleinster Höhe beginnend werden die Felder jeweils mit dem tiefstliegenden Nachbarfeld verschmolzen
-
-	std::priority_queue<WeightedLocation> fields_queue;
-	WeightedLocation loc;
-	for (int i=0; i< dimx; i++)
-	{
-		for (int j=0; j< dimy; j++)
-		{
-			loc.m_x = i;
-			loc.m_y = j;
-			loc.m_value = 1- (*hmap)[i][j];
-
-			fields_queue.push(loc);
-		}
-	}
-
-	UnionFindTree uftree(dimx*dimy);
-
-	float height;
-	int x,y,nbx, nby;
-
-	// Solange *Wasserstand* erhoehen, bis eine genuegend grosse zusammenhaengende Flaeche gefunden wurde
-	while (1)
-	{
-		// oberstes Feld aus der Queue nehmen
-		loc = fields_queue.top();
-		fields_queue.pop();
-
-		height = 1-loc.m_value;
-		x = loc.m_x;
-		y = loc.m_y;
-
-		// Schleife ueber die Nachbarfelder
-		for (int i=0; i<4; i++)
-		{
-			nbx = x + nb[i][0];
-			nby = y + nb[i][1];
-
-			// Dimension pruefen
-			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
-				continue;
-
-			if ( (*hmap)[nbx][nby] <= height)
-			{
-				uftree.merge(nbx*dimy+nby,x*dimy+y);
-			}
-		}
-
-		// Testen ob eine hinreichend große Flaeche entstanden ist
-		if (uftree.getCardinality(x*dimy+y) >= dimx*dimy*size)
-		{
-			break;
-		}
-
-	}
-
-	// kleiner Aufschlag um sehr enge Durchgaenge zu vermeiden
-	height += 0.01;
-	
-	/*
-	// Debugging
-	DEBUG("height %f",height);
-	for (int j=0; j< dimy; j++)
-	{
-		for (int i=0; i< dimx; i++)
-		{
-			if ((*hmap)[i][j]<height)
-			{
-				std::cout << " ";
-			}
-			else
-			{
-				std::cout << "X";
-			}
-		}
-		std::cout << "\n";
-	}
-	*/
-	
-	// Floodfill um die Flaeche und deren Rand zu finden
-	// die besuchten Felder werden in border mit 1 markiert
-	// es werden nur Felder besucht, die unterhalb der gefundenen Hoehe liegen
-	int cnt=0;
-	std::queue<std::pair<int,int> > qu;
-	std::pair<int,int> point;
-
-	// Queue mit Felder die zum Rand gehoeren
-	std::queue<std::pair<int,int> > borderqu;
-
-	qu.push(std::make_pair(x,y));
-	(*(mdata->m_base_map))[x][y]=1;
-
-	// Solange die Queue nicht leer ist
-
-	while (!qu.empty())
-	{
-		// Feld entnehmen
-		point = qu.front();
-		qu.pop();
-
-		x = point.first;
-		y = point.second;
-
-		// Schleife ueber die Nachbarfelder
-		for (int i=0; i<4; i++)
-		{
-			nbx = x + nb[i][0];
-			nby = y + nb[i][1];
-
-			// Dimension pruefen
-			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
-				continue;
-
-			// nur noch nicht besuchte Felder
-			if ((*(mdata->m_base_map))[nbx][nby] != 0)
-				continue;
-
-			// Felder oberhalb der Obergrenze zum Rand hinzufuegen
-			if ((*hmap)[nbx][nby] > height)
-			{
-				borderqu.push(std::make_pair(nbx,nby));
-				(*(mdata->m_base_map))[nbx][nby]=-1;
-
-				mdata->m_border.push_back(std::make_pair(nbx,nby));
-				continue;
-			}
-
-			// Feld hinzufuegen
-			qu.push(std::make_pair(nbx,nby));
-			// als besucht markieren
-			(*(mdata->m_base_map))[nbx][nby]=1;
-
-			cnt++;
-		}
-	}
-	
-	//std::list<std::pair<int,int> >::iterator it;
-	//for (
-	
-	
-	// nochmal 3 Runden Floodfill um den Rand zu ermitteln
-
-	// Marker einfuegen
-	int markercnt =0;
-	borderqu.push(std::make_pair(-1,-1));
-
-
-	while (!borderqu.empty() && markercnt <3)
-	{
-		// Feld entnehmen
-		point = borderqu.front();
-		borderqu.pop();
-
-		x = point.first;
-		y = point.second;
-
-		// Testen ob der Marker entnommen wurde
-		if (x==-1)
-		{
-			markercnt ++;
-			borderqu.push(std::make_pair(-1,-1));
-			continue;
-		}
-
-		// Schleife ueber die Nachbarfelder
-		for (int i=0; i<8; i++)
-		{
-			nbx = x + dnb[i][0];
-			nby = y + dnb[i][1];
-
-			// Dimension pruefen
-			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
-				continue;
-
-			// nur noch nicht besuchte Felder
-			if ((*(mdata->m_base_map))[nbx][nby] != 0)
-				continue;
-
-
-			// Feld hinzufuegen
-			borderqu.push(std::make_pair(nbx,nby));
-			// als besucht markieren
-			(*(mdata->m_base_map))[nbx][nby]=-1;
-		}
-	}
-	
-
-	delete hmap;
-}
-
-bool MapGenerator::insertGroupTemplates(MapData* mdata, RegionData* rdata)
-{
-	TemplateMap tmap(rdata->m_dimx, rdata->m_dimy);
-	tmap.init(mdata->m_base_map);
-	
-	// obligatorische Objektgruppen einfuegen
-
-	std::multimap<int, RegionData::NamedObjectGroup >::reverse_iterator it;
-	Shape s;
-	Vector pos;
-	bool succ;
-	
-	for (it = rdata->m_named_object_groups.rbegin(); it != rdata->m_named_object_groups.rend(); ++it)
-	{
-		// Objektgruppe anhand des Namens suchen
-		s = ObjectFactory::getObjectGroupShape(it->second.m_group_name);
-		if (s.m_center.m_x < 0)
-		{
-			ERRORMSG("unknown object group %s",it->second.m_group_name.c_str());
-			continue;
-		}
-
-		// Ort fuer das Template suchen
-		succ = tmap.getTemplatePlace(&s,pos);
-		s.m_center = pos;
-
-		if (succ == false)
-		{
-			// Obligatorisches Template konnte nicht platziert werden
-			DEBUG("could not place template %s",it->second.m_group_name.c_str());
-			/*
-			int hdimx = rdata->m_dimx/2;
-			int hdimy = rdata->m_dimy/2;
-			for (int i=0; i<hdimx; i++)
-			{
-				for (int j=0; j< hdimy;j++)
-				{
-					if (*(mdata->m_base_map->ind(i,j)) != -1)
-					{
-						std::cout << "  ";
-					}
-					else
-					{
-						std::cout << "# ";
-					}
-				}
-				std::cout << "\n";
-			}
-			*/
-			return false;
-		}
-
-		// Objektgruppe einfuegen
-		DEBUGX("placing group %s at %f %f",it->second.m_group_name.c_str(), pos.m_x, pos.m_y);
-		mdata->m_region->createObjectGroup(it->second.m_group_name,pos,s.m_angle, it->second.m_name);
-		insertBlockedArea(mdata,s);
-
-		
-	}
-	
-	if (rdata->m_has_waypoint)
-	{
-		ObjectGroup* templ;
-	
-		// Wegpunkt einfuegen
-		templ = ObjectFactory::getObjectGroup("waypoint_templ");
-		memcpy(&s , templ->getShape(), sizeof(Shape));
-		succ = tmap.getTemplatePlace(&s,pos);
-		s.m_center = pos;
-		
-		if (succ == false)
-		{
-			// Wegpunkt konnte nicht platziert werden
-			DEBUG("could not place waypoint");
-			return false;
-		}
-		mdata->m_region->createObjectGroup("waypoint_templ",pos,0);
-		insertBlockedArea(mdata,s);
-	}
-	
-	// fakultative Objektgruppen einfuegen
-	
-	std::multimap<int, RegionData::ObjectGroupSet >::reverse_iterator jt;
-	for (jt = rdata->m_object_groups.rbegin(); jt != rdata->m_object_groups.rend(); ++jt)
-	{
-		s = ObjectFactory::getObjectGroupShape(jt->second.m_group_name);
-		if (s.m_center.m_x < 0)
-		{
-			ERRORMSG("unknown object group %s",jt->second.m_group_name.c_str());
-			continue;
-		}
-
-		DEBUGX("template %s size %f %f",jt->second.m_group_name.c_str(),s.m_extent.m_x, s.m_extent.m_y);
-		float angle =0;
-		for (int i=0; i< jt->second.m_number; i++)
-		{
-			if (Random::random() > jt->second.m_probability)
-			{
-				continue;
-			}
-			
-			// Drehwinkel ermitteln
-			// Kreise beliebig Rechtecke nur um 90°
-			if (s.m_type == Shape::CIRCLE)
-			{
-				angle = 2*3.14159*Random::random();
-			}
-			else
-			{
-				int n = Random::randi(4);
-				angle = 3.14159*(n*90.0)/180.0;
-			}
-			s.m_angle = angle;
-			
-			// Ort fuer das Template suchen
-			succ = tmap.getTemplatePlace(&s,pos);
-			s.m_center = pos;
-			
-			if (succ == false)
-			{
-				// Template konnte nicht platziert werden
-				break;
-			}
-
-			// Objektgruppe einfuegen
-			DEBUGX("placing group %s at %f %f",jt->second.m_group_name.c_str(), pos.m_x, pos.m_y);
-			
-			mdata->m_region->createObjectGroup(jt->second.m_group_name,pos,angle);
-			if (! jt->second.m_decoration)
-			{
-				insertBlockedArea(mdata,s);
-			}
-		}
-		
-	}
-	return true;
-}
-
-
-void MapGenerator::createBorder(MapData* mdata, RegionData* rdata)
-{
-	// Delta zu Nachbarfeldern
-	int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
-
-	int hdimx = rdata->m_dimx/2;
-	int hdimy = rdata->m_dimy/2;
-
-	// Orte fuer den Ausgang in den vier Richtungen
-	int exit[4][2];
-	int exitcount[4];
-	for (int i=0; i<4; i++)
-	{
-		exit[i][0] = nb[i][0]*-1000;
-		exit[i][1] = nb[i][1]*-1000;
-		exitcount[i] =1;
-	}
-
-	// Ausgaenge suchen
-	for (int i=0; i<hdimx; i++)
-	{
-		for (int j=0; j< hdimy;j++)
-		{
-			if (*(mdata->m_base_map->ind(i,j)) >=1 )
-			{
-				// Testen ob das Feld als Ausgang in Frage kommt
-				// Also am noerdlichsten, westlichsten usw liegt
-				for (int k=0; k<4; k++)
-				{
-					if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] < i*nb[k][0] + j*nb[k][1])
-					{
-						exit[k][0] =i;
-						exit[k][1] =j;
-						exitcount[k] =1;
-					}
-					
-					if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] == i*nb[k][0] + j*nb[k][1])
-					{
-						int rnd = Random::randi(exitcount[k]);
-						if (rnd ==0)
-						{
-							exit[k][0] =i;
-							exit[k][1] =j;
-						}
-						exitcount[k] ++;
-					}
-				}
-			}
-
-		}
-	}
-
-	// Ausgaenge platzieren
-	for (int k=0; k<4; k++)
-	{
-		std::string dirname[4] = {"west","east","north","south"};
-		std::string locname;
-		if (rdata->m_exit_directions[k])
-		{
-			int i = exit[k][0];
-			int j = exit[k][1];
-
-
-			locname = "entry_";
-			locname += dirname[k];
-			mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4));
-            *(mdata->m_base_map->ind(i,j)) = 2;
-
-			i+= nb[k][0];
-			j+= nb[k][1];
-			locname = "exit_";
-			locname += dirname[k];
-			mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4));
-
-			while (i>=0 && j>=0 && i< hdimx && j<hdimy)
-			{
-				*(mdata->m_base_map->ind(i,j)) = 2;
-				i+= nb[k][0];
-				j+= nb[k][1];
-			}
-		}
-	}
-
-
-	
-	// fuer jedes markierte Feld werden die 4 Nachbarfelder angesehen
-	// die 4 Informationen werden als 4bit Zahl interpretiert
-	// blockierte Felder erhalten eine 0, freie eine 1
-	//
-	// es gibt 6 verschiedene Konstellationen fuer die Nachbarfelder
-	// die 4bit Zahl dient als Index um die Konstellation und den Drehwinkel zu erhalten
-	//
-	// Aufbau der Bitmaske:
-	// 
-	//  D
-	// A*B
-	//  C
-	// => Bitmaske ABCD
-	
-	// Liste mit den 6 verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind
-	// Form der 6 Template (+ frei, # blockiert):
-	//
-	// ?+?   ?+?   ?+?   ?+?   ?#?   ?+?
-	// ###   ##+   ###   ##+   ###   +#+
-	// ?#?   ?#?   ?+?   ?+?   ?#?   ?+?
-	std::string borders[6] = {"$border(side)","$border(corner)","$border(twoside)","$border(twocorner)","$border(filled)","$border(single_block)"};
-
-	// Maske dafuer, welche Situation vorliegt
-	int bmask[16]={4,0,0,2,0,1,1,3,0,1,1,3,2,3,3,5};
-
-	// Maske fuer die Rotationswinkel in Schritten von 90 Grad
-	int rotmask[16] = {0,0,2,0,3,0,3,0,1,1,2,2,1,1,3,0};
-	int mask =0;
-	int nbi, nbj;
-
-	// Abstaende der Diagonalen
-	int diag[4][2] ={{-1,-1},{-1,1},{1,1},{1,-1}};
-	
-	// Fuer die Diagonalen wird eine aehnliche Bitmaske erstellt:
-	// // eine 1 wird gesetzt, wenn das Feld selbst frei ist, die beiden Felder daneben aber besetzt
-	//
-	// B C
-	//  *
-	// A D
-	// => Bitmaske ABCD
-	
-	// Liste mit den verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind
-	// Form der Template (+ frei, # blockiert):
-	//
-	// ###   ###   ##+   +##   +#+   +#+
-	// ###   ###   ###   ###   ###   ###
-	// ###   ##+   ##+   ##+   ##+   +#+
-	
-	std::string smallcorners[8] = {"","(one_smallcorner)","(two_smallcorner)","(diag_smallcorner)","(three_smallcorner)","(four_smallcorner)"};
-		
-	int diagbmask[16]=    {0,1,1,2,1,3,2,4, 1,2,3,4,2,4,4,5};
-	int diagrotmask[16] = {0,0,1,0,2,0,1,0, 3,3,3,3,2,2,1,0};
-	
-	int diagi, diagj;
-	int dmask;
-	
-	ObjectGroupName templ,diagtempl;
-	float angle;
-
-	bool skip;
-
-	
-	for (int j=0; j< hdimy;j++)
-	{
-		for (int i=0; i<hdimx; i++)
-		{
-			skip = false;
-			if (*(mdata->m_base_map->ind(i,j)) != -1)
-			{
-				//std::cout << "  ";
-				continue;
-			}
-
-			mask =0;
-			dmask =0;
-			
-			// Bitmasken aufbauen
-			for (int k=0; k<4; k++)
-			{
-				nbi = i + nb[k][0];
-				nbj = j + nb[k][1];
-
-				mask *=2;
-				dmask  *= 2;
-				
-				if ( nbi>=0 && nbj>=0 && nbi<hdimx && nbj<hdimy)
-				{
-					if (*(mdata->m_base_map->ind(nbi,nbj)) >= 1)
-					{
-						mask +=1;
-					}
-
-				// Wenn eines der Nachbarfelder im *leeren Raum* liegt
-				// dann keine Objekte setzen
-					if (*(mdata->m_base_map->ind(nbi,nbj)) == 0)
-					{
-						skip = true;
-					}
-				}
-
-			
-				
-				// Bitmaske fuer Diagonalen
-				diagi = i + diag[k][0];
-				diagj = j + diag[k][1];
-				
-				if ( diagi>=0 && diagj>=0 && diagi<hdimx && diagj<hdimy)
-				{
-					if (*(mdata->m_base_map->ind(diagi,diagj)) >= 1 &&
-						*(mdata->m_base_map->ind(diagi,j)) == -1 &&
-						*(mdata->m_base_map->ind(i,diagj)) == -1)
-					{
-						dmask +=1;
-					}
-				}
-
-			}
-			
-			//std::cout << bmask[dmask] <<" ";
-			if (skip)
-				continue;
-
-			// Template und dessen Winkel bestimmen
-			templ = borders[bmask[mask]];
-			angle = rotmask[mask] *PI/2;
-
-			diagtempl = smallcorners[diagbmask[dmask]];
-			float diagangle = diagrotmask[dmask] *PI/2;
-			
-			// gemeinsames Template aus Innenecken und Rand herstellen
-			if (templ == "$border(filled)" && diagtempl !="")
-			{
-				templ ="$border";
-				templ += diagtempl;
-				angle = diagangle;
-			}
-			else if (templ == "$border(side)" && diagtempl == "(one_smallcorner)")
-			{
-				if (angle == diagangle)
-				{
-					templ = "$border(side)(right_smallcorner)";
-				}
-				else
-				{
-					templ = "$border(side)(left_smallcorner)";
-				}
-			}
-			else
-			{
-				templ += diagtempl;
-			}
-			
-			DEBUGX("placing type (%i %i) %s",i,j,templ.c_str());
-			
-			mdata->m_region->createObjectGroup(templ,Vector(i*8+4,j*8+4),angle);
-		}
-		//std::cout << "\n";
-	}
-
-
-
-}
-
-void MapGenerator::insertSpawnpoints(MapData* mdata, RegionData* rdata)
-{
-	// Punkte an denen Spawnpoints möglich sind
-	std::vector< std::pair<int,int> > points;
-
-	int hdimx = rdata->m_dimx/2;
-	int hdimy = rdata->m_dimy/2;
-
-	// moegliche Orte fuer Spawnpoints ermitteln
-	for (int i=0; i<hdimx; i++)
-	{
-		for (int j=0; j< hdimy;j++)
-		{
-			// nur erreichbare Felder
-			if (*(mdata->m_base_map->ind(i,j)) !=1)
-			{
-				continue;
-			}
-
-			points.push_back(std::make_pair(i,j));
-		}
-	}
-
-
-	// Spawnpoints platzieren
-	std::list<RegionData::SpawnGroup>::iterator st;
-	WorldObject* wo;
-	bool stop = false;
-	for (st = rdata->m_monsters.begin(); st != rdata->m_monsters.end() &&!stop; ++st)
-	{
-		// aufhoeren, wenn keine Orte mehr vorhanden
-		
-		DEBUGX("%s x %i",st->m_monsters.c_str(),st->m_number);
-		for (int i=0; i< st->m_number; i++)
-		{
-			int r = Random::randi(points.size());
-			wo = new Spawnpoint(st->m_monsters);
-
-			mdata->m_region->insertObject(wo,Vector(points[r].first*8+4, points[r].second*8+4));
-
-			DEBUGX("placing spawnpoint for %s at %i %i",st->m_monsters.c_str(), points[r].first*8+4, points[r].second*8+4);
-			
-			points[r] = points.back();
-			points.resize(points.size() -1);
-			if (points.empty())
-			{
-				stop = true;
-				break;
-			}
-		}
-	}
-}
-
-
-void MapGenerator::createExits(MapData* mdata, RegionData* rdata)
-{
-	int dimx = rdata->m_dimx/2;
-	int dimy = rdata->m_dimy/2;
-	
-	std::list<RegionExit>::iterator it;
-	Vector pos;
-	for (it = rdata->m_exits.begin(); it != rdata->m_exits.end(); ++it)
-	{
-		mdata->m_region->addExit(*it);
-
-		// Bei den Ausgaengen keine Monster
-		if (rdata->m_region_template =="")
-		{
-			pos = mdata->m_region->getLocation(it->m_exit_name);
-			int cx = int(pos.m_x/8);
-			int cy = int(pos.m_y/8);
-			for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++)
-			{
-				for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++)
-				{
-					if (*(mdata->m_base_map->ind(i,j))==1)
-					{
-						*(mdata->m_base_map->ind(i,j)) = 2;
-					}
-				}
-			}
-		}
-
-	}
-	
-	if (rdata->m_has_waypoint)
-	{
-		Vector pos = mdata->m_region->getLocation("WaypointLoc");
-		WorldObject* wo =	 new Waypoint();
-		mdata->m_region->insertObject(wo,pos);
-		mdata->m_region->getWaypointLocation() = pos;
-		
-		//mdata->m_region->insertObject(wo,pos);
-		DEBUGX("waypoint at %f %f %i",pos.m_x, pos.m_y,wo->getId());
-		
-		// Bei den Ausgaengen keine Monster
-		if (rdata->m_region_template =="")
-		{
-			int cx = int(pos.m_x/8);
-			int cy = int(pos.m_y/8);
-			for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++)
-			{
-				for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++)
-				{
-					if (*(mdata->m_base_map->ind(i,j))==1)
-					{
-						*(mdata->m_base_map->ind(i,j)) = 2;
-					}
-				}
-			}
-		}
-	}
-}
-
-void MapGenerator::insertBlockedArea(MapData* mdata, Shape s)
-{
-	// Groesse des Templates in 4x4 Feldern
-	Vector ext = s.getAxisExtent();
-	Vector emin = s.m_center - ext;
-	Vector emax = s.m_center + ext;
-	int imin = int(emin.m_x / 8);
-	int jmin = int(emin.m_y / 8);
-	int imax = int( ceil(emax.m_x / 8));
-	int jmax = int( ceil(emax.m_y / 8));
-	
-	for (int i=imin; i< imax; i++)
-	{
-		for (int j=jmin; j<jmax; j++)
-		{
-			if (*(mdata->m_base_map->ind(i,j))==1)
-			{
-				*(mdata->m_base_map->ind(i,j)) = 2;
-			}
-		}
-	}
-}
-
-
-void MapGenerator::createPerlinNoise(Matrix2d<float> *data, int dimx, int dimy,int startfreq, float persistance, bool bounds)
-{
-	Matrix2d<float>* tmp= new Matrix2d<float>(dimx+1, dimy+1);
-	tmp->clear();
-	float* weight = new float[MathHelper::Min(dimx,dimy)];
-	float ampl =1;
-	int dx,dy;
-	float invdist;
-	
-	if (startfreq > dimx || startfreq > dimy)
-	{
-		startfreq = MathHelper::Min(dimx,dimy);
-	}
-	
-	DEBUGX("Perlin noise dimx %i dimy %i",dimx,dimy);
-	
-	// Perlin Noise Algorithmus
-	// Aenderung hier: Schleife geht ueber den Abstand zwischen den Stuetzstellen
-	for (int dist = startfreq; dist>0 ;dist/=2)
-	{
-		// Dimension des Zufallszahlenfeldes fuer diesen Abstand
-		dx = 2+(dimx-2)/dist;
-		dy = 2+(dimy-2)/dist;
-		
-		DEBUGX("distance %i  tmp array %i %i",dist,dx,dy);
-		
-		// anlegen der Zufallszahlen fuer die aktuelle Frequenz
-		for (int i=0;i<=dx;i++)
-		{
-			for (int j=0;j<=dy;j++)
-			{
-				*(tmp->ind(i,j)) = Random::random()* ampl;
-
-			}
-
-		}
-
-		// Interpolation (nur fuer Abstand >1)
-		if (dist>1)
-		{
-			invdist = 1.0f/dist;
-	
-			for (int k=0;k<dist;k++)
-			{
-				weight[k] = k*invdist;
-			}
-	
-			
-			
-			for (int i=0;i<dx;i++)
-			{
-				for (int j=0;j<dy;j++)
-				{
-					for (int k=0;k<dist;k++)
-					{
-						for (int l=0;l<dist;l++)
-						{
-							if (i*dist+k< dimx && j*dist+l< dimy)
-							{
-								*(data->ind(i*dist+k,j*dist+l)) += (*(tmp->ind(i,j))*(1-weight[k])*(1-weight[l])
-										+ *(tmp->ind(i+1,j))*weight[k]*(1-weight[l])
-										+ *(tmp->ind(i+1,j+1))*weight[k]*weight[l]
-										+ *(tmp->ind(i,j+1))*(1-weight[k])*weight[l]) ;
-							}
-						}
-					}
-				}
-			}
-		}
-		else
-		{
-			for (int i=0;i<dimx;i++)
-			{
-				for (int j=0;j<dimy;j++)
-				{
-					*(data->ind(i,j)) +=*(tmp->ind(i,j));
-				}
-			}
-		}
-
-		ampl *= persistance;
-		/*
-		if (bounds)
-		{
-		
-			std::cout.width(6);
-			std::cout << "\n";
-			for (int j=0;j<dy;j++)
-			{
-				for (int i=0;i<dx;i++)
-				{
-				
-					std::cout << *(tmp->ind(i,j))<<" ";
-				}
-				std::cout << "\n";
-			}
-		}
-		if (bounds)
-		{
-		
-			std::cout.width(6);
-			std::cout << "\n";
-			for (int j=0;j<dimy;j++)
-			{
-				for (int i=0;i<dimx;i++)
-				{
-					std::cout << *(data->ind(i,j))<<" ";
-				}
-				std::cout << "\n";
-			}
-		}
-		*/
-	}
-
-	// Maximum und Minimum suchen
-	float fmax =0,fmin = 1000000;
-	for (int i=0;i<dimx;i++)
-	{
-		for (int j=0;j<dimy;j++)
-		{
-			if (*(data->ind(i,j)) > fmax)
-			{
-				fmax = *(data->ind(i,j));
-			}
-			if (*(data->ind(i,j)) < fmin)
-			{
-				fmin = *(data->ind(i,j));
-			}
-
-
-		}
-	}
-
-	// normieren auf [0..1]
-	for (int i=0;i<dimx;i++)
-	{
-		for (int j=0;j<dimy;j++)
-		{
-			*(data->ind(i,j)) -= fmin;
-			if (fmax-fmin !=0)
-			{
-				*(data->ind(i,j)) /= (fmax-fmin);
-			}
-		}
-	}
-	
-	
-	// Raender anlegen
-	if (bounds)
-	{
-		float bnd = MathHelper::Min(5.0f, MathHelper::Min(dimx/3.0f,dimy/3.0f));
-		float dist;
-		for (int i=0;i<dimx;i++)
-		{
-			for (int j=0;j<dimy;j++)
-			{
-				dist = MathHelper::Min(MathHelper::Min(i,dimx-i-1),MathHelper::Min(j,dimy-j-1));
-				if (dist<bnd)
-				{
-					*(data->ind(i,j)) = *(data->ind(i,j))*(dist)/bnd + (bnd-dist)/bnd;
-				}
-			}
-		}
-	}
-	
-	/*
-	//Debugging
-	
-	std::cout << "\n";
-	for (int j=0;j<dimy;j++)
-	{
-		for (int i=0;i<dimx;i++)
-		{
-			std::cout << *(data->ind(i,j))<<" ";
-		}
-		std::cout << "\n";
-	}
-	*/
-	delete[] weight;
-	delete tmp;
-}
-
-
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mapgenerator.h"
+#include "world.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+
+bool operator<(WeightedLocation first, WeightedLocation second)
+{
+	return first.m_value< second.m_value;
+}
+
+TemplateMap::TemplateMap(int dimx, int dimy)
+	: m_template_map(dimx,dimy) , m_template_index_map(dimx,dimy)
+{
+	m_dimx = dimx;
+	m_dimy = dimy;
+}
+
+void TemplateMap::init(Matrix2d<char>* base_map)
+{
+	// Dimension der Basiskarte
+	int bdimx = m_dimx/2;
+	int bdimy = m_dimy/2;
+	
+	m_template_map.clear();
+	m_template_index_map.clear();
+	int val;
+	
+	// 8x8 Feld Informationen aus der Basiskarte in
+	// 4x4 Karte uebertragen
+	for (int i=0; i<bdimx; i++)
+	{
+		for (int j=0; j<bdimy; j++)
+		{
+			if ((*base_map)[i][j] <= 0)
+			{
+				val = -1;
+			}
+			else
+			{
+				val =0;
+			}
+			
+			m_template_map[2*i][2*j] = val;
+			m_template_map[2*i][2*j+1] = val;
+			m_template_map[2*i+1][2*j+1] = val;
+			m_template_map[2*i+1][2*j] = val;
+		}
+	}
+	
+	// unterer und linker Rand mit -1 fuellen
+	for (int i=0; i<m_dimx; i++)
+	{
+		m_template_map[i][m_dimy-1] = -1;
+	}
+	for (int j=0; j<m_dimy; j++)
+	{
+		m_template_map[m_dimx-1][j] = -1;
+	}
+	
+	// restliche Karte berechnen
+	for (int i=m_dimx-2; i>=0; i--)
+	{
+		for (int j=m_dimy-2; j>=0; j--)
+		{
+			recalcMapElement(i,j);
+		}
+	}
+}
+
+void TemplateMap::recalcMapElement(int i,int j)
+{
+	int val;
+	if (i >= m_dimx || j >= m_dimy)
+		return;
+	
+	if (i== m_dimx-1 || j == m_dimy-1)
+	{
+		val = -1;	// Rand immer blockiert
+	}
+	else if (m_template_map[i][j] == -1)
+	{
+		val = -1;	// blockiert bleibt blockiert
+	}
+	else
+	{
+		// Minimum aus den Felden darunter, daneben, diagonal darunter; plus 1
+		val = m_template_map[i+1][j];
+		val = MathHelper::Min(val, m_template_map[i][j+1]);
+		val = MathHelper::Min(val, m_template_map[i+1][j+1]);
+		val ++;
+		
+		if (val == 0)
+			val = 1;
+	}
+	
+	if (val != -1)
+	{
+		setMapElement(i,j,val);
+	}
+}
+
+void TemplateMap::setMapElement(int i, int j, int template_max_size)
+{
+	int oldval = m_template_map[i][j];
+	
+	if (oldval == template_max_size || oldval == -1)
+		return;
+	
+	// aus Datenstrukturen entfernen falls alter Wert > 0
+	if (oldval > 0)
+	{
+		// geloescht wird, indem das letzte Element des Vektors
+		// ueber das zu loeschende kopiert wird
+		int oldindex = m_template_index_map[i][j];
+		int vecsize = m_template_places[oldval].size();
+		if (oldindex != vecsize -1)
+		{
+			int lastx = m_template_places[oldval][vecsize-1].first;
+			int lasty = m_template_places[oldval][vecsize-1].second;
+			m_template_places[oldval][oldindex].first = lastx;
+			m_template_places[oldval][oldindex].second = lasty;
+			m_template_index_map[lastx][lasty] = oldindex;
+		}
+		
+		//m_template_places[oldval].resize(vecsize-1);
+		m_template_places[oldval].pop_back ();
+	}
+	
+	m_template_map[i][j] = template_max_size;
+	
+	// Eintragen des neuen Wertes in die Datenstrukturen
+	if (template_max_size > 0)
+	{
+		int vecsize = m_template_places[template_max_size].size();
+		m_template_places[template_max_size].resize(vecsize +1);
+		m_template_places[template_max_size][vecsize].first = i;
+		m_template_places[template_max_size][vecsize].second = j;
+		m_template_index_map[i][j] = vecsize;
+	}
+	
+}
+
+bool TemplateMap::getTemplatePlace(Shape* shape, Vector & place)
+{
+	if (shape ==0)
+	{
+		return false;
+	}
+
+	bool success = false;
+
+	// Groesse des Templates in 4x4 Feldern
+	Vector ext = shape->getAxisExtent();
+	int ex = int(ceil(ext.m_x/2));
+	int ey = int(ceil(ext.m_y/2));
+	
+	int size = MathHelper::Max(ex,ey);
+	DEBUGX("template size %i %i angle %f extent %f %f",ex,ey,shape->m_angle,shape->m_extent.m_x, shape->m_extent.m_y);
+	std::map< int, std::vector< std::pair<int, int> > >::iterator mt, mt2;
+	std::vector<int>::iterator st;
+	
+	int px,py;
+	
+	while (!success)
+	{
+		int nr;
+		// Anzahl der in Frage kommenden Orte ermitteln
+		// alle Orte aufsummieren mit Abstandsindex mindens size
+		nr =0;
+		mt2 = mt = m_template_places.lower_bound(size);
+
+		while (mt != m_template_places.end())
+		{
+			nr += mt->second.size();
+			++mt;
+		}
+
+		if (nr == 0)
+		{
+			// kein Platz fuer das Template vorhanden
+			return false;
+		}
+		
+		// Ort auswuerfeln und ermitteln
+		nr = Random::randi(nr);
+		mt = mt2;
+		while (nr >= int(mt->second.size()))
+		{
+			nr -= mt->second.size();
+			++mt;
+		}
+		
+		px = mt->second[nr].first;
+		py = mt->second[nr].second;
+		
+		// Flaeche die durch das Template ueberdeckt wird bestimmen
+		int imin = px;
+		int jmin = py;
+		int imax = imin + ex -1;
+		int jmax = jmin + ey -1;
+		// Ort eines eventuellen Hindernisses
+		int obi = -1, obj= -1;
+
+		// Pruefen ob die Flaeche keine Hindernisse enthaelt
+		for (int i = imin; i<= imax; i++)
+		{
+			for (int j= jmin; j<= jmax; j++)
+			{
+				if (m_template_map[i][j] <0)
+				{
+					obi = i;
+					obj = j;
+					DEBUGX("found obstacle at %i %i",i,j);
+					break;
+				}
+			}
+			if (obi != -1)
+			{
+				break;
+			}
+		}
+		
+		if (obi != -1)
+		{
+			// Hindernis gefunden
+
+			// dieses Hindernis verhindert das platzieren der Templates in seiner Umgebung
+			// in dieser Umgebung werden die Zahlen fuer den minimalen Abstand zum naechsten Hindernis aktualisiert
+			imin = MathHelper::Max(0,obi - size+1);
+			jmin = MathHelper::Max(0,obj - size+1);
+			imax = obi;
+			jmax = obj;
+
+			// Schleife ueber die Umgebung des Hindernisses
+			for (int i = imax; i>= imin; i--)
+			{
+				for (int j= jmax; j>= jmin; j--)
+				{
+					recalcMapElement(i,j);
+				}
+			}
+		}
+		else
+		{
+			// Erfolg
+			// Orte die von dem Template ueberdeckt werden aus der Liste der freien Orte entfernen
+
+			// Objekt auf der Template Karte eintragen
+			for (int i = imin; i<= imax; i++)
+			{
+				for (int j= jmin; j<= jmax; j++)
+				{
+					setMapElement(i,j,-1);
+				}
+			}
+			
+			place.m_x = px*4+2*ex;
+			place.m_y = py*4+2*ey;
+
+			DEBUGX("found place %i %i",px,py);
+
+			success = true;
+		}
+	}
+	return true;
+}
+
+
+void TemplateMap::print()
+{
+	for (int i=0; i< m_dimx; i++)
+	{
+		for (int j=0; j<m_dimy; j++)
+		{
+			if (m_template_map[i][j]>0)
+				std::cout << m_template_map[i][j] << " ";
+			else
+				std::cout << "# ";
+		}
+		std::cout << "\n";
+	}
+	std::cout << "\n";
+	
+	std::map< int, std::vector< std::pair<int, int> > >::iterator it;
+	for (it = m_template_places.begin(); it != m_template_places.end(); ++it)
+	{
+		SW_DEBUG("places of size %i : %i",it->first, it->second.size());
+	}
+}
+
+
+Region* MapGenerator::createRegion(RegionData* rdata)
+{
+	// TODO: remove timer.
+	static Timer timer;
+	timer.start ();
+
+	// set Random seed based on the region information
+	// surely, we need a better hash funcion
+	unsigned int seed = World::getWorld()->getBaseRandomSeed() + rdata->m_id*84859;
+	unsigned int oldseed = Random::randi(INT_MAX);
+	Random::setRandomSeed(seed);
+	
+	// temporaere Daten fuer die Erzeugung der Region
+	MapGenerator::MapData mdata;
+
+	bool success = false;
+	int counter =0;
+	while (!success)
+	{
+		counter ++;
+		if (counter > 10)
+			return 0;
+		
+		// Speicher anfordern
+		MapGenerator::createMapData(&mdata,rdata);
+
+		SoundHelper::signalSoundManager ();
+
+		// grundlegende Karte anfertigen
+		if (rdata->m_region_template =="")
+		{
+			MapGenerator::createBaseMap(&mdata,rdata);
+		}
+		
+		// Umgebungen in die Region einfuegen
+		std::list<std::pair<float, EnvironmentName> >::iterator et;
+		for (et = rdata->m_environments.begin(); et != rdata->m_environments.end(); ++et)
+		{
+			mdata.m_region->insertEnvironment(et->first,et->second);
+		}
+
+		// Umgebungskarte generieren
+		createPerlinNoise(&mdata.m_region->getHeight(), rdata->m_dimx, rdata->m_dimy,MathHelper::Min(rdata->m_dimx,rdata->m_dimy)/4 , 0.4,false);
+
+		if (rdata->m_region_template =="")
+		{
+			// Objektgruppen platzieren
+			success = MapGenerator::insertGroupTemplates(&mdata,rdata);
+		}
+		else
+		{
+			DEBUGX("region template %s",rdata->m_region_template.c_str());
+			// Region besteht aus einer einzelnen Objektgruppe
+			// Objektgruppe anhand des Namens suchen
+			ObjectGroup* templ;
+			templ = ObjectFactory::getObjectGroup(rdata->m_region_template);
+			if (templ ==0)
+			{
+				ERRORMSG("unknown object group %s",rdata->m_region_template.c_str());
+				return 0;
+			}
+
+			Vector pos(rdata->m_dimx*2, rdata->m_dimy*2);
+			mdata.m_region->createObjectGroup(rdata->m_region_template,pos,0);
+			success = true;
+		}
+		
+		// Events kopieren
+		mdata.m_region->copyEventsFromRegionData(rdata);
+		
+		mdata.m_region->setReviveLocation(rdata->m_revive_location);
+		mdata.m_region->setGroundMaterial(rdata->m_ground_material);
+		
+		// Wenn der Versuch nicht erfolgreich war alles loeschen und von vorn beginnen
+		if (!success)
+		{
+			SW_DEBUG("not successful");
+
+			delete mdata.m_base_map;
+			delete mdata.m_region;
+		}
+	}
+
+	if (rdata->m_region_template =="")
+	{
+		// Berandungen einfuegen
+		MapGenerator::createBorder(&mdata,rdata);
+	}
+	
+	// Ausgaenge erzeugen
+	MapGenerator::createExits(&mdata,rdata);
+	
+	if (rdata->m_region_template =="")
+	{
+		// Monster einfuegen
+		MapGenerator::insertSpawnpoints(&mdata,rdata);
+	}
+
+	// Speicher freigeben
+	delete mdata.m_base_map;
+	
+	// Zufallszahlengenerator zuruecksetzen
+	Random::setRandomSeed(oldseed);
+	
+	float duration = timer.getTime ();
+	SW_DEBUG ("Map generator created region in %.2f millis", duration);
+	return mdata.m_region;
+}
+
+
+void MapGenerator::createMapData(MapData* mdata, RegionData* rdata)
+{
+	mdata->m_base_map = new Matrix2d<char>(rdata->m_dimx/2,rdata->m_dimy/2);
+	mdata->m_base_map->clear();
+	mdata->m_region = new Region(rdata->m_dimx,rdata->m_dimy,rdata->m_id,rdata->m_name,rdata);
+	mdata->m_border.clear();
+}
+
+
+void MapGenerator::createBaseMap(MapData* mdata, RegionData* rdata)
+{
+	float size = rdata->m_area_percent;
+
+	// Karte wird in 8x8 Felder erzeugt, Region rechnet aber in 4x4 Gridunits
+	int dimx = rdata->m_dimx/2;
+	int dimy = rdata->m_dimy/2;
+
+	// temporaere Karte anlegen
+	Matrix2d<float>* hmap = new Matrix2d<float>(dimx, dimy);
+
+	hmap->clear();
+
+	// Karte erzeugen mit Perlin Noise
+	// erhaltenes Feld wird als Hoehenkarte interpretiert
+	// alle Felder die unterhalb eines kritischen Niveaus liegen sind begehbar
+	createPerlinNoise(hmap,dimx, dimy, rdata->m_granularity/2, rdata->m_complexity,true);
+
+
+	// Delta zu Nachbarfeldern
+	int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
+	int dnb[8][2] = {{-1,0},{1,0},{0,-1},{0,1},{-1,1},{1,1},{1,-1},{-1,-1}};
+
+	// Suchen eine Niveaus das eine hinreichend grosse zusammenhaengende Flaeche erzeugt
+	// Idee: alle Felder werden in einer PriorityQueue eingeordnet
+	// alle Felder werden in einen UnionFind Baum eingeordnet
+	// von kleinster Höhe beginnend werden die Felder jeweils mit dem tiefstliegenden Nachbarfeld verschmolzen
+
+	std::priority_queue<WeightedLocation> fields_queue;
+	WeightedLocation loc;
+	for (int i=0; i< dimx; i++)
+	{
+		for (int j=0; j< dimy; j++)
+		{
+			loc.m_x = i;
+			loc.m_y = j;
+			loc.m_value = 1- (*hmap)[i][j];
+
+			fields_queue.push(loc);
+		}
+	}
+
+	UnionFindTree uftree(dimx*dimy);
+
+	float height;
+	int x,y,nbx, nby;
+
+	// Solange *Wasserstand* erhoehen, bis eine genuegend grosse zusammenhaengende Flaeche gefunden wurde
+	while (1)
+	{
+		// oberstes Feld aus der Queue nehmen
+		loc = fields_queue.top();
+		fields_queue.pop();
+
+		height = 1-loc.m_value;
+		x = loc.m_x;
+		y = loc.m_y;
+
+		// Schleife ueber die Nachbarfelder
+		for (int i=0; i<4; i++)
+		{
+			nbx = x + nb[i][0];
+			nby = y + nb[i][1];
+
+			// Dimension pruefen
+			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
+				continue;
+
+			if ( (*hmap)[nbx][nby] <= height)
+			{
+				uftree.merge(nbx*dimy+nby,x*dimy+y);
+			}
+		}
+
+		// Testen ob eine hinreichend große Flaeche entstanden ist
+		if (uftree.getCardinality(x*dimy+y) >= dimx*dimy*size)
+		{
+			break;
+		}
+
+	}
+
+	// kleiner Aufschlag um sehr enge Durchgaenge zu vermeiden
+	height += 0.01;
+	
+	/*
+	// Debugging
+	DEBUG("height %f",height);
+	for (int j=0; j< dimy; j++)
+	{
+		for (int i=0; i< dimx; i++)
+		{
+			if ((*hmap)[i][j]<height)
+			{
+				std::cout << " ";
+			}
+			else
+			{
+				std::cout << "X";
+			}
+		}
+		std::cout << "\n";
+	}
+	*/
+	
+	// Floodfill um die Flaeche und deren Rand zu finden
+	// die besuchten Felder werden in border mit 1 markiert
+	// es werden nur Felder besucht, die unterhalb der gefundenen Hoehe liegen
+	int cnt=0;
+	std::queue<std::pair<int,int> > qu;
+	std::pair<int,int> point;
+
+	// Queue mit Felder die zum Rand gehoeren
+	std::queue<std::pair<int,int> > borderqu;
+
+	qu.push(std::make_pair(x,y));
+	(*(mdata->m_base_map))[x][y]=1;
+
+	// Solange die Queue nicht leer ist
+
+	while (!qu.empty())
+	{
+		// Feld entnehmen
+		point = qu.front();
+		qu.pop();
+
+		x = point.first;
+		y = point.second;
+
+		// Schleife ueber die Nachbarfelder
+		for (int i=0; i<4; i++)
+		{
+			nbx = x + nb[i][0];
+			nby = y + nb[i][1];
+
+			// Dimension pruefen
+			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
+				continue;
+
+			// nur noch nicht besuchte Felder
+			if ((*(mdata->m_base_map))[nbx][nby] != 0)
+				continue;
+
+			// Felder oberhalb der Obergrenze zum Rand hinzufuegen
+			if ((*hmap)[nbx][nby] > height)
+			{
+				borderqu.push(std::make_pair(nbx,nby));
+				(*(mdata->m_base_map))[nbx][nby]=-1;
+
+				mdata->m_border.push_back(std::make_pair(nbx,nby));
+				continue;
+			}
+
+			// Feld hinzufuegen
+			qu.push(std::make_pair(nbx,nby));
+			// als besucht markieren
+			(*(mdata->m_base_map))[nbx][nby]=1;
+
+			cnt++;
+		}
+	}
+	
+	//std::list<std::pair<int,int> >::iterator it;
+	//for (
+	
+	
+	// nochmal 3 Runden Floodfill um den Rand zu ermitteln
+
+	// Marker einfuegen
+	int markercnt =0;
+	borderqu.push(std::make_pair(-1,-1));
+
+
+	while (!borderqu.empty() && markercnt <3)
+	{
+		// Feld entnehmen
+		point = borderqu.front();
+		borderqu.pop();
+
+		x = point.first;
+		y = point.second;
+
+		// Testen ob der Marker entnommen wurde
+		if (x==-1)
+		{
+			markercnt ++;
+			borderqu.push(std::make_pair(-1,-1));
+			continue;
+		}
+
+		// Schleife ueber die Nachbarfelder
+		for (int i=0; i<8; i++)
+		{
+			nbx = x + dnb[i][0];
+			nby = y + dnb[i][1];
+
+			// Dimension pruefen
+			if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy)
+				continue;
+
+			// nur noch nicht besuchte Felder
+			if ((*(mdata->m_base_map))[nbx][nby] != 0)
+				continue;
+
+
+			// Feld hinzufuegen
+			borderqu.push(std::make_pair(nbx,nby));
+			// als besucht markieren
+			(*(mdata->m_base_map))[nbx][nby]=-1;
+		}
+	}
+	
+
+	delete hmap;
+}
+
+bool MapGenerator::insertGroupTemplates(MapData* mdata, RegionData* rdata)
+{
+	TemplateMap tmap(rdata->m_dimx, rdata->m_dimy);
+	tmap.init(mdata->m_base_map);
+	
+	// obligatorische Objektgruppen einfuegen
+
+	std::multimap<int, RegionData::NamedObjectGroup >::reverse_iterator it;
+	Shape s;
+	Vector pos;
+	bool succ;
+	
+	for (it = rdata->m_named_object_groups.rbegin(); it != rdata->m_named_object_groups.rend(); ++it)
+	{
+		// Objektgruppe anhand des Namens suchen
+		s = ObjectFactory::getObjectGroupShape(it->second.m_group_name);
+		if (s.m_center.m_x < 0)
+		{
+			ERRORMSG("unknown object group %s",it->second.m_group_name.c_str());
+			continue;
+		}
+
+		// Ort fuer das Template suchen
+		succ = tmap.getTemplatePlace(&s,pos);
+		s.m_center = pos;
+
+		if (succ == false)
+		{
+			// Obligatorisches Template konnte nicht platziert werden
+			SW_DEBUG("could not place template %s",it->second.m_group_name.c_str());
+			/*
+			int hdimx = rdata->m_dimx/2;
+			int hdimy = rdata->m_dimy/2;
+			for (int i=0; i<hdimx; i++)
+			{
+				for (int j=0; j< hdimy;j++)
+				{
+					if (*(mdata->m_base_map->ind(i,j)) != -1)
+					{
+						std::cout << "  ";
+					}
+					else
+					{
+						std::cout << "# ";
+					}
+				}
+				std::cout << "\n";
+			}
+			*/
+			return false;
+		}
+
+		// Objektgruppe einfuegen
+		DEBUGX("placing group %s at %f %f",it->second.m_group_name.c_str(), pos.m_x, pos.m_y);
+		mdata->m_region->createObjectGroup(it->second.m_group_name,pos,s.m_angle, it->second.m_name);
+		insertBlockedArea(mdata,s);
+
+		
+	}
+	
+	if (rdata->m_has_waypoint)
+	{
+		ObjectGroup* templ;
+	
+		// Wegpunkt einfuegen
+		templ = ObjectFactory::getObjectGroup("waypoint_templ");
+		memcpy(&s , templ->getShape(), sizeof(Shape));
+		succ = tmap.getTemplatePlace(&s,pos);
+		s.m_center = pos;
+		
+		if (succ == false)
+		{
+			// Wegpunkt konnte nicht platziert werden
+			SW_DEBUG("could not place waypoint");
+			return false;
+		}
+		mdata->m_region->createObjectGroup("waypoint_templ",pos,0);
+		insertBlockedArea(mdata,s);
+	}
+	
+	// fakultative Objektgruppen einfuegen
+	
+	std::multimap<int, RegionData::ObjectGroupSet >::reverse_iterator jt;
+	for (jt = rdata->m_object_groups.rbegin(); jt != rdata->m_object_groups.rend(); ++jt)
+	{
+		s = ObjectFactory::getObjectGroupShape(jt->second.m_group_name);
+		if (s.m_center.m_x < 0)
+		{
+			ERRORMSG("unknown object group %s",jt->second.m_group_name.c_str());
+			continue;
+		}
+
+		DEBUGX("template %s size %f %f",jt->second.m_group_name.c_str(),s.m_extent.m_x, s.m_extent.m_y);
+		float angle =0;
+		for (int i=0; i< jt->second.m_number; i++)
+		{
+			if (Random::random() > jt->second.m_probability)
+			{
+				continue;
+			}
+			
+			// Drehwinkel ermitteln
+			// Kreise beliebig Rechtecke nur um 90°
+			if (s.m_type == Shape::CIRCLE)
+			{
+				angle = 2*3.14159*Random::random();
+			}
+			else
+			{
+				int n = Random::randi(4);
+				angle = 3.14159*(n*90.0)/180.0;
+			}
+			s.m_angle = angle;
+			
+			// Ort fuer das Template suchen
+			succ = tmap.getTemplatePlace(&s,pos);
+			s.m_center = pos;
+			
+			if (succ == false)
+			{
+				// Template konnte nicht platziert werden
+				break;
+			}
+
+			// Objektgruppe einfuegen
+			DEBUGX("placing group %s at %f %f",jt->second.m_group_name.c_str(), pos.m_x, pos.m_y);
+			
+			mdata->m_region->createObjectGroup(jt->second.m_group_name,pos,angle);
+			if (! jt->second.m_decoration)
+			{
+				insertBlockedArea(mdata,s);
+			}
+		}
+		
+	}
+	return true;
+}
+
+
+void MapGenerator::createBorder(MapData* mdata, RegionData* rdata)
+{
+	// Delta zu Nachbarfeldern
+	int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
+
+	int hdimx = rdata->m_dimx/2;
+	int hdimy = rdata->m_dimy/2;
+
+	// Orte fuer den Ausgang in den vier Richtungen
+	int exit[4][2];
+	int exitcount[4];
+	for (int i=0; i<4; i++)
+	{
+		exit[i][0] = nb[i][0]*-1000;
+		exit[i][1] = nb[i][1]*-1000;
+		exitcount[i] =1;
+	}
+
+	// Ausgaenge suchen
+	for (int i=0; i<hdimx; i++)
+	{
+		for (int j=0; j< hdimy;j++)
+		{
+			if (*(mdata->m_base_map->ind(i,j)) >=1 )
+			{
+				// Testen ob das Feld als Ausgang in Frage kommt
+				// Also am noerdlichsten, westlichsten usw liegt
+				for (int k=0; k<4; k++)
+				{
+					if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] < i*nb[k][0] + j*nb[k][1])
+					{
+						exit[k][0] =i;
+						exit[k][1] =j;
+						exitcount[k] =1;
+					}
+					
+					if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] == i*nb[k][0] + j*nb[k][1])
+					{
+						int rnd = Random::randi(exitcount[k]);
+						if (rnd ==0)
+						{
+							exit[k][0] =i;
+							exit[k][1] =j;
+						}
+						exitcount[k] ++;
+					}
+				}
+			}
+
+		}
+	}
+
+	// Ausgaenge platzieren
+	for (int k=0; k<4; k++)
+	{
+		std::string dirname[4] = {"west","east","north","south"};
+		std::string locname;
+		if (rdata->m_exit_directions[k])
+		{
+			int i = exit[k][0];
+			int j = exit[k][1];
+
+
+			locname = "entry_";
+			locname += dirname[k];
+			mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4));
+            *(mdata->m_base_map->ind(i,j)) = 2;
+
+			i+= nb[k][0];
+			j+= nb[k][1];
+			locname = "exit_";
+			locname += dirname[k];
+			mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4));
+
+			while (i>=0 && j>=0 && i< hdimx && j<hdimy)
+			{
+				*(mdata->m_base_map->ind(i,j)) = 2;
+				i+= nb[k][0];
+				j+= nb[k][1];
+			}
+		}
+	}
+
+
+	
+	// fuer jedes markierte Feld werden die 4 Nachbarfelder angesehen
+	// die 4 Informationen werden als 4bit Zahl interpretiert
+	// blockierte Felder erhalten eine 0, freie eine 1
+	//
+	// es gibt 6 verschiedene Konstellationen fuer die Nachbarfelder
+	// die 4bit Zahl dient als Index um die Konstellation und den Drehwinkel zu erhalten
+	//
+	// Aufbau der Bitmaske:
+	// 
+	//  D
+	// A*B
+	//  C
+	// => Bitmaske ABCD
+	
+	// Liste mit den 6 verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind
+	// Form der 6 Template (+ frei, # blockiert):
+	//
+	// ?+?   ?+?   ?+?   ?+?   ?#?   ?+?
+	// ###   ##+   ###   ##+   ###   +#+
+	// ?#?   ?#?   ?+?   ?+?   ?#?   ?+?
+	std::string borders[6] = {"$border(side)","$border(corner)","$border(twoside)","$border(twocorner)","$border(filled)","$border(single_block)"};
+
+	// Maske dafuer, welche Situation vorliegt
+	int bmask[16]={4,0,0,2,0,1,1,3,0,1,1,3,2,3,3,5};
+
+	// Maske fuer die Rotationswinkel in Schritten von 90 Grad
+	int rotmask[16] = {0,0,2,0,3,0,3,0,1,1,2,2,1,1,3,0};
+	int mask =0;
+	int nbi, nbj;
+
+	// Abstaende der Diagonalen
+	int diag[4][2] ={{-1,-1},{-1,1},{1,1},{1,-1}};
+	
+	// Fuer die Diagonalen wird eine aehnliche Bitmaske erstellt:
+	// // eine 1 wird gesetzt, wenn das Feld selbst frei ist, die beiden Felder daneben aber besetzt
+	//
+	// B C
+	//  *
+	// A D
+	// => Bitmaske ABCD
+	
+	// Liste mit den verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind
+	// Form der Template (+ frei, # blockiert):
+	//
+	// ###   ###   ##+   +##   +#+   +#+
+	// ###   ###   ###   ###   ###   ###
+	// ###   ##+   ##+   ##+   ##+   +#+
+	
+	std::string smallcorners[8] = {"","(one_smallcorner)","(two_smallcorner)","(diag_smallcorner)","(three_smallcorner)","(four_smallcorner)"};
+		
+	int diagbmask[16]=    {0,1,1,2,1,3,2,4, 1,2,3,4,2,4,4,5};
+	int diagrotmask[16] = {0,0,1,0,2,0,1,0, 3,3,3,3,2,2,1,0};
+	
+	int diagi, diagj;
+	int dmask;
+	
+	ObjectGroupName templ,diagtempl;
+	float angle;
+
+	bool skip;
+
+	
+	for (int j=0; j< hdimy;j++)
+	{
+		for (int i=0; i<hdimx; i++)
+		{
+			skip = false;
+			if (*(mdata->m_base_map->ind(i,j)) != -1)
+			{
+				//std::cout << "  ";
+				continue;
+			}
+
+			mask =0;
+			dmask =0;
+			
+			// Bitmasken aufbauen
+			for (int k=0; k<4; k++)
+			{
+				nbi = i + nb[k][0];
+				nbj = j + nb[k][1];
+
+				mask *=2;
+				dmask  *= 2;
+				
+				if ( nbi>=0 && nbj>=0 && nbi<hdimx && nbj<hdimy)
+				{
+					if (*(mdata->m_base_map->ind(nbi,nbj)) >= 1)
+					{
+						mask +=1;
+					}
+
+				// Wenn eines der Nachbarfelder im *leeren Raum* liegt
+				// dann keine Objekte setzen
+					if (*(mdata->m_base_map->ind(nbi,nbj)) == 0)
+					{
+						skip = true;
+					}
+				}
+
+			
+				
+				// Bitmaske fuer Diagonalen
+				diagi = i + diag[k][0];
+				diagj = j + diag[k][1];
+				
+				if ( diagi>=0 && diagj>=0 && diagi<hdimx && diagj<hdimy)
+				{
+					if (*(mdata->m_base_map->ind(diagi,diagj)) >= 1 &&
+						*(mdata->m_base_map->ind(diagi,j)) == -1 &&
+						*(mdata->m_base_map->ind(i,diagj)) == -1)
+					{
+						dmask +=1;
+					}
+				}
+
+			}
+			
+			//std::cout << bmask[dmask] <<" ";
+			if (skip)
+				continue;
+
+			// Template und dessen Winkel bestimmen
+			templ = borders[bmask[mask]];
+			angle = rotmask[mask] *PI/2;
+
+			diagtempl = smallcorners[diagbmask[dmask]];
+			float diagangle = diagrotmask[dmask] *PI/2;
+			
+			// gemeinsames Template aus Innenecken und Rand herstellen
+			if (templ == "$border(filled)" && diagtempl !="")
+			{
+				templ ="$border";
+				templ += diagtempl;
+				angle = diagangle;
+			}
+			else if (templ == "$border(side)" && diagtempl == "(one_smallcorner)")
+			{
+				if (angle == diagangle)
+				{
+					templ = "$border(side)(right_smallcorner)";
+				}
+				else
+				{
+					templ = "$border(side)(left_smallcorner)";
+				}
+			}
+			else
+			{
+				templ += diagtempl;
+			}
+			
+			DEBUGX("placing type (%i %i) %s",i,j,templ.c_str());
+			
+			mdata->m_region->createObjectGroup(templ,Vector(i*8+4,j*8+4),angle);
+		}
+		//std::cout << "\n";
+	}
+
+
+
+}
+
+void MapGenerator::insertSpawnpoints(MapData* mdata, RegionData* rdata)
+{
+	// Punkte an denen Spawnpoints möglich sind
+	std::vector< std::pair<int,int> > points;
+
+	int hdimx = rdata->m_dimx/2;
+	int hdimy = rdata->m_dimy/2;
+
+	// moegliche Orte fuer Spawnpoints ermitteln
+	for (int i=0; i<hdimx; i++)
+	{
+		for (int j=0; j< hdimy;j++)
+		{
+			// nur erreichbare Felder
+			if (*(mdata->m_base_map->ind(i,j)) !=1)
+			{
+				continue;
+			}
+
+			points.push_back(std::make_pair(i,j));
+		}
+	}
+
+
+	// Spawnpoints platzieren
+	std::list<RegionData::SpawnGroup>::iterator st;
+	WorldObject* wo;
+	bool stop = false;
+	for (st = rdata->m_monsters.begin(); st != rdata->m_monsters.end() &&!stop; ++st)
+	{
+		// aufhoeren, wenn keine Orte mehr vorhanden
+		
+		DEBUGX("%s x %i",st->m_monsters.c_str(),st->m_number);
+		for (int i=0; i< st->m_number; i++)
+		{
+			int r = Random::randi(points.size());
+			wo = new Spawnpoint(st->m_monsters);
+
+			mdata->m_region->insertObject(wo,Vector(points[r].first*8+4, points[r].second*8+4));
+
+			DEBUGX("placing spawnpoint for %s at %i %i",st->m_monsters.c_str(), points[r].first*8+4, points[r].second*8+4);
+			
+			points[r] = points.back();
+			points.resize(points.size() -1);
+			if (points.empty())
+			{
+				stop = true;
+				break;
+			}
+		}
+	}
+}
+
+
+void MapGenerator::createExits(MapData* mdata, RegionData* rdata)
+{
+	int dimx = rdata->m_dimx/2;
+	int dimy = rdata->m_dimy/2;
+	
+	std::list<RegionExit>::iterator it;
+	Vector pos;
+	for (it = rdata->m_exits.begin(); it != rdata->m_exits.end(); ++it)
+	{
+		mdata->m_region->addExit(*it);
+
+		// Bei den Ausgaengen keine Monster
+		if (rdata->m_region_template =="")
+		{
+			pos = mdata->m_region->getLocation(it->m_exit_name);
+			int cx = int(pos.m_x/8);
+			int cy = int(pos.m_y/8);
+			for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++)
+			{
+				for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++)
+				{
+					if (*(mdata->m_base_map->ind(i,j))==1)
+					{
+						*(mdata->m_base_map->ind(i,j)) = 2;
+					}
+				}
+			}
+		}
+
+	}
+	
+	if (rdata->m_has_waypoint)
+	{
+		Vector pos = mdata->m_region->getLocation("WaypointLoc");
+		WorldObject* wo =	 new Waypoint();
+		mdata->m_region->insertObject(wo,pos);
+		mdata->m_region->getWaypointLocation() = pos;
+		
+		//mdata->m_region->insertObject(wo,pos);
+		DEBUGX("waypoint at %f %f %i",pos.m_x, pos.m_y,wo->getId());
+		
+		// Bei den Ausgaengen keine Monster
+		if (rdata->m_region_template =="")
+		{
+			int cx = int(pos.m_x/8);
+			int cy = int(pos.m_y/8);
+			for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++)
+			{
+				for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++)
+				{
+					if (*(mdata->m_base_map->ind(i,j))==1)
+					{
+						*(mdata->m_base_map->ind(i,j)) = 2;
+					}
+				}
+			}
+		}
+	}
+}
+
+void MapGenerator::insertBlockedArea(MapData* mdata, Shape s)
+{
+	// Groesse des Templates in 4x4 Feldern
+	Vector ext = s.getAxisExtent();
+	Vector emin = s.m_center - ext;
+	Vector emax = s.m_center + ext;
+	int imin = int(emin.m_x / 8);
+	int jmin = int(emin.m_y / 8);
+	int imax = int( ceil(emax.m_x / 8));
+	int jmax = int( ceil(emax.m_y / 8));
+	
+	for (int i=imin; i< imax; i++)
+	{
+		for (int j=jmin; j<jmax; j++)
+		{
+			if (*(mdata->m_base_map->ind(i,j))==1)
+			{
+				*(mdata->m_base_map->ind(i,j)) = 2;
+			}
+		}
+	}
+}
+
+
+void MapGenerator::createPerlinNoise(Matrix2d<float> *data, int dimx, int dimy,int startfreq, float persistance, bool bounds)
+{
+	Matrix2d<float>* tmp= new Matrix2d<float>(dimx+1, dimy+1);
+	tmp->clear();
+	float* weight = new float[MathHelper::Min(dimx,dimy)];
+	float ampl =1;
+	int dx,dy;
+	float invdist;
+	
+	if (startfreq > dimx || startfreq > dimy)
+	{
+		startfreq = MathHelper::Min(dimx,dimy);
+	}
+	
+	DEBUGX("Perlin noise dimx %i dimy %i",dimx,dimy);
+	
+	// Perlin Noise Algorithmus
+	// Aenderung hier: Schleife geht ueber den Abstand zwischen den Stuetzstellen
+	for (int dist = startfreq; dist>0 ;dist/=2)
+	{
+		// Dimension des Zufallszahlenfeldes fuer diesen Abstand
+		dx = 2+(dimx-2)/dist;
+		dy = 2+(dimy-2)/dist;
+		
+		DEBUGX("distance %i  tmp array %i %i",dist,dx,dy);
+		
+		// anlegen der Zufallszahlen fuer die aktuelle Frequenz
+		for (int i=0;i<=dx;i++)
+		{
+			for (int j=0;j<=dy;j++)
+			{
+				*(tmp->ind(i,j)) = Random::random()* ampl;
+
+			}
+
+		}
+
+		// Interpolation (nur fuer Abstand >1)
+		if (dist>1)
+		{
+			invdist = 1.0f/dist;
+	
+			for (int k=0;k<dist;k++)
+			{
+				weight[k] = k*invdist;
+			}
+	
+			
+			
+			for (int i=0;i<dx;i++)
+			{
+				for (int j=0;j<dy;j++)
+				{
+					for (int k=0;k<dist;k++)
+					{
+						for (int l=0;l<dist;l++)
+						{
+							if (i*dist+k< dimx && j*dist+l< dimy)
+							{
+								*(data->ind(i*dist+k,j*dist+l)) += (*(tmp->ind(i,j))*(1-weight[k])*(1-weight[l])
+										+ *(tmp->ind(i+1,j))*weight[k]*(1-weight[l])
+										+ *(tmp->ind(i+1,j+1))*weight[k]*weight[l]
+										+ *(tmp->ind(i,j+1))*(1-weight[k])*weight[l]) ;
+							}
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			for (int i=0;i<dimx;i++)
+			{
+				for (int j=0;j<dimy;j++)
+				{
+					*(data->ind(i,j)) +=*(tmp->ind(i,j));
+				}
+			}
+		}
+
+		ampl *= persistance;
+		/*
+		if (bounds)
+		{
+		
+			std::cout.width(6);
+			std::cout << "\n";
+			for (int j=0;j<dy;j++)
+			{
+				for (int i=0;i<dx;i++)
+				{
+				
+					std::cout << *(tmp->ind(i,j))<<" ";
+				}
+				std::cout << "\n";
+			}
+		}
+		if (bounds)
+		{
+		
+			std::cout.width(6);
+			std::cout << "\n";
+			for (int j=0;j<dimy;j++)
+			{
+				for (int i=0;i<dimx;i++)
+				{
+					std::cout << *(data->ind(i,j))<<" ";
+				}
+				std::cout << "\n";
+			}
+		}
+		*/
+	}
+
+	// Maximum und Minimum suchen
+	float fmax =0,fmin = 1000000;
+	for (int i=0;i<dimx;i++)
+	{
+		for (int j=0;j<dimy;j++)
+		{
+			if (*(data->ind(i,j)) > fmax)
+			{
+				fmax = *(data->ind(i,j));
+			}
+			if (*(data->ind(i,j)) < fmin)
+			{
+				fmin = *(data->ind(i,j));
+			}
+
+
+		}
+	}
+
+	// normieren auf [0..1]
+	for (int i=0;i<dimx;i++)
+	{
+		for (int j=0;j<dimy;j++)
+		{
+			*(data->ind(i,j)) -= fmin;
+			if (fmax-fmin !=0)
+			{
+				*(data->ind(i,j)) /= (fmax-fmin);
+			}
+		}
+	}
+	
+	
+	// Raender anlegen
+	if (bounds)
+	{
+		float bnd = MathHelper::Min(5.0f, MathHelper::Min(dimx/3.0f,dimy/3.0f));
+		float dist;
+		for (int i=0;i<dimx;i++)
+		{
+			for (int j=0;j<dimy;j++)
+			{
+				dist = MathHelper::Min(MathHelper::Min(i,dimx-i-1),MathHelper::Min(j,dimy-j-1));
+				if (dist<bnd)
+				{
+					*(data->ind(i,j)) = *(data->ind(i,j))*(dist)/bnd + (bnd-dist)/bnd;
+				}
+			}
+		}
+	}
+	
+	/*
+	//Debugging
+	
+	std::cout << "\n";
+	for (int j=0;j<dimy;j++)
+	{
+		for (int i=0;i<dimx;i++)
+		{
+			std::cout << *(data->ind(i,j))<<" ";
+		}
+		std::cout << "\n";
+	}
+	*/
+	delete[] weight;
+	delete tmp;
+}
+
+
+
--- a/src/core/monster.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/monster.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -145,7 +145,7 @@
 	bool tmp=Monster::init();
 	if(!tmp)
 	{
-		DEBUG("Initialisierung des Monsters fehlgeschlagen!");
+		SW_DEBUG("Initialisierung des Monsters fehlgeschlagen!");
 	}
 }
 
@@ -611,7 +611,7 @@
 	Action::ActionInfo* aci = Action::getActionInfo(act);
 	if (aci == 0)
 	{
-		DEBUG("unknown action %s",act.c_str());
+		SW_DEBUG("unknown action %s",act.c_str());
 		return;
 	}
 
@@ -953,7 +953,7 @@
 		if (valname.find("ai_ability_rating:") == 0)
 		{
 			std::string ablt = valname.substr(18); // ai_ability_rating: abschneiden
-			DEBUG("ability %s",ablt.c_str());
+			SW_DEBUG("ability %s",ablt.c_str());
 
 			std::map<std::string, AbilityInfo>::iterator at;
 			at = getBaseAttrMod()->m_abilities.find(ablt);
@@ -983,7 +983,7 @@
 		if (valname.find("ai_ability_rating:") == 0)
 		{
 			std::string ablt = valname.substr(18); // ai_ability_rating: abschneiden
-			DEBUG("ability %s",ablt.c_str());
+			SW_DEBUG("ability %s",ablt.c_str());
 
 			std::map<std::string, AbilityInfo>::iterator at;
 			at = getBaseAttrMod()->m_abilities.find(ablt);
--- a/src/core/nlfgclientnetwork.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/nlfgclientnetwork.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -43,7 +43,7 @@
 	unsigned success = nlfg_connect(hostname, req_port);
 	if (!success)
 	{
-        DEBUG("error connecting to server");
+        SW_DEBUG("error connecting to server");
 		m_status = NET_ERROR;
 	}
 	else
@@ -54,7 +54,7 @@
 
 void NLFGClientNetwork::serverDisconnect()
 {
-	DEBUG("closing connection");
+	SW_DEBUG("closing connection");
 	nlfg_disconnect();
 	// wait to deliver disconnect message
 #ifdef WIN32
@@ -89,11 +89,11 @@
             switch (id)
             {
                 case NLFG_CONNECTED:
-                    DEBUG("connected to server");
+                    SW_DEBUG("connected to server");
 					m_status = NET_CONNECTED;
                     break;
                 case NLFG_DISCONNECTED:
-                    DEBUG("connection timed out");
+                    SW_DEBUG("connection timed out");
 					m_status =NET_TIMEOUT;
                     break;
             }
--- a/src/core/nlfgservernetwork.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/nlfgservernetwork.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -75,17 +75,17 @@
 				case NLFG_CONNECTED:
 					slot = insertNewSlot(packet->addr);
 					pushNewLoginSlot(slot);
-					DEBUG("connection accepted for slot %i", slot);
+					SW_DEBUG("connection accepted for slot %i", slot);
 					break;
 
 				case NLFG_DISCONNECTED:
-					DEBUG("slot %i disconnected",slot);
+					SW_DEBUG("slot %i disconnected",slot);
 					delete m_slots[slot];
 					m_slots[slot]=0;
 					break;
 					
 				default:
-					DEBUG("unknown id: %i",id);
+					SW_DEBUG("unknown id: %i",id);
 					break;
 			}
 
--- a/src/core/options.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/options.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -15,8 +15,12 @@
 
 #include "options.h"
 
-#include "sound.h"
-#include "music.h"
+//#include "sound.h"
+//#include "music.h"
+
+// Allow the use of the sound manager.
+#include "gussound.h"
+
 #include "gettext.h"
 
 #include "OISKeyboard.h"
@@ -40,6 +44,9 @@
 #include "Windows.h"
 #endif
 
+using gussound::SoundManager;
+
+
 Options::Options()
 {
 	init();
@@ -142,7 +149,7 @@
 	bool loadOkay = doc.LoadFile();
 
 	ElementAttrib attr;
-
+	SW_DEBUG ("Reading user modifiable options from file [%s]", filename.c_str ());
 	if (loadOkay)
 	{
 		TiXmlNode* child;
@@ -282,12 +289,14 @@
 		}  // if root == <Options>
 		else
 		{
+			SW_DEBUG ("The file [%s] does not look like an options file. Reverting to default options.", filename.c_str ());
 			setToDefaultOptions();
 			return false;
 		}
 	}  // if (loadOkay)
 	else
 	{
+		SW_DEBUG ("Could not read data from file [%s]. Reverting to default options.", filename.c_str ());
 		setToDefaultOptions();
 		return false;
 	}
@@ -418,22 +427,30 @@
 
 void Options::setSoundVolume(float vol)
 {
-	SoundSystem::setSoundVolume(vol);
+	SW_DEBUG ("Setting sound volume to: %.2f", vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Effect, vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0);
+	//SoundSystem::setSoundVolume(vol);
 }
 
 float Options::getSoundVolume()
 {
-	return SoundSystem::getSoundVolume();
+	return SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Effect);
+	//return SoundSystem::getSoundVolume();
 }
 
-void Options::setMusicVolume(float vol)
+void Options::setMusicVolume (float vol)
 {
-	MusicManager::instance().setMusicVolume(vol);
+	SW_DEBUG ("Setting music volume to: %.2f", vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Music, vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0);
+	//MusicManager::instance().setMusicVolume(vol);
 }
 
 float Options::getMusicVolume()
 {
-	return MusicManager::instance().getMusicVolume();
+	return SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Music);
+	//return MusicManager::instance().getMusicVolume();
 }
 
 std::string Options::getLocale()
--- a/src/core/pathfind.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/pathfind.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -443,7 +443,7 @@
 
 	if (block[i][j]=='X')
 	{
-		DEBUG("blockiertes Feld betreten");
+		SW_DEBUG("blockiertes Feld betreten");
 		qmax = 1000000;
 		for (k=0;k<4;++k)
 		{
--- a/src/core/player.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/player.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -19,6 +19,9 @@
 #include "options.h"
 #include <tinyxml.h>
 
+// Sound operations helper.
+#include "soundhelper.h"
+
 PlayerCamera::PlayerCamera()
 {
 	m_distance = 20;
@@ -85,7 +88,7 @@
 	bool tmp=Player::init();
 	if (!tmp)
 	{
-		DEBUG("Initialiserung des Players fehlgeschlagen!");
+		SW_DEBUG("Initialiserung des Players fehlgeschlagen!");
 	}
 }
 
@@ -228,7 +231,7 @@
 
 void  Player::revive()
 {
-	DEBUG("reviving");
+	SW_DEBUG("reviving");
 
 	getRegion()->changeObjectGroup(this,PLAYER);
 	getDynAttr()->m_health = getBaseAttrMod()->m_max_health;
@@ -376,7 +379,7 @@
 						}
 						else
 						{
-							DEBUG("goal is too far away");
+							SW_DEBUG("goal is too far away");
 						}
 					}
 				}
@@ -497,7 +500,7 @@
 	{
 		if (ainfo != 0)
 		{
-			DEBUG("Basisaktion von %s verwendet",com->m_type.c_str());
+			SW_DEBUG("Basisaktion von %s verwendet",com->m_type.c_str());
 			com->m_type = ainfo->m_base_action;
 		}
 	}
@@ -696,6 +699,9 @@
 
 						getRegion()->insertPlayerTeleport(getId(), m_revive_position);
 						clearCommand(true,true);
+						// TODO: this is a sound that should be also available to other players.
+						// Switch to an event-based solution.
+						SoundHelper::playAmbientSoundGroup ("teleport");
 					}
 				}
 				else
@@ -725,7 +731,7 @@
 							m_timers_max[it->m_consume_timer_nr-1] = it->m_consume_timer;
 							addToNetEventMask(NetEvent::DATA_TIMER);
 						}
-						DEBUG("started timer %i for %f",it->m_consume_timer_nr, it->m_consume_timer);
+						SW_DEBUG("started timer %i for %f",it->m_consume_timer_nr, it->m_consume_timer);
 					}
 					else
 					{
@@ -1484,6 +1490,7 @@
 					regloc.second="WaypointLoc";
 					getRegion()->insertPlayerTeleport(getId(), regloc);
 					clearCommand(true,true);
+					SoundHelper::playAmbientSoundGroup ("teleport");
 				}
 				else if (command->m_id == -999 && m_portal_position.first != "")
 				{
@@ -1493,6 +1500,9 @@
 					regloc.second="";
 					setPortalPosition(regloc);
 					clearCommand(true,true);
+					// TODO: this is a sound that should be also available to other players.
+					// Switch to an event-based solution.
+					SoundHelper::playAmbientSoundGroup ("teleport");
 				}
 			}
 			break;
@@ -1512,7 +1522,7 @@
 
 
 		default:
-			DEBUG("unknown command: %i",command->m_button);
+			SW_DEBUG("unknown command: %i",command->m_button);
 	}
 
 	if (oldcommand != *getNextCommand() && delay>0)
@@ -1646,7 +1656,7 @@
 		}
 		else
 		{
-			DEBUG("no item found at %f %f",goal.m_x,goal.m_y);
+			SW_DEBUG("no item found at %f %f",goal.m_x,goal.m_y);
 		}
 	}
 	else
@@ -1961,7 +1971,7 @@
 	m_emotion_set = m_look.m_emotion_set;
 	int cnt;
 	cv->fromBuffer(cnt);
-	DEBUG("number of items: %i",cnt);
+	SW_DEBUG("number of itSW_DEBUG%i",cnt);
 	for ( short i = 0; i< cnt; i++)
 	{
 		readItem(cv);
--- a/src/core/projectile.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/projectile.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -391,7 +391,7 @@
 			// zufaelliges weiterspringen, Chance 50%
 			if (rand()<RAND_MAX*0.5)
 			{
-				DEBUG("prob bounce");
+				SW_DEBUG("prob bounce");
 				bounce = true;
 			}
 		}
--- a/src/core/region.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/region.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,3100 +1,3173 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "region.h"
-#include "world.h"
-#include "player.h"
-#include "eventsystem.h"
-#include "itemfactory.h"
-#include "scriptobject.h"
-
-#include "music.h"
-
-RegionData::RegionData()
-{
-	m_id = -1;
-	m_dimx= 0;
-	m_dimy = 0;
-	m_area_percent = 0.0f;
-	m_complexity = 0.0f;
-	m_granularity = 0;
-	m_exit_directions[0] = false;
-	m_exit_directions[1] = false;
-	m_exit_directions[2] = false;
-	m_exit_directions[3] = false;
-  
-	for (int i=0; i<3; i++)
-	{
-		m_ambient_light[i] = 0.2;
-		m_hero_light[i] = 1.0;
-		m_directional_light[i] = 0.3;
-	}
-	m_has_waypoint = false;
-}
-
-
-RegionData::~RegionData()
-{
-	std::multimap<TriggerType, Event*>::iterator it;
-	for (it = m_events.begin(); it != m_events.end(); ++it)
-	{
-		delete it->second;
-	}
-	
-}
-
-void RegionData::addObjectGroup(ObjectGroupName group_name, int prio, int number,float probability, bool decoration)
-{
-	ObjectGroupSet newgroup;
-	newgroup.m_group_name = group_name;
-	newgroup.m_probability = probability;
-	newgroup.m_number = number;
-	newgroup.m_probability = probability;
-	newgroup.m_decoration = decoration;
-	
-	m_object_groups.insert(std::make_pair(prio,newgroup));
-}
-
-void RegionData::addEvent(TriggerType trigger, Event* event)
-{
-	m_events.insert(std::make_pair(trigger,event));
-}
-
-void RegionCamera::addPosition(Position& pos, float time)
-{
-	if (m_next_positions.empty() && World::getWorld()->isServer())
-	{
-		NetEvent event;
-		event.m_type = NetEvent::REGION_CAMERA;
-		event.m_id = m_region->getId();
-		m_region->insertNetEvent(event);
-	}
-	m_next_positions.push_back(std::make_pair(pos,time));
-}
-
-void RegionCamera::update(float time)
-{
-	if (m_next_positions.empty())
-		return;
-	
-	Position& pos = m_next_positions.front().first;
-	float& rtime = m_next_positions.front().second;
-	
-	if (rtime <= time)
-	{
-		// naechstes Etappenziel wurde erreicht
-		if (rtime != 0)
-		{
-			Trigger* tr = new Trigger("camera_move_complete");
-			m_region->insertTrigger(tr);
-		}
-		
-		m_position  = pos;
-		m_next_positions.pop_front();
-		
-		if (m_next_positions.empty())
-		{
-			Trigger* tr = new Trigger("all_camera_moves_complete");
-			m_region->insertTrigger(tr);
-		}
-		else
-		{
-			if ( World::getWorld()->isServer())
-			{
-				
-				NetEvent event;
-				event.m_type = NetEvent::REGION_CAMERA;
-				event.m_id = m_region->getId();
-				m_region->insertNetEvent(event);
-			}
-		}
-	}
-	else
-	{
-		// Phi so anpassen, dass jeweils der kuerzere Teilkreis genutzt wird
-		if (m_position.m_phi - pos.m_phi > 180)
-			m_position.m_phi -= 360;
-	
-		if (m_position.m_phi - pos.m_phi < -180)
-			m_position.m_phi += 360;
-		
-		float frac = time/rtime;
-		m_position.m_distance = (1-frac)*m_position.m_distance + frac* pos.m_distance;
-		m_position.m_phi = (1-frac)*m_position.m_phi + frac* pos.m_phi;
-		m_position.m_theta = (1-frac)*m_position.m_theta + frac* pos.m_theta;
-		m_position.m_focus = m_position.m_focus*(1-frac) + pos.m_focus*frac;
-		
-		rtime -= time;
-	}
-}
-
-void RegionCamera::toString(CharConv* cv)
-{
-	cv->toBuffer(m_position.m_distance);
-	cv->toBuffer(m_position.m_phi);
-	cv->toBuffer(m_position.m_theta);
-	cv->toBuffer(m_position.m_focus.m_x);
-	cv->toBuffer(m_position.m_focus.m_y);
-	if (m_next_positions.empty())
-	{
-		cv->toBuffer(static_cast<char>('0'));
-	}
-	else
-	{
-		cv->toBuffer(static_cast<char>('1'));
-		Position& pos = m_next_positions.front().first;
-		
-		cv->toBuffer(pos.m_distance);
-		cv->toBuffer(pos.m_phi);
-		cv->toBuffer(pos.m_theta);
-		cv->toBuffer(pos.m_focus.m_x);
-		cv->toBuffer(pos.m_focus.m_y);
-		cv->toBuffer(m_next_positions.front().second);
-			
-	}
-}
-
-void RegionCamera::fromString(CharConv* cv)
-{
-	cv->fromBuffer(m_position.m_distance);
-	cv->fromBuffer(m_position.m_phi);
-	cv->fromBuffer(m_position.m_theta);
-	cv->fromBuffer(m_position.m_focus.m_x);
-	cv->fromBuffer(m_position.m_focus.m_y);
-	
-	char c='0';
-	cv->fromBuffer(c);
-	if (c =='1')
-	{
-		Position pos;
-		
-		cv->fromBuffer(pos.m_distance);
-		cv->fromBuffer(pos.m_phi);
-		cv->fromBuffer(pos.m_theta);
-		cv->fromBuffer(pos.m_focus.m_x);
-		cv->fromBuffer(pos.m_focus.m_y);
-		
-		float time;
-		cv->fromBuffer(time);
-		
-		time -= cv->getDelay();
-		
-		if (time > 0)
-		{
-			addPosition(pos,time);
-		}
-		else
-		{
-			memcpy(&m_position,&pos,sizeof(Position));
-		}
-	}
-}
-
-
-void RegionLight::Light::update(float time)
-{
-	if (m_timer != 0)
-	{
-		if (m_timer < time)
-		{
-			for (int i=0; i<3; i++)
-				m_value[i] = m_goal_value[i];
-			m_timer =0;
-		}
-		else
-		{
-			float rel = time / m_timer;
-			for (int i=0; i<3; i++)
-			{
-				m_value[i] = rel*m_goal_value[i] + (1-rel)*m_value[i];
-			}
-			m_timer -= time;
-		}
-	}
-}
-
-
-void RegionLight::Light::toString(CharConv* cv)
-{
-	for (int i=0; i<3; i++)
-	{
-		cv->toBuffer(m_value[i]);
-	}
-	for (int i=0; i<3; i++)
-	{
-		cv->toBuffer(m_goal_value[i]);
-	}
-	cv->toBuffer(m_timer);
-}
-
-void RegionLight::Light::fromString(CharConv* cv)
-{
-	for (int i=0; i<3; i++)
-	{
-		cv->fromBuffer(m_value[i]);
-	}
-	for (int i=0; i<3; i++)
-	{
-		cv->fromBuffer(m_goal_value[i]);
-	}
-	cv->fromBuffer(m_timer);	
-}
-
-
-void RegionLight::init(float* ambient, float* herolight, float* directional)
-{
-	for (int i=0; i<3; i++)
-	{
-		m_ambient_light.m_value[i] = ambient[i];
-		m_hero_light.m_value[i] = herolight[i];
-		m_directional_light.m_value[i] = directional[i];	
-	}
-}
-
-void RegionLight::setLight(std::string lighttype, float* value, float time)
-{
-	Light* light =0;
-	if (lighttype == "ambient")
-		light = &m_ambient_light;
-	if (lighttype == "hero")
-		light = &m_hero_light;
-	if (lighttype == "directional")
-		light = &m_directional_light;
-	
-	if (light != 0)
-	{
-		if (time > 0)
-		{
-			for (int i=0; i<3; i++)
-			{
-				light->m_goal_value[i] = value[i];
-			}
-			light->m_timer = time;
-		}
-		else
-		{
-			
-			for (int i=0; i<3; i++)
-			{
-				light->m_value[i] = value[i];
-			}
-			light->m_timer=0;
-		}
-		
-		NetEvent event;
-		event.m_type = NetEvent::REGION_LIGHT;
-		event.m_id = m_region->getId();
-		m_region->insertNetEvent(event);
-	}
-}
-
-void RegionLight::toString(CharConv* cv)
-{
-	m_ambient_light.toString(cv);
-	m_hero_light.toString(cv);
-	m_directional_light.toString(cv);	
-}
-
-void RegionLight::fromString(CharConv* cv)
-{
-	m_ambient_light.fromString(cv);
-	m_hero_light.fromString(cv);
-	m_directional_light.fromString(cv);	
-}
-
-// Note: 
-// This is not recommended normally: sending a partially constructed object (this)
-// to an instantiated item (m_light). In this instance it works, since m_light only
-// stores the pointer. If any other operations would be attempted, it could spell disaster.
-Region::Region(short dimx, short dimy, short id, std::string name, RegionData* data):
-	m_dimx(dimx),
-	m_dimy(dimy),
-
-	m_data_grid(dimx, dimy),
-	m_height(dimx, dimy),
-
-	m_id(id),
-	m_name(name),
-	m_cutscene_mode(false),
-
-	m_revive_location(""),
-
-	m_light(this)
-{
-	DEBUGX("creating region");
-
-	m_data_grid.clear();
-	m_height.clear();
-	
-	Trigger* tr = new Trigger("create_region");
-	insertTrigger(tr);
-	
-	if (data)
-	{
-		m_light.init(data->m_ambient_light, data->m_hero_light, data->m_directional_light);
-		m_music_tracks = data->m_music_tracks;
-	}
-	
-	m_camera.m_region = this;
-}
-
-Region::~Region()
-{
-	WorldObjectMap::iterator i;
-	for (i=m_objects.begin(); i!=m_objects.end();++i)
-	{
-		delete i->second;
-	}
-
-	for (i=m_static_objects.begin(); i!=m_static_objects.end();++i)
-	{
-		delete i->second;
-	}
-
-	ProjectileMap::iterator j;
-	for (j =  m_projectiles.begin(); j != m_projectiles.end(); ++j)
-	{
-		delete (j->second);
-	}
-
-
-	DropItemMap::iterator k;
-	for (k =  m_drop_items.begin(); k != m_drop_items.end(); ++k)
-	{
-		if (k->second->getItem() !=0)
-			delete k->second->getItem();
-		delete k->second;
-	}
-	
-	std::list<Trigger*>::iterator l;
-	for (l = m_triggers.begin(); l != m_triggers.end(); ++l)
-	{
-		delete *l;
-	}
-	
-	std::multimap<TriggerType, Event*>::iterator m;
-	for (m= m_events.begin(); m!= m_events.end(); ++m)
-	{
-		delete m->second;
-	}
-	
-	for (std::map<int,FloatingText*>::iterator it = m_floating_texts.begin(); it != m_floating_texts.end(); ++it)
-	{
-		delete it->second;
-	}
-	
-	for (std::list<PlayedSound*>::iterator it = m_played_sounds.begin(); it != m_played_sounds.end(); ++it)
-	{
-		delete *it;
-	}
-}
-
-WorldObject* Region::getObject ( int id)
-{
-	WorldObjectMap::iterator iter;
-
-	// Objekt im Binärbaum suchen
-
-	iter = m_objects.find(id);
-
-	// Testen ob ein Objekt gefunden wurde
-	if (iter == m_objects.end())
-	{
-		// unter den statischen Objekten suchen
-		iter = m_static_objects.find(id);
-
-		// Testen ob ein Objekt gefunden wurde
-		if (iter == m_static_objects.end())
-		{
-			// keins gefunden, NULL ausgeben
-			return 0;
-		}
-		else
-		{
-			// Zeiger auf Objekt ausgeben
-			return iter->second;
-		}
-	}
-	else
-	{
-			// Zeiger auf Objekt ausgeben
-			return iter->second;
-	}
-}
-
-Projectile* Region::getProjectile(int id)
-{
-	ProjectileMap::iterator iter;
-
-	// Objekt im Binärbaum suchen
-	iter = m_projectiles.find(id);
-
-	// Testen ob ein Objekt gefunden wurde
-	if (iter == m_projectiles.end())
-	{
-		// keins gefunden, NULL ausgeben
-		return 0;
-	}
-	else
-	{
-		// Zeiger auf Objekt ausgeben
-		return iter->second;
-	}
-}
-
-GameObject* Region::getGameObject(int id)
-{
-	GameObjectMap::iterator iter;
-
-	iter = m_game_objects.find(id);
-
-	// Testen ob ein Objekt gefunden wurde
-	if (iter == m_game_objects.end())
-	{
-		return 0;
-	}
-	else
-	{
-		return iter->second;
-	}
-}
-
-bool Region::getFreePlace(Shape* shape, short layer, Vector & pos, WorldObject* omit)
-{
-	// Menge der bereits getesteten Felder
-	std::set<int> tfields;
-
-	// Schlange mit zu testenden Feldern
-	std::queue<int> fields;
-
-	float c = 1.1;
-	
-	// Position in 0.5 x 0.5 Feldern
-	int sx = (int) ((pos.m_x/c) + 0.5);
-	int sy = (int) ((pos.m_y/c) + 0.5);
-	
-	float fx = pos.m_x - sx*c;
-	float fy = pos.m_y - sy*c;
-	
-	int i;
-	fields.push(sx*10000+sy);
-
-	// Kopie der Form
-	Shape s;
-	memcpy(&s,shape,sizeof(Shape));
-
-	WorldObjectList res;
-	res.clear();
-
-    // true, solange alle Felder von festen Objekten blockiert sind
-    bool fixblock = true;
-
-	// eine Stelle suchen an der das Objekt passt
-	while (!fields.empty())
-	{
-		// erstes Feld aus der Queue nehmen
-		i = fields.front();
-		sx = i /10000;
-		sy = i %10000;
-		fields.pop();
-
-		DEBUGX("testing field %f %f",sx*c,sy*c);
-
-		// Testen ob dort keine festen Objekte sind
-		s.m_center = Vector(sx*c +fx,sy*c + fy);
-
-		res.clear();
-		getObjectsInShape(&s,&res,layer,WorldObject::FIXED,omit,true);
-
-		if (!res.empty())
-		{
-			// Objekt im Weg
-			res.clear();
-
-			// wenn alle bisherigen Plaetze von festen Objekten blockiert warten trotzdem weitersuchen
-			if (!fixblock)
-                continue;
-		}
-		else
-		{
-		    fixblock = false;
-		}
-
-		DEBUGX("no fixed obstacle");
-		// Testen, ob dort nicht gerade eine Kreatur steht
-		getObjectsInShape(&s,&res,layer,WorldObject::CREATURE,omit,true);
-		if (res.empty() && !fixblock)
-		{
-			DEBUGX("field is free");
-			// Stelle ist frei
-			pos = s.m_center;
-
-			return true;
-
-		}
-		else
-		{
-			DEBUGX("obstacle is %s at %f %f",obs->getNameId().c_str(), obs->getShape()->m_center.m_x,obs->getShape()->m_center.m_y);
-			// Stelle ist besetzt
-			tfields.insert(i);
-
-			// Nachbarfelder in die Liste der zu untersuchenden Felder einfuegen
-			if (sx>0)
-			{
-				i = (sx-1)*10000+sy;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sy>0)
-			{
-				i = (sx)*10000+sy-1;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sx<m_dimx*4-1)
-			{
-				i = (sx+1)*10000+sy;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sy<m_dimy*4-1)
-			{
-				i = (sx)*10000+sy+1;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-		}
-
-	}
-
-	// keine Stelle gefunden
-	return false;
-
-}
-
-bool  Region::addObjectsInShapeFromGridunit(Shape* shape, Gridunit* gu, WorldObjectList* result, short layer, short group,WorldObject* omit, bool empty_test )
-{
-	WorldObject* wo=0;
-	Shape* s=0;
-
-
-	std::vector<WorldObject*>& arr = gu->getObjects((WorldObject::Group) group);
-
-	int n = gu->getObjectsNr((WorldObject::Group) group);
-
-	DEBUGX("%i objects in layer %i, group %i",n,layer,group);
-
-	// Schleife ueber alle Objekte
-	// geprueft wird: Ebene, Schnitt mit der Flaeche
-	for (int k=0;k< n;k++)
-	{
-
-		wo = arr[k];
-		DEBUGX("testing obj %i layer %i",wo->getId(),wo->getLayer());
-
-		s = wo->getShape();
-
-		if ((wo->getLayer() & layer) && (wo->getGroup() & group))
-		{
-			DEBUGX("adding obj %i layer %i",wo->getId(), wo->getLayer());
-			if ((shape ==0) || shape->intersects(*s))
-			{
-
-				if (wo != omit)
-				{
-
-					result->push_back(wo);
-
-					if (empty_test)
-						return true;
-				}
-			}
-		}
-	}
-
-	return true;
-}
-
-bool Region::addObjectsOnLineFromGridunit(Line& line, Gridunit* gu, WorldObjectList* result, short layer, short group ,WorldObject* omit, bool empty_test )
-{
-	WorldObject* wo=0;
-	Shape* s=0;
-
-	std::vector<WorldObject*>& arr = gu->getObjects((WorldObject::Group) group);
-
-	int n = gu->getObjectsNr((WorldObject::Group) group);
-
-	DEBUGX("%i objects in layer %i, group %i",n,layer,group);
-	// Schleife ueber alle Objekte
-	// geprueft wird: Ebene, Schnitt mit der Linie
-	for (int k=0;k< n;k++)
-	{
-
-		wo = arr[k];
-		DEBUGX("testing %s %p",wo->getNameId().c_str(),wo->getNameId().c_str())
-		DEBUGX("testing %p",wo);
-		s = wo->getShape();
-
-		if ((wo->getLayer() & layer) && (wo->getGroup() & group))
-		{
-			if (s->intersects(line))
-			{
-				if (wo != omit)
-				{
-					result->push_back(wo);
-
-					if (empty_test)
-						return true;
-				}
-			}
-		}
-	}
-
-	return true;
-}
-
-
-bool Region::getObjectsInShape( Shape* shape,  WorldObjectList* result,short layer, short group, WorldObject* omit, bool empty_test)
-{
-
-	DEBUGX("shape %f %f %f",shape->m_center.m_x,shape->m_center.m_y,shape->m_radius);
-
-	 // Wenn der Resultat Zeiger 0 ist: Fehler ausgeben
-	if (result == 0)
-	{
-		ERRORMSG("no result list given");
-		return false;
-	}
-
-	if (shape == 0)
-	{
-		ERRORMSG("no shape given");
-		return false;
-	}
-
-
-	DEBUGX("layer %i group %i",layer,group);
-
-
-	if (group == WorldObject::PLAYER)
-	{
-		// Wenn nur nach Spielern gesucht ist, dann nur die Liste der Spieler durchsuchen
-
-		WorldObjectMap::iterator it;
-		for (it = m_players.begin(); it != m_players.end(); ++it)
-		{
- 			if (shape->intersects(*(it->second->getShape()) ) && it->second != omit)
-			{
-				result->push_back(it->second);
-			}
-		}
-	}
-	else
-	{
-		int i,j;
-		Gridunit* gu=0;
-		// durchmustere alle 4*4 Felder die von dem Suchrechteck plus 4 Felder bedeckt werden
-
-		// Maximale Ausdehnung der Flaeche in Richtung der Koordinatenaxen
-		Vector ext = shape->getAxisExtent();
-		Vector d1 = shape->m_center +ext;
-		Vector d2 = shape->m_center -ext;
-
-
-		int xmin = (int) floor(0.25*(d2.m_x-4));
-		int ymin = (int) floor(0.25*(d2.m_y-4));
-		int xmax = (int) floor(0.25*(d1.m_x+4));
-		int ymax = (int) floor(0.25*(d1.m_y+4));
-		// Pruefen ob die Suchanfrage nicht aus der Region herauslaeuft
-
-		int is = MathHelper::Max (xmin,0);
-		int ie = MathHelper::Min(xmax,m_dimx-1);
-		int js = MathHelper::Max(ymin,0);
-		int je = MathHelper::Min(ymax,m_dimy-1);
-
-		DEBUGX("searching square (%i %i) (%i %i)",is,ie,js,je);
-
-		// Alle 4x4 Felder durchmustern
-		for (i = is;i<=ie;i++)
-		{
-			for (j=js;j<=je;j++)
-			{
-
-				DEBUGX("searching in Grid Tile %i %i",i,j);
-				// Durchmustern der Listen im 4x4-Feld
-				gu = &(m_data_grid)[i][j];
-
-				// Totenebene
-				if (group & WorldObject::DEAD)
-				{
-					DEBUGX("searching dead layer");
-
-					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::DEAD, omit, empty_test);
-					if (!result->empty() && empty_test)
-						return true;
-
-				}
-
-				// feste Objekte
-				if (group & WorldObject::FIXED )
-				{
-					DEBUGX("searching fixed layer");
-
-					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::FIXED, omit, empty_test);
-					if (!result->empty() && empty_test)
-						return true;
-
-				}
-
-				// lebende Objekte
-				if (group & WorldObject::CREATURE)
-				{
-
-					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::CREATURE, omit, empty_test);
-					if (!result->empty() && empty_test)
-						return true;
-
-				}
-
-			}
-
-		}
-		
-		// grosse Objekte durchmustern
-		WorldObjectMap::iterator it;
-		for (it = m_large_objects.begin(); it != m_large_objects.end(); ++it)
-		{
-			if (( it->second->getGroup() & group) && (it->second->getLayer() & layer))
-			{
-				if (shape->intersects(*(it->second->getShape())) && it->second != omit )
-				{
-					result->push_back(it->second);
-					if (empty_test)
-						return true;
-				}
-			}
-		}
-		
-	}
-	return true;
-}
-
-
-WorldObject* Region::getObjectAt(Vector pos, short layer, short group)
-{
-	Shape s;
-	s.m_type = Shape::CIRCLE;
-	s.m_radius =0;
-	s.m_center = pos;
-
-	WorldObjectList l;
-	l.clear();
-	getObjectsInShape ( &s, &l,layer,group );
-	if (l.empty())
-	{
-		return 0;
-	}
-	else
-	{
-		return *(l.begin());
-	}
-}
-
-
-
-void Region::getObjectsOnLine(Line& line,  WorldObjectList* result,short layer, short group , WorldObject* omit)
-{
-	Gridunit* gu=0;
-
-	int xmin = (short) floor(0.25*(MathHelper::Min(line.m_start.m_x,line.m_end.m_x)-4));
-	int ymin = (short) floor(0.25*(MathHelper::Min(line.m_start.m_y,line.m_end.m_y)-4));
-	int xmax = (short) floor(0.25*(MathHelper::Max(line.m_start.m_x,line.m_end.m_x)+4));
-	int ymax = (short) floor(0.25*(MathHelper::Max(line.m_start.m_y,line.m_end.m_y)+4));
-	int i,j;
-	float d;
-
-	// Richtung der Linie
-	Vector dir = line.getDirection();
-	dir.normalize();
-	Vector p;
-
-	for (i = MathHelper::Max (xmin,0);i<=MathHelper::Min(xmax,m_dimx-1);i++)
-	{
-		for (j=MathHelper::Max(ymin,0);j<=MathHelper::Min(ymax,m_dimy-1);j++)
-		{
-			DEBUGX("searching in Grid Tile %i %i",i,j);
-
-			// Herausfiltern jener Felder die zu weit von der Linie entfernt sind
-			p.m_x = i*4.0+2;
-			p.m_y = j*4.0+2;
-			p -= line.m_start;
-
-			p.normalPartTo(dir);
-
-			d = p.getLength();
-			if (d>32)
-			{
-				DEBUGX("aborted");
-				continue;
-			}
-
-			// Durchmustern der Listen im 4x4-Feld
-			gu = &(m_data_grid)[i][j];
-
-			// Totenebene
-			if (group & WorldObject::DEAD)
-			{
-				DEBUGX("searching dead layer");
-
-				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::DEAD, omit);
-			}
-
-				// feste Objekte
-			if (group & WorldObject::FIXED )
-			{
-				DEBUGX("searching fixed layer");
-
-
-				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::FIXED, omit);
-			}
-
-				// lebende Objekte
-			if (group & WorldObject::CREATURE)
-			{
-
-
-				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::CREATURE, omit);
-			}
-
-
-		}
-
-	}
-	
-	WorldObjectMap::iterator it;
-	for (it = m_large_objects.begin(); it != m_large_objects.end(); ++it)
-	{
-		if (( it->second->getGroup() & group) && (it->second->getLayer() & layer))
-		{
-			if ((it->second->getShape()->intersects(line)) && it->second != omit )
-			{
-				result->push_back(it->second);
-			}
-		}
-	}
-}
-
-
-bool Region::insertObject(WorldObject* object, Vector pos, float angle )
-{
-	DEBUGX("try to insert %s at %f %f",object->getSubtype().c_str(), pos.m_x,pos.m_y);
-	bool result = true;
-	
-	bool collision_test = object->checkInteractionFlag(WorldObject::COLLISION_DETECTION);
-	
-	object->setRegionId(m_id);
-
-	 // Einfügen in den Binärbaum
-	if (object->getState() != WorldObject::STATE_STATIC)
-	{
-		result &= (m_objects.insert(std::make_pair(object->getId(),object))).second;
-		result &= (m_game_objects.insert(std::make_pair(object->getId(),object))).second;
-	}
-	else
-	{
-		result &= (m_static_objects.insert(std::make_pair(object->getId(),object))).second;
-	}
-
-
-	 // Wenn das Element bereits existiert ist die Antwort false
-	if (result==false)
-	{
-		DEBUG("Object with id %i already exists",object->getId());
-		return result;
-	}
-
-	if (object->getType() == "PLAYER")
-	{
-		Player* pl = dynamic_cast<Player*>(object);
-		DEBUGX("player entered Region");
-		result &= (m_players.insert(std::make_pair(object->getId(),object))).second;
-		
-		if (m_revive_location != "")
-		{
-			pl->setRevivePosition(std::make_pair(getIdString(),m_revive_location));
-		}
-		
-		Trigger* tr = new Trigger("enter_region");
-		tr->addVariable("player", object->getId());
-		insertTrigger(tr);
-
-		// pruefen ob Party komplett in der Region
-		Party* party = pl->getParty();
-		std::set< int > & members = party->getMembers();
-		std::set< int >::iterator it;
-		bool complete = true;
-		for (it = members.begin(); it != members.end(); ++it)
-		{
-			if (getObject(*it) == 0)
-			{
-				complete = false;
-			}
-		}
-		
-		if (complete)
-		{
-			tr = new Trigger("party_complete");
-			insertTrigger(tr);
-		}
-	}
-	else
-	{
-		// fuer Nicht Spieler NetEvent erzeugen, dass das Objekt erschaffen wurde
-		
-		NetEvent event;
-		event.m_type = NetEvent::OBJECT_CREATED;
-		event.m_id = object->getId();
-		insertNetEvent(event);
-		DEBUGX("insert object %i",event.m_id);
-		
-		if (object->getGroup() & WorldObject::CREATURE)
-		{
-			Trigger* tr = new Trigger("create_unit");
-			tr->addVariable("unit", object->getId());
-			insertTrigger(tr);
-		}
-	}
-
-	object->getShape()->m_angle = angle;
-	
-	// Test auf Kollisionen und eventuelle Verschiebung
-	if (collision_test)
-	{
-		getFreePlace(object->getShape(), object->getLayer(), pos);
-	}
-
-	 // Koordinaten setzen
-	object->getShape()->m_center = pos;
-
-	 // Einfuegen in das Grid
-	int x_g = (int) floor(0.25*pos.m_x);
-	int y_g = (int) floor(0.25*pos.m_y);
-	object->getGridLocation()->m_grid_x = x_g;
-	object->getGridLocation()->m_grid_y = y_g;
-
-
-	 // Testen ob das Objekt in der Region liegt
-	if (x_g<0 || y_g<0 || x_g>=m_dimx || y_g>=m_dimy)
-	{
-		DEBUGX("create Object at %f %f",pos.m_x, pos.m_y);
-		return false;
-	}
-	else
-	{
-		if (object->getLayer() & WorldObject::LAYER_COLLISION)
-		{
-			// testen ob das Objekt zu den gesondert behandelten grossen Objekten gehoehrt
-			if (object->isLarge())
-			{
-				DEBUGX("object %s is large",object->getName().c_str());
-				m_large_objects.insert(std::make_pair(object->getId(),object));
-				result = true;
-			}
-			else
-			{
-				Gridunit *gu = (m_data_grid.ind(x_g,y_g));
-
-				result = gu->insertObject(object);
-			}
-		}
-
-	}
-
-	DEBUGX("object inserted %s %i at %f %f",object->getSubtype().c_str(), object->getId(), object->getShape()->m_center.m_x,object->getShape()->m_center.m_y);
-	return result;
-}
-
-int Region::createObject(ObjectTemplateType generictype, Vector pos, float angle, float height, WorldObject::State state)
-{
-	// Umgebung erfahren
-	EnvironmentName env = getEnvironment(pos);
-
-	// genauen Subtyp ermitteln
-	WorldObject::Subtype subtype = ObjectFactory::getObjectType(generictype, env);
-	
-	if (subtype == "notype")
-	{
-		// Objekt fuer die Umgebung explizit als nichtexistent gesetzt
-		return 0;
-	}
-	
-	if (subtype == "")
-	{
-		DEBUG("no subtype found for generictype %s",generictype.c_str());
-		return 0;
-	}
-	
-	// Basistyp ermitteln
-	WorldObject::Type type = ObjectFactory::getObjectBaseType(subtype);
-	if (type == "NONE")
-	{
-		DEBUG("no base type for subtype %s",subtype.c_str());
-		return 0;
-	}
-
-	// Objekt erstellen
-	WorldObject* object = ObjectFactory::createObject(type,subtype);
-
-	if (object ==0)
-	{
-		DEBUG("could not create object for generictype %s",generictype.c_str());
-		return 0;
-	}
-
-	if (state != WorldObject::STATE_NONE)
-	{
-		object->setState(state,false);
-	}
-	
-	if (state == WorldObject::STATE_AUTO)
-	{
-		if (object->getType() == "FIXED_OBJECT")
-		{
-			object->setState(WorldObject::STATE_INACTIVE,false);
-		}
-		else
-		{
-			object->setState(WorldObject::STATE_ACTIVE,false);
-		}
-	}
-	
-			
-	// Objekt einfuegen
-	object->setHeight(height);
-	bool ret = insertObject(object,pos,angle);
-	if (!ret)
-	{
-		DEBUG("insertion of object %s failed",object->getNameId().c_str());
-	}
-
-	return object->getId();
-
-}
-
-
-void Region::createObjectGroup(ObjectGroupName templname, Vector position, float angle, std::string name,WorldObject::State state)
-{
-	Trigger* tr=0;
-	
-	// Template aus der Datenbank heraussuchen
-	std::map<ObjectGroupName, ObjectGroup*>::iterator it;
-
-	
-	// Umgebung erfahren
-	EnvironmentName env = getEnvironment(position);
-	ObjectGroupName templnameneu = ObjectFactory::getObjectGroupType(templname,env);
-	
-	if (templnameneu == "notype")
-	{
-		// Objektgruppe fuer die Umgebung explizit als nichtexistent gesetzt
-		return;
-	}
-	
-	ObjectGroup* templ = ObjectFactory::getObjectGroup(templnameneu);
-	
-	if (templ != 0)
-	{
-		if (name != "" || !templ->getLocations()->empty())
-		{
-			tr = new Trigger("create_template");
-			tr->addVariable("templname",templname);
-			tr->addVariable("name",name);
-			tr->addVariable("position",position);
-			tr->addVariable("angle",angle);
-			
-			// Mittelpunkt eintragen
-			std::string locname = name;
-			locname += ":center";
-			addLocation(locname,position);
-			
-			// Flaeche eintragen
-			std::string areaname = name;
-			areaname += ":area";
-			addArea(areaname,*(templ->getShape()));
-		}
-		
-		// Template wurde gefunden
-		// Objekte platzieren
-		std::list<ObjectGroup::GroupObject>::iterator gt;
-		Vector pos;
-
-		float oangle=0;
-		for (gt = templ->getObjects()->begin(); gt != templ->getObjects()->end(); ++gt)
-		{
-			if (Random::random() < gt->m_probability)
-			{
-
-				pos = gt->m_center;
-				pos.rotate(angle);
-				pos += position;
-
-				oangle = gt->m_angle;
-				if (gt->m_prob_angle)
-				{
-					oangle = 2*3.14159*Random::random();
-				}
-
-				int id;
-				// Objekte mit Name sollte man loeschen / modifizieren koennen
-				// das wird erreicht, in dem der Status auf Inaktiv statt static gestellt wird
-				WorldObject::State ostate = state;
-				if (gt->m_name != "")
-				{
-					ostate = WorldObject::STATE_AUTO;
-				}
-				
-				id = createObject(gt->m_type, pos, angle+oangle,gt->m_height,ostate);
-				DEBUGX("inserting object %s at %f %f with id %i",gt->m_type.c_str(),pos.m_x, pos.m_y,id);
-				
-				if (gt->m_name != "")
-				{
-					setNamedId(gt->m_name,id);
-					if (tr != 0)
-					{
-						tr->addVariable(gt->m_name,id);
-					}
-				}
-			}
-		}
-
-		// Orte einfuegen
-		std::map<LocationName, Vector>::iterator lt;
-		for (lt = templ->getLocations()->begin(); lt != templ->getLocations()->end(); ++lt)
-		{
-			pos = lt->second;
-			pos.rotate(angle);
-			pos += position;
-
-			std::string locname;
-			if (name != "")
-			{
-				locname += name;
-				locname += ":";
-			}
-			locname += lt->first;
-			addLocation(locname,pos);
-			if (tr != 0)
-			{
-				tr->addVariable(lt->first,pos);
-			}
-			DEBUGX("template location %s",locname.c_str());
-		}
-		
-		std::map<AreaName, Shape>::iterator at;
-		Shape sh;
-		for (at = templ->getAreas().begin(); at != templ->getAreas().end(); ++at)
-		{
-			sh = at->second;
-			sh.m_angle += angle;
-			sh.m_center.rotate(angle);
-			sh.m_center += position;
-			
-			std::string aname;
-			if (name != "")
-			{
-				aname += name;
-				aname += ":";
-			}
-			aname += at->first;
-			
-			addArea(aname,sh);
-		}
-		
-		// Trigger der besagt dass das Template eingefuegt wurde
-		if (tr !=0)
-		{
-			insertTrigger(tr);
-		}
-	}
-	else
-	{
-		ERRORMSG("object group template %s not found",templname.c_str());
-	}
-}
-
-
-void Region::createMonsterGroup(MonsterGroupName mgname, Vector position, float radius, std::list<int>* monsters)
-{
-	MonsterGroup * mgroup = ObjectFactory::getMonsterGroup(mgname);
-
-	if (mgroup == 0)
-	{
-		DEBUG("monster group %s not found",mgname.c_str());
-		return;
-	}
-
-	std::list<MonsterGroup::SubGroup>::iterator mt;
-	Vector pos;
-	float dx,dy;
-	
-	for (mt = mgroup->m_monsters.begin(); mt != mgroup->m_monsters.end(); ++mt)
-	{
-		int count =0;
-		for (int i=0; i< mt->m_number; i++)
-		{
-			pos = position;
-			do
-			{
-				dx = -radius + Random::randf(radius*2);
-				dy = -radius + Random::randf(radius*2);	
-			}
-			while (dx*dx+dy*dy > radius*radius);
-			
-			pos.m_x += dx;
-			pos.m_y += dy;	
-
-			if (Random::random() < mt->m_prob)
-			{
-				count ++;
-				int id = createObject(mt->m_subtype, pos,2*3.14159*Random::random());
-				DEBUGX("inserting monster %s at %f %f with id %i",mt->m_subtype.c_str(),pos.m_x, pos.m_y,id);
-				
-				if (monsters != 0)
-				{
-					monsters->push_back(id);
-				}
-			}
-		}
-		DEBUGX("monstergroup %s : %i x %s prob %f",mgname.c_str(), count, mt->m_subtype.c_str(), mt->m_prob);
-		
-	}
-}
-
-
-bool  Region::insertProjectile(Projectile* object, Vector pos)
-{
-	DEBUGX("projectile inserted: %s %i",object->getSubtype().c_str(), object->getId());
-	m_projectiles.insert(std::make_pair(object->getId(),object));
-	m_game_objects.insert(std::make_pair(object->getId(),object));
-	object->getShape()->m_center = pos;
-	object->setRegionId( m_id);
-
-	// NetEvent erzeugen: neues Projektil in der Region
-	NetEvent event;
-	event.m_type = NetEvent::PROJECTILE_CREATED;
-	event.m_id = object->getId();
-	insertNetEvent(event);
-
-	return true;
-}
-
-bool  Region::deleteObject (WorldObject* object)
-{
-	bool result = true;
-
-	if (object == 0)
-		return false;
-	
-	if (m_objects.count(object->getId()) == 0 && m_static_objects.count(object->getId()) == 0)
-	{
-		// Objekt nicht gefunden
-		return false;
-	}
-	
-	if (object->getType() != "PLAYER")
-	{
-		
-		NetEvent event;
-		event.m_type = NetEvent::OBJECT_DESTROYED;
-		event.m_id = object->getId();
-		insertNetEvent(event);
-		
-	}
-	
-	if (object->isCreature())
-	{
-		Creature* cr = dynamic_cast<Creature*>(object);
-		if (cr != 0 && cr->getDialogue() != 0)
-		{
-			cr->getDialogue()->removeSpeaker(object->getId());
-		}
-	}
-	
-	 // Aus dem Binärbaum loeschen
-	if (object->getState() != WorldObject::STATE_STATIC)
-	{
-		m_objects.erase(object->getId());
-		m_game_objects.erase(object->getId());
-	}
-	else
-	{
-		m_static_objects.erase(object->getId());
-	}
-
-	if (object->getType() == "PLAYER")
-	{
-		DEBUGX("Player deleted");
-		m_players.erase(object->getId());
-
-		
-		Trigger* tr = new Trigger("leave_region");
-		tr->addVariable("player", object->getId());
-		insertTrigger(tr);
-	}
-	
-	if (object->isLarge())
-	{
-		if (m_large_objects.count(object->getId()) == 0)
-		{
-			result = false;
-		}
-		else
-		{
-			m_large_objects.erase(object->getId());
-		}
-	}
-	else
-	{
-		// aus dem Grid loeschen
-		int x = object->getGridLocation()->m_grid_x;
-		int y = object->getGridLocation()->m_grid_y;
-		DEBUGX("deleting object in grid tile %i %i",x,y);
-	
-		if (object->getLayer() & WorldObject::LAYER_COLLISION)
-		{
-			Gridunit *gu = (m_data_grid.ind(x,y));
-			result = gu->deleteObject(object, object->getGridLocation()->m_index);
-		}
-	}
-
-	return result;
-}
-
-bool Region::deleteObject(int id)
-{
-	WorldObject* wo = getObject(id);
-	if (wo !=0)
-	{
-		return deleteObject(wo);
-	}
-	else
-	{
-		DEBUG("no object with id %i",id);
-	}
-	return false;
-}
-
-bool Region::moveObject(WorldObject* object, Vector pos)
-{
-	bool result = true;
-	// Wenn NULL Zeiger übergeben -> Fehler anzeigen
-	if (object == 0)
-		return false;
-	
-	if (object->getState() == WorldObject::STATE_STATIC)
-	{
-		ERRORMSG("Cant move static object %s",object->getNameId().c_str());
-		return false;
-	}
-	
-	// grosse Objekte werden einfach verschoben (da sie nicht in der Gridunit sind)
-	if (object->isLarge())
-	{
-		object->getShape()->m_center = pos;
-		return true;
-	}
-	
-	if (object->getLayer() == WorldObject::LAYER_NOCOLLISION)
-	{
-		object->getShape()->m_center = pos;
-		return true;
-	}
-
-	// Testen ob das Objekt innerhalb des 4*4 Grid in ein neues Feld kommt
-	int x_old = object->getGridLocation()->m_grid_x;
-	int y_old = object->getGridLocation()->m_grid_y;
-	int x_new = (int) floor(0.25*pos.m_x);
-	int y_new = (int) floor(0.25*pos.m_y);
-
-	if (x_old == x_new && y_old == y_new)
-	{
-		object->getShape()->m_center = pos;
-		return true;
-	}
-	// Testen ob das Objekt in der Region liegt
-	if (x_new<0 || y_new<0 || x_new>=m_dimx || y_new>=m_dimy)
-	{
-		return false;
-	}
-	else
-	{
-		Gridunit *gu = &(m_data_grid)[x_old][y_old];
-		result =gu->deleteObject(object, object->getGridLocation()->m_index);
-		if (result == false)
-		{
-			ERRORMSG("failed to remove object %i from gridunit %i %i",object->getId(),x_old, y_old);
-		}
-
-		gu = &(m_data_grid)[x_new][y_new];
-		result = gu->insertObject(object);
-		if (result == false)
-		{
-			ERRORMSG("failed to insert object %i into gridunit %i %i",object->getId(),x_old, y_old);
-		}
-
-
-		object->getGridLocation()->m_grid_x=x_new;
-		object->getGridLocation()->m_grid_y=y_new;
-
-		object->getShape()->m_center = pos;
-	}
-
-	return result;
-}
-
-
-bool Region::changeObjectGroup(WorldObject* object,WorldObject::Group group )
-{
-	bool result = true;
-
-	if (!object->isLarge())
-	{
-		int x = object->getGridLocation()->m_grid_x;
-		int y = object->getGridLocation()->m_grid_y;
-		DEBUGX("changing object in grid tile %i %i",x,y);
-	
-		Gridunit *gu = (m_data_grid.ind(x,y));
-		result = gu->moveObject(object,group);
-	}
-
-	return result;
-
-}
-
-bool Region::changeObjectLayer(WorldObject* object,WorldObject::Layer layer)
-{
-	short oldlayer = object->getLayer();
-	if (oldlayer == layer)
-		return true;
-	
-	bool result = true;
-	
-	if (oldlayer == WorldObject::LAYER_NOCOLLISION)
-	{
-		// Einfuegen in das Grid
-		Vector pos = object->getShape()->m_center;
-
-	 	// Einfuegen in das Grid
-		int x_g = (int) floor(0.25*pos.m_x);
-		int y_g = (int) floor(0.25*pos.m_y);
-		object->getGridLocation()->m_grid_x = x_g;
-		object->getGridLocation()->m_grid_y = y_g;
-
-
-	 	// Testen ob das Objekt in der Region liegt
-		if (x_g<0 || y_g<0 || x_g>=m_dimx || y_g>=m_dimy)
-		{
-			DEBUGX("create Object at %f %f",pos.m_x, pos.m_y);
-			return false;
-		}
-		else
-		{
-			if (object->isLarge())
-			{
-				DEBUGX("object %s is large",object->getName().c_str());
-				m_large_objects.insert(std::make_pair(object->getId(),object));
-				result = true;
-			}
-			else
-			{
-				Gridunit *gu = (m_data_grid.ind(x_g,y_g));
-
-				result = gu->insertObject(object);
-				DEBUGX("insert into grid %i %i",x_g,y_g);
-			}
-		}
-	}
-	
-	if (layer == WorldObject::LAYER_NOCOLLISION)
-	{
-		if (object->isLarge())
-		{
-			if (m_large_objects.count(object->getId()) == 0)
-			{
-				result = false;
-			}
-			else
-			{
-				m_large_objects.erase(object->getId());
-			}
-		}
-		else
-		{
-			// aus dem Grid loeschen
-			int x = object->getGridLocation()->m_grid_x;
-			int y = object->getGridLocation()->m_grid_y;
-			DEBUGX("deleting object in grid tile %i %i",x,y);
-			
-			Gridunit *gu = (m_data_grid.ind(x,y));
-			result = gu->deleteObject(object, object->getGridLocation()->m_index);
-			
-		}
-	}
-	
-	return result;
-}
-
-
-void Region::deleteProjectile(Projectile* proj)
-{
-	if (proj ==0)
-		return;
-	
-	int id = proj->getId();
-
-	if (m_projectiles.count(id)!=0)
-	{
-		m_projectiles.erase(m_projectiles.find(id));
-		DEBUGX("projectile deleted: %s %i",proj->getSubtype().c_str(), proj->getId());
-	}
-	m_game_objects.erase(id);
-}
-
-void Region::update(float time)
-{
-	DEBUGX("update region %i",getId());
-
-	DEBUGX("\nUpdate aller WeltObjekte starten\n");
-	//DEBUG("m_players %p",m_players);
-	// Iterator zum durchmustern einer solchen Liste
-	WorldObjectMap::iterator iter;
-	WorldObject* object;
-	ProjectileMap::iterator it3;
-
-	// clear the list of sounds from the previous update
-	for (std::list<PlayedSound*>::iterator it = m_played_sounds.begin(); it != m_played_sounds.end(); ++it)
-	{
-		delete *it;
-	}
-	m_played_sounds.clear();
-	
-	
-	// Durchmustern aller WorldObjects
-	for (iter =m_objects.begin(); iter!=m_objects.end(); )
-	{
-		object = iter->second;
-
-		if (object->getDestroyed()==true)
-		{
-			// Objekte selbststaendig loeschen darf nur der Server
-			if (World::getWorld()->isServer())
-			{
-				// nur Nichtspieler Objekte loeschen
-				if (object->getType() != "PLAYER")
-				{
-					DEBUGX("Objekt gelöscht: %i \n",object->getId());
-					
-					++iter;
-					object->destroy();
-					bool succ = deleteObject(object);
-					if (succ)
-					{
-						delete object;
-						continue;
-					}
-				}
-				else
-					++iter;
-			}
-			else
-			{
-				++iter;
-			}
-		}
-		else
-		{
-			++iter;
-		}
-
-	}
-	
-	for (iter =m_objects.begin(); iter!=m_objects.end(); ++iter)
-	{
-		object = iter->second;
-		if (object->getDestroyed()!=true)
-		{
-			// Polymorpher Funktionsaufruf
-			object->update(time);
-		}
-	}
-	DEBUGX("Update aller WeltObjekte abgeschlossen\n\n");
-
-	// alle Projektile updaten
-	Projectile* pr =0;
-
-	for (it3 = m_projectiles.begin(); it3 !=m_projectiles.end();)
-	{
-		pr = (it3->second);
-		DEBUGX("projectile %i",pr->getId());
-		if (pr->getDestroyed()==true)
-		{
-			// Projektile selbststaendig loeschen darf nur der Server
-			if (World::getWorld()->isServer())
-			{
-				
-				NetEvent event;
-				event.m_type = NetEvent::PROJECTILE_DESTROYED;
-				event.m_id = pr->getId();
-				insertNetEvent(event);
-				
-				DEBUGX("deleting projectile %i",pr->getId());
-				
-				++it3;
-				deleteProjectile(pr);
-				delete pr;
-				DEBUGX("loesche projektil");
-			}
-			else
-			{
-			 	++it3;
-			}
-
-		}
-		else
-		{
-			pr->update(time);
-			++it3;
-		}
-	}
-	DEBUGX("update projektile abgeschlossen");
-
-	// DropItems updaten
-	DropItemMap::iterator it4;
-	for (it4 = m_drop_items.begin(); it4 != m_drop_items.end(); ++it4)
-	{
-		it4->second->update(time);
-	}
-
-	if (World::getWorld()->isServer())
-	{
-		// NetEvents fuer geaenderte Objekte / Projektile erzeugen
-		for (iter =m_objects.begin(); iter!=m_objects.end(); ++iter)
-		{
-			object = iter->second;
-
-			// NetEvents durch Spieler werden global behandelt, daher hier nicht beruecksichtigen
-			if (object->getType() == "PLAYER")
-			{
-				continue;
-			}
-
-			if (object->getNetEventMask() !=0)
-			{
-				DEBUGX("object %i has event mask %i",object->getId(), object->getNetEventMask());
-				NetEvent event;
-				event.m_type = NetEvent::OBJECT_STAT_CHANGED;
-				event.m_data = object->getNetEventMask();
-				event.m_id = object->getId();
-				insertNetEvent(event);
-				
-				object->clearNetEventMask();
-			}
-		}
-
-		for (it3 = m_projectiles.begin(); it3 !=m_projectiles.end();++it3)
-		{
-			pr = (it3->second);
-			if (pr->getNetEventMask() !=0)
-			{
-				NetEvent event;
-				event.m_type = NetEvent::PROJECTILE_STAT_CHANGED;
-				event.m_data = pr->getNetEventMask();
-				event.m_id = pr->getId();
-				insertNetEvent(event);
-				
-				pr->clearNetEventMask();
-			}
-		}
-	}
-
-	// pruefen ob ein Spieler die Region verlassen hat
-	bool del = false;
-	for (iter = m_players.begin(); iter != m_players.end(); )
-	{
-		// Schleife ueber die Ausgaenge
-		std::list<RegionExit>::iterator eit;
-		for (eit = m_exits.begin(); eit != m_exits.end(); ++eit)
-		{
-			if (iter->second->getShape()->intersects(eit->m_shape))
-			{
-				// Spieler befindet sich im Ausgang
-				// ID der neuen Region
-				int id = World::getWorld()->getRegionId(eit->m_destination_region);
-
-				WorldObjectMap::iterator iter2 = iter;
-				++iter;
-				del = true;
-
-				// Spieler aus der Region entfernen
-				WorldObject* pl = iter2->second;
-				deleteObject(pl);
-
-				// Spieler in die neue Region einfuegen
-				World::getWorld()->insertPlayerIntoRegion(pl, id, eit->m_destination_location);
-
-				break;
-			}
-		}
-
-
-		if (del == false)
-		{
-
-			// Pruefen ob der Spieler getoetet wurde
-			if (iter->second->getState() == WorldObject::STATE_DEAD)
-			{
-				// Lebenspunkte wieder fuellen etc
-				Player* pl = static_cast<Player*>(iter->second);
-				pl->revive();
-
-				// Zielpunkt ermitteln
-				RegionLocation regloc = pl->getRevivePosition();
-				int id = World::getWorld()->getRegionId(regloc.first);
-
-				if (id == getId())
-				{
-					DEBUGX("revive in current region");
-					// Spieler bleibt in der aktuellen Region
-					Vector pos = getLocation(regloc.second);
-					getFreePlace(pl->getShape(), pl->getLayer(), pos, pl);
-
-					pl->moveTo(pos);
-				}
-				else
-				{
-					DEBUGX("revive in other region %i ", id);
-
-					// Spieler verlaesst die Region
-					WorldObjectMap::iterator iter2 = iter;
-					++iter;
-					del = true;
-
-					// Spieler aus der Region entfernen
-					deleteObject(pl);
-
-					// Spieler in die neue Region einfuegen
-					World::getWorld()->insertPlayerIntoRegion(pl, id, regloc.second);
-				}
-			}
-
-			if (del == false)
-				++iter;
-		}
-		del = false;
-	}
-	
-	// Spieler die die Region per Wegpunkt verlassen bearbeiten
-	std::map<int,RegionLocation>::iterator wt;
-	for (wt = m_teleport_players.begin(); wt != m_teleport_players.end(); ++wt)
-	{
-		Player* pl = static_cast<Player*>(getObject (wt->first));
-		
-		// Spieler aus der Region entfernen
-		deleteObject(pl);
-
-		// Spieler in die neue Region einfuegen
-		int id = World::getWorld()->getRegionId(wt->second.first);
-		World::getWorld()->insertPlayerIntoRegion(pl, id, wt->second.second);
-	}
-	m_teleport_players.clear();
-	
-	// Trigger & Events abarbeiten
-	// Zeitverzoegerte Trigger
-	std::list<std::pair<float, Trigger*> > ::iterator tit, tjt;
-	for (tit = tjt = m_timed_trigger.begin(); tjt != m_timed_trigger.end(); )
-	{
-		tit = tjt;
-		++tjt;
-		
-		tit->first -= time;
-		if (tit->first<=0)
-		{
-			insertTrigger(tit->second);
-			m_timed_trigger.erase(tit);
-		}
-	}
-	
-	// Schleife ueber die Trigger
-	std::multimap<TriggerType, Event*>::iterator it, itend, jt;
-	
-	while (!m_triggers.empty())
-	{
-		EventSystem::setRegion(this);
-		TriggerType type;
-		type = m_triggers.front()->getType();
-		
-		DEBUGX("trigger: %s",type.c_str());
-		
-		// Schleife ueber die ausgeloesten Events
-		it = m_events.lower_bound(type);
-		itend = m_events.upper_bound(type);
-		while (it != itend)
-		{
-			jt = it;
-			++it;
-			
-			// vom Trigger definierte Variablen einfuegen
-			EventSystem::doString((char*) m_triggers.front()->getLuaVariables().c_str());
-			DEBUGX("lua code \n %s",m_triggers.front()->getLuaVariables().c_str());
-			
-			// ggf Dialog setzen
-			if (m_triggers.front()->getDialogueId() != 0)
-			{
-				EventSystem::setDialogue( getDialogue( m_triggers.front()->getDialogueId() ) );
-			}
-				
-			// Event ausfuehren
-			bool ret = EventSystem::executeEvent(jt->second);
-			
-			if (ret)
-			{
-				DEBUGX("event on trigger: %s",type.c_str());
-			}
-			
-			// einmalige Ereignisse loeschen, wenn erfolgreich ausgefuehrt
-			if (jt->second->getOnce() &&  ret)
-			{
-				delete jt->second;
-				m_events.erase(jt);
-			}
-			
-		}
-		
-		// Objektbezogene Events ausloesen
-		int id = m_triggers.front()->getObjectId();
-		if (id != 0)
-		{
-			ScriptObject* so = dynamic_cast<ScriptObject*>(getObject(id));
-			if (so != 0)
-			{
-				so->activateTrigger(m_triggers.front());
-			}
-		}
-		
-		delete m_triggers.front();
-		m_triggers.pop_front();
-	}
-	
-	// update der Dialoge
-	if (World::getWorld()->isServer())
-	{
-		std::map<int, Dialogue*>::iterator it5;
-		Dialogue* dia;
-		for (it5 = m_dialogues.begin(); it5!= m_dialogues.end(); )
-		{
-			EventSystem::setDialogue(it5->second);
-			
-			it5->second->update(time);
-			
-			if (it5->second->isFinished())
-			{
-				dia = it5->second;
-				++it5;
-				deleteDialogue(dia);
-			}
-			else 
-			{
-				if (it5->second->getEventMaskRef() != 0)
-				{
-					DEBUGX("update dialogue %i",it5->second->getId());
-					NetEvent event;
-					event.m_type = NetEvent::DIALOGUE_STAT_CHANGED;
-					event.m_data = it5->second->getEventMaskRef();
-					event.m_id = it5->second->getId();
-					insertNetEvent(event);
-					it5->second->clearNetEventMask();
-				}
-				++it5;
-			}
-		}
-		EventSystem::setDialogue(0);
-	}
-	
-	m_camera.update(time);
-	m_light.update(time);
-	
-	// Schadensanzeigen aktualisieren
-	std::map<int,FloatingText*>::iterator dit;
-	for (dit = m_floating_texts.begin(); dit != m_floating_texts.end(); )
-	{
-		dit->second->m_time -= time;
-		if (dit->second->m_time <= 0)
-		{
-			delete dit->second;
-			m_floating_texts.erase(dit++);
-		}
-		else
-		{
-			++dit;
-		}
-	}
-}
-
-void Region::getRegionData(CharConv* cv)
-{
-	// Dimension des Feldes angeben
-	cv->toBuffer((short) m_dimx);
-	cv->toBuffer((short) m_dimy);
-
-	// Name der Region
-	cv->toBuffer(m_name);
-
-	cv->toBuffer(m_ground_material);
-	
-
-	// Anzahl der statischen Objekte eintragen
-	DEBUGX("static objects: %i",m_static_objects.size());
-	cv->toBuffer((short) m_static_objects.size());
-
-	// statische Objekte in den Puffer eintragen
-	WorldObjectMap::iterator it;
-	for (it = m_static_objects.begin();it!=m_static_objects.end();++it)
-	{
-		(it->second)->toString(cv);
-		DEBUGX("static object: %s",(it->second)->getNameId().c_str());
-	}
-
-
-	// Anzahl der nicht  statischen Objekte eintragen
-	WorldObjectMap::iterator jt;
-	short nr=0;
-	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
-	{
-		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
-			nr++;
-	}
-	DEBUGX("nonstatic objects: %i",nr);
-	cv->toBuffer((short) nr);
-
-	// nicht statische Objekte in den Puffer eintragen
-
-	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
-	{
-		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
-		{
-			DEBUGX("write offset: %i",cv->writeBits());
-			(jt->second)->toString(cv);
-
-			DEBUGX("object: %s",(jt->second)->getNameId().c_str());
-		}
-	}
-
-	// Anzahl der Projektile eintragen
-	cv->toBuffer((short) m_projectiles.size());
-	DEBUGX("projectiles: %i",m_projectiles.size());
-
-	// Projektile in den Puffer eintragen
-	ProjectileMap::iterator kt;
-	for (kt = m_projectiles.begin(); kt != m_projectiles.end(); ++kt)
-	{
-		kt->second->toString(cv);
-	}
-
-	cv->toBuffer((short) m_drop_items.size());
-	DEBUGX("dropped items: %i",m_drop_items.size());
-
-	//  Items in den Puffer eintragen
-	DropItemMap::iterator lt;
-	for (lt = m_drop_items.begin(); lt != m_drop_items.end(); ++lt)
-	{
-		lt->second->toString(cv);
-	}
-	
-	// Dialoge eintragen
-	std::map<int, Dialogue*>::iterator dt;
-	cv->toBuffer((short) m_dialogues.size());
-	for (dt = m_dialogues.begin(); dt != m_dialogues.end(); ++dt)
-	{
-		dt->second->toString(cv);
-	}
-	
-	// Musik
-	writeMusicTracksToString(cv);
-	
-	// Cutscene modus
-	cv->toBuffer(m_cutscene_mode);
-	getCamera().toString(cv);
-	
-	// Licht
-	m_light.toString(cv);
-	
-	// Untergrund
-	cv->toBuffer(m_ground_material);
-	
-	
-}
-
-
-void Region::createObjectFromString(CharConv* cv, WorldObjectMap* players)
-{
-	WorldObject::Type type;
-	WorldObject::Subtype subt;
-	int id;
-
-	WorldObject* obj;
-
-	DEBUGX("read offset: %i",cv->readBits());
-
-	cv->fromBuffer(type);
-	cv->fromBuffer(subt);
-	cv->fromBuffer(id);
-	
-	DEBUGX("read offset: %i",cv->readBits());
-
-	DEBUGX("object %s id %i",subt.c_str(),id);
-
-	// alle Objekte ausser den Spielern werden neu angelegt
-	// die Spieler existieren schon
-	if (type != "PLAYER")
-	{
-		obj = ObjectFactory::createObject(type, subt,id);
-	}
-	else
-	{
-		if (players->count(id) ==0)
-		{
-			ERRORMSG("player (%s) with id %i does not exist",subt.c_str(),id);
-		}
-		obj = (*players)[id];
-	}
-
-	if (obj==0)
-	{
-		ERRORMSG("failed to create Object %s",subt.c_str());
-	}
-	
-	obj->fromString(cv);
-
-	WorldObject* oldobj = getObject(obj->getId());
-	if (oldobj != 0)
-	{
-		DEBUG("Object %i already exists",oldobj->getId());
-		oldobj->destroy();
-		deleteObject(oldobj);
-		delete oldobj;
-	}
-	insertObject(obj,obj->getShape()->m_center,obj->getShape()->m_angle);
-}
-
-
-void Region::createProjectileFromString(CharConv* cv)
-{
-
-	GameObject::Type type;
-	GameObject::Subtype subt;
-	int id;
-	Projectile* proj;
-
-	cv->fromBuffer(type);
-	cv->fromBuffer(subt);
-	cv->fromBuffer(id);
-
-	DEBUGX("new projectile %s  id %i",subt.c_str(),id);
-
-	proj = ObjectFactory::createProjectile(subt,id);
-
-	proj->fromString(cv);
-
-	Projectile* oldproj = getProjectile(proj->getId());
-	if (oldproj != 0)
-	{
-		DEBUG("Projectile %i already exists",oldproj->getId());
-		deleteProjectile(oldproj);
-		delete oldproj;
-	}
-	insertProjectile(proj,proj->getShape()->m_center);
-}
-
-void Region::createItemFromString(CharConv* cv)
-{
-	GameObject::Type type;
-	GameObject::Subtype subt;
-	int id;
-	
-	cv->fromBuffer(type);
-	cv->fromBuffer(subt);
-	cv->fromBuffer(id);
-	
-	DEBUGX("got Item %i %s %s",id,type.c_str(),subt.c_str());
-	
-	DropItem* di = new DropItem(id);
-	di->fromString(cv);
-
-	if (m_drop_items.count(id) >0)
-	{
-		DEBUGX("Item %i already exists",di->getId());
-		deleteItem(id);
-	}
-	m_drop_items.insert(std::make_pair(id,di));
-	m_drop_item_locations.insert(std::make_pair(di->getLocationId(),di));
-	m_game_objects.insert(std::make_pair(di->getId(),di));
-}
-
-void Region::createDialogueFromString(CharConv* cv)
-{
-	int id;
-	cv->fromBuffer(id);
-	
-	if (m_dialogues.count(id) >0)
-	{
-		DEBUG("Dialogue %i already exists",id);
-		deleteDialogue(m_dialogues[id]);
-	}	
-	
-	Dialogue* dia = new Dialogue(this,"",id);
-	dia->fromString(cv);
-	insertDialogue(dia);
-	
-}
-
-void Region::setRegionData(CharConv* cv,WorldObjectMap* players)
-{	
-	// Groesse der Region wird schon vorher eingelesen
-
-	// Name der Region
-	
-	cv->fromBuffer(m_name);
-	cv->fromBuffer(m_ground_material);
-
-
-	// alle bisherigen statischen Objekte entfernen
-	WorldObjectMap::iterator it, itnext;
-	for (it = m_static_objects.begin();it!=m_static_objects.end();++it)
-	{
-		itnext = it;
-		++itnext;
-		
-		it->second->destroy();
-		deleteObject(it->second);
-		delete it->second;
-		
-		it = itnext;
-	}
-	m_static_objects.clear();
-
-	// alle bisherigen nichtstatischen Objekte entfernen
-	// die SpielerObjekte bleiben erhalten, alle anderen werden geloescht
-	WorldObjectMap::iterator jt, jtnext;
-	for (jt = m_objects.begin();jt!=m_objects.end();)
-	{
-		jtnext = jt;
-		++jtnext;
-		if (jt->second->getType() != "PLAYER")
-		{
-			jt->second->destroy();
-			deleteObject(jt->second);
-			delete jt->second;
-		}
-		jt = jtnext;
-	}
-	m_objects.clear();
-	m_players.clear();
-	
-	// DropItems loeschen
-	DropItemMap::iterator k;
-	for (k =  m_drop_items.begin(); k != m_drop_items.end(); ++k)
-	{
-		if (k->second->getItem() !=0)
-		{
-			delete k->second->getItem();
-		}
-		m_game_objects.erase(k->second->getId());
-		delete k->second;
-	}
-	m_drop_items.clear();
-	
-	std::list<Trigger*>::iterator l;
-	for (l = m_triggers.begin(); l != m_triggers.end(); ++l)
-	{
-		delete *l;
-	}
-	m_triggers.clear();
-
-	// statische Objekte einlesen
-	short nr_stat;
-	cv->fromBuffer(nr_stat);
-	DEBUGX("static objects: %i",nr_stat);
-
-	for (int i=0; i<nr_stat;i++)
-	{
-		createObjectFromString(cv,players);
-	}
-
-
-
-	// neue Objekte einlesen
-	short nr_nonstat;
-	cv->fromBuffer(nr_nonstat);
-	DEBUGX("nonstatic objects: %i",nr_nonstat);
-
-	for (int i=0; i<nr_nonstat;i++)
-	{
-		createObjectFromString(cv,players);
-	}
-
-
-	// Anzahl der Projektile einlesen
-	short nr_proj;
-	cv->fromBuffer(nr_proj);
-	DEBUGX("projectiles: %i",nr_proj);
-	// Projektile einlesen
-	for (int i=0; i<nr_proj;i++)
-	{
-		createProjectileFromString(cv);
-	}
-
-	// Anzahl Gegenstaende einlesen
-	short nr_items;
-	cv->fromBuffer(nr_items);
-	DEBUGX("items: %i",nr_items);
-	// Gegenstaende einlesen
-	for (int i=0; i<nr_items;i++)
-	{
-		createItemFromString(cv);
-	}
-	
-	// Dialoge einlesen
-	short nr_dia;
-	cv->fromBuffer(nr_dia);
-	for (int i=0; i< nr_dia; i++)
-	{
-		createDialogueFromString(cv);
-	}
-	
-	// Musik
-	readMusicTracksFromString(cv);
-
-	// Cutscene modus
-	cv->fromBuffer(m_cutscene_mode);
-	getCamera().fromString(cv);
-	
-	// Licht
-	m_light.fromString(cv);
-	
-	// Untergrund
-	cv->fromBuffer(m_ground_material);
-	
-}
-
-void Region::getRegionCheckData(CharConv* cv)
-{
-
-
-	// Anzahl der nicht  statischen Objekte eintragen
-	WorldObjectMap::iterator jt;
-	short nr=0;
-	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
-	{
-		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
-			nr++;
-	}
-	DEBUGX("nonstatic objects: %i",nr);
-	cv->toBuffer((short) nr);
-
-	// nicht statische Objekte in den Puffer eintragen
-
-	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
-	{
-		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
-		{
-			cv->toBuffer((jt->second)->getId());
-			DEBUGX("object: %s",(jt->second)->getNameId().c_str());
-		}
-	}
-
-	// Anzahl der Projektile eintragen
-	cv->toBuffer((short) m_projectiles.size());
-	DEBUGX("projectiles: %i",m_projectiles.size());
-
-	// Projektile in den Puffer eintragen
-	ProjectileMap::iterator kt;
-	for (kt = m_projectiles.begin(); kt != m_projectiles.end(); ++kt)
-	{
-		cv->toBuffer((kt->second)->getId());
-	}
-
-	cv->toBuffer((short) m_drop_items.size());
-	DEBUGX("dropped items: %i",m_drop_items.size());
-
-	//  Items in den Puffer eintragen
-	DropItemMap::iterator lt;
-	for (lt = m_drop_items.begin(); lt != m_drop_items.end(); ++lt)
-	{
-		cv->toBuffer((lt->second)->getId());
-	}
-	
-	// Cutscene modus
-	cv->toBuffer(m_cutscene_mode);
-}
-
-void Region::checkRegionData(CharConv* cv)
-{
-	short nr;
-	std::set<int> objects;
-	int id;
-	
-	WorldObject* wo;
-	Projectile* pr;
-	DropItem* di;
-	
-	static std::set<int> objectstodelete;
-	static std::set<int> objectsmissing;
-	static std::set<int> projtodelete;
-	static std::set<int> projmissing;
-	static std::set<int> itemtodelete;
-	static std::set<int> itemmissing;
-	static std::set<int>::iterator setit;
-	
-	// Objekte die nach dem letzten Check fraglich waren loeschen
-	// bzw neu anfordern
-	WorldObjectList::iterator wit;
-	WorldObjectMap::iterator it;
-	
-	// WorldObjects
-	for (setit = objectstodelete.begin(); setit != objectstodelete.end(); ++setit)
-	{
-		wo = getObject((*setit));
-		if (wo != 0)
-		{
-			WARNING("object %i does not exist at server",wo->getId());
-			deleteObject(wo);
-			if (wo->getType() != "PLAYER")
-			{
-				wo->destroy();
-				delete wo;
-			}
-		}
-	}
-	for (setit = objectsmissing.begin(); setit != objectsmissing.end(); ++setit)
-	{
-		wo = getObject((*setit));
-		if (wo ==0)
-		{
-			WARNING("object %i is missing",(*setit));
-			// fehlende Daten zur Region anfordern
-			PackageHeader header;
-			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
-			header.m_number =1;
-
-			ClientDataRequest datareq;
-			datareq.m_data = ClientDataRequest::OBJECT;
-			datareq.m_id = *setit;
-			datareq.m_region_id = getId();
-
-			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
-			header.toString(msg);
-			datareq.toString(msg);
-
-			World::getWorld()->getNetwork()->pushSlotMessage(msg);
-			World::getWorld()->getNetwork()->deallocatePacket(msg);
-		}
-	}
-	
-	// Projektile
-	for (setit = projtodelete.begin(); setit != projtodelete.end(); ++setit)
-	{
-		pr = getProjectile(*setit);
-		if (pr != 0)
-		{
-			WARNING("projectile %i does not exist at server",pr->getId());
-			deleteProjectile(pr);
-			delete pr;
-		}
-	}
-	for (setit = projmissing.begin(); setit != projmissing.end(); ++setit)
-	{
-		pr = getProjectile(*setit);
-		if (pr ==0)
-		{
-			WARNING("projectile %i is missing",(*setit));
-			// fehlende Daten zur Region anfordern
-			PackageHeader header;
-			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
-			header.m_number =1;
-
-			ClientDataRequest datareq;
-			datareq.m_data = ClientDataRequest::PROJECTILE;
-			datareq.m_id = *setit;
-			datareq.m_region_id = getId();
-
-			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
-			
-			header.toString(msg);
-			datareq.toString(msg);
-
-			World::getWorld()->getNetwork()->pushSlotMessage(msg);
-			World::getWorld()->getNetwork()->deallocatePacket(msg);
-		}
-	}
-	
-	// DropItem
-	for (setit = itemtodelete.begin(); setit != itemtodelete.end(); ++setit)
-	{
-		di = getDropItem(*setit);
-		if (di != 0)
-		{
-			WARNING("dropitem %i does not exist at server",di->getId());
-			deleteItem(di->getId(), true);
-		}
-	}
-	for (setit = itemmissing.begin(); setit != itemmissing.end(); ++setit)
-	{
-		di = getDropItem(*setit);
-		if (di ==0)
-		{
-			WARNING("dropitem %i is missing",(*setit));
-			// fehlende Daten zur Region anfordern
-			PackageHeader header;
-			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
-			header.m_number =1;
-
-			ClientDataRequest datareq;
-			datareq.m_data = ClientDataRequest::ITEM;
-			datareq.m_id = *setit;
-			datareq.m_region_id = getId();
-
-			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
-			
-			header.toString(msg);
-			datareq.toString(msg);
-
-			World::getWorld()->getNetwork()->pushSlotMessage(msg);	
-			World::getWorld()->getNetwork()->deallocatePacket(msg);
-		}
-	}
-	
-	
-	objectstodelete.clear();
-	objectsmissing.clear();
-	projtodelete.clear();
-	projmissing.clear();
-	itemtodelete.clear();
-	itemmissing.clear();
-	
-	
-	
-	cv->fromBuffer(nr);
-	DEBUGX("nonstatic Objects %i",nr);
-	for (int i=0; i<nr; i++)
-	{
-		cv->fromBuffer(id);
-		objects.insert(id);
-		
-		if (m_objects.count(id) ==0)
-		{
-			// Objekt fehlt beim Client
-			objectsmissing.insert(id);
-		}
-	}
-	
-	for (it = m_objects.begin();it!=m_objects.end();++it)
-	{
-		wo = it->second;
-		if (objects.count(wo->getId()) ==0)
-		{
-			// Objekt ist beim Client zu viel
-			objectstodelete.insert(wo->getId());
-		}
-	}
-	
-	objects.clear();
-	
-	cv->fromBuffer(nr);
-	ProjectileMap::iterator kt;
-	
-	DEBUGX("projectiles %i",nr);
-	for (int i=0; i<nr; i++)
-	{
-		cv->fromBuffer(id);
-		objects.insert(id);
-		
-		if (m_projectiles.count(id) ==0)
-		{
-			// Objekt fehlt beim Client
-			projmissing.insert(id);
-		}
-	}
-	
-	for (kt = m_projectiles.begin(); kt!=m_projectiles.end();++kt)
-	{
-		pr = kt->second;
-		if (objects.count(pr->getId()) ==0)
-		{
-			// Objekt ist beim Client zu viel
-			projtodelete.insert(pr->getId());
-		}
-	}
-	
-	objects.clear();
-	
-	cv->fromBuffer(nr);
-	DropItemMap::iterator lt;
-	
-	DEBUGX("dropitems %i",nr);
-	for (int i=0; i<nr; i++)
-	{
-		cv->fromBuffer(id);
-		objects.insert(id);
-		
-		if (m_drop_items.count(id) ==0)
-		{
-			// Objekt fehlt beim Client
-			itemmissing.insert(id);
-		}
-	}
-	
-	for (lt = m_drop_items.begin(); lt!=m_drop_items.end();++lt)
-	{
-		di = lt->second;
-		if (objects.count(di->getId()) ==0)
-		{
-			// Objekt ist beim Client zu viel
-			itemtodelete.insert(di->getId());
-		}
-	}
-}
-
-void Region::writeMusicTracksToString(CharConv* cv)
-{
-	cv->toBuffer((short) m_music_tracks.size());
-	std::list<MusicTrack>::iterator mt;
-	for (mt = m_music_tracks.begin(); mt != m_music_tracks.end(); ++mt)
-	{
-		cv->toBuffer(*mt);
-	}
-}
-
-void Region::readMusicTracksFromString(CharConv* cv)
-{
-	clearMusicTracks();
-	
-	short nr;
-	cv->fromBuffer(nr);
-	std::string music;
-	for (int i=0; i<nr; i++)
-	{
-		cv->fromBuffer(music);
-		addMusicTrack(music);
-	}
-}
-
-
-bool  Region::dropItem(Item* item, Vector pos)
-{
-	DEBUGX("drop %s %i",item->m_subtype.c_str(), item->m_id);
-	// Menge der bereits getesteten Felder
-	std::set<int> tfields;
-
-	// Schlange mit zu testenden Feldern
-	std::queue<int> fields;
-
-	// Position in 0.5 x 0.5 Feldern
-	int sx = (int) (pos.m_x*2);
-	int sy = (int) (pos.m_y*2);
-	int i;
-	fields.push(sx*10000+sy);
-
-  	// true, solange alle Felder von festen Objekten blockiert sind
-	bool fixblock = true;
-	
-	// Flaeche auf die das Item gedroppt wird
-	Shape s;
-	s.m_type= Shape::RECT;
-	s.m_extent = Vector(0.5,0.5);
-
-
-	WorldObjectList res;
-
-	// eine Stelle suchen an der das Item fallen gelassen werden kann
-	while (!fields.empty())
-	{
-		// erstes Feld aus der Queue nehmen
-		i = fields.front();
-		sx = i /10000;
-		sy = i %10000;
-		fields.pop();
-
-		DEBUGX("testing field %i %i",sx,sy);
-
-		// Testen ob dort keine festen Objekte sind
-		s.m_center = Vector(sx*0.5, sy*0.5);
-
-
-		res.clear();
-		getObjectsInShape(&s,&res,WorldObject::LAYER_BASE,WorldObject::FIXED,0,true);
-
-		if (!res.empty())
-		{
-			// Objekt im Weg
-			res.clear();
-
-			// wenn alle bisherigen Plaetze von festen Objekten blockiert warten trotzdem weitersuchen
-			if (!fixblock)
-				continue;
-		}
-		else
-		{
-			fixblock = false;
-		}
-
-		// Testen, ob dort nicht schon ein Item liegt
-		if (!fixblock && m_drop_item_locations.find(i) == m_drop_item_locations.end())
-		{
-			DEBUGX("field is free");
-			// Stelle ist frei
-			// Item einfuegen
-			DropItem* di = new DropItem(item);
-			di->setPosition(Vector(sx/2.0f, sy/2.0f));
-			DEBUGX("dropped item %i", sx*10000+sy);
-			
-			m_drop_items.insert(std::make_pair(di->getId(),di));
-			m_drop_item_locations.insert(std::make_pair(i,di));
-			m_game_objects.insert(std::make_pair(di->getId(),di));
-
-			DEBUGX("items dropped at %f %f locID %i %p",sx/2.0f,sy/2.0f, di->getLocationId(),item);
-
-			if (World::getWorld()->isServer())
-			{
-				
-				NetEvent event;
-				event.m_type = NetEvent::ITEM_DROPPED;
-				event.m_id = di->getId();
-
-				insertNetEvent(event);
-				
-			}
-
-			return true;
-
-		}
-		else
-		{
-			// an der Stelle liegt bereits ein Item
-			tfields.insert(i);
-
-			// Nachbarfelder in die Liste der zu untersuchenden Felder einfuegen
-			if (sx>0)
-			{
-				i = (sx-1)*10000+sy;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sy>0)
-			{
-				i = (sx)*10000+sy-1;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sx<m_dimx*8-1)
-			{
-				i = (sx+1)*10000+sy;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-			if (sy<m_dimy*8-1)
-			{
-				i = (sx)*10000+sy+1;
-				if (tfields.find(i)==tfields.end())
-				{
-					fields.push(i);
-				}
-			}
-
-		}
-
-	}
-
-	// keine Stelle gefunden um das Item zu droppen
-	return false;
-
-}
-
-bool Region::dropItem(Item::Subtype subtype, Vector pos, int magic_power)
-{
-		
-	Item::Type type = ItemFactory::getBaseType(subtype);
-	if (type == Item::NOITEM)
-	{
-		return false;
-	}
-	
-	Item* item= ItemFactory::createItem(type,subtype,0,magic_power);
-	DEBUGX("drop item %s at %f %f %p",subtype.c_str(),pos.m_x,pos.m_y,item);
-	
-	if (item !=0)
-	{
-		return dropItem(item, pos);
-	}
-	
-	return false;
-}
-
-
-Item*  Region::getItemAt(Vector pos)
-{
-	DropItemMap::iterator it;
-	short sx = (int) (pos.m_x*2 + 0.5);
-	short sy = (int) (pos.m_y*2 + 0.5);
-	int id = sx*10000 + sy;
-
-	it = m_drop_item_locations.find(id);
-	if (it == m_drop_items.end())
-	{
-		return 0;
-	}
-	else
-	{
-		return it->second->getItem();
-	}
-}
-
-Item* Region::getItem(int id)
-{
-	DropItemMap::iterator it;
-	it = m_drop_items.find(id);
-	if (it == m_drop_items.end())
-	{
-		return 0;
-	}
-	else
-	{
-		return it->second->getItem();
-	}
-}
-
-DropItem* Region::getDropItem(int id)
-{
-	DropItemMap::iterator it;
-	it = m_drop_items.find(id);
-	if (it == m_drop_items.end())
-	{
-		return 0;
-	}
-	else
-	{
-		return it->second;
-	}
-}
-
-
-bool Region::deleteItem(int id, bool delitem)
-{
-
-	DropItemMap::iterator it;
-	DropItemMap::iterator it2;
-	it = m_drop_items.find(id);
-	if (it == m_drop_items.end())
-	{
-		return false;
-	}
-	else
-	{
-		// Item Wrapper loeschen
-		int pos = it->second->getLocationId();
-		it2 = m_drop_item_locations.find(pos);
-
-		
-		NetEvent event;
-		event.m_type = NetEvent::ITEM_REMOVED;
-		event.m_id = it->second->getId();
-		insertNetEvent(event);
-
-		if (delitem)
-		{
-			delete it->second->getItem();
-		}
-		delete (it->second);
-
-		m_drop_items.erase(it);
-		if (it2 != m_drop_item_locations.end())
-		{
-			m_drop_item_locations.erase(it2);
-		}
-		m_game_objects.erase(id);
-
-
-		return true;
-	}
-}
-
-EnvironmentName Region::getEnvironment(Vector pos)
-{
-	if (m_environments.empty())
-	{
-		ERRORMSG("no environments defined");
-	}
-	// Hoehe an der angegebenen Stelle
-	float height = *(m_height.ind(int(pos.m_x/4),int(pos.m_y/4)));
-
-	std::map<float, EnvironmentName>::iterator it;
-
-	for (it = m_environments.begin(); it !=m_environments.end();++it)
-	{
-		if (height < it->first)
-		{
-			DEBUGX("environment %s", it->second.c_str());
-			return it->second;
-		}
-	}
-
-	return m_environments.rbegin()->second;
-}
-
-Vector Region::getLocation(LocationName name)
-{
-	std::map<LocationName, Vector>::iterator it;
-	it = m_locations.find(name);
-
-	if (it == m_locations.end())
-	{
-		WARNING("Location %s does not exist",name.c_str());
-		return Vector(-1,-1);
-	}
-
-	return it->second;
-}
-
-Shape Region::getArea(AreaName name)
-{
-	std::map<AreaName, Shape>::iterator it;
-	it = m_areas.find(name);
-
-	if (it == m_areas.end())
-	{
-		return Shape();
-	}
-
-	return it->second;
-}
-
-
-void Region::addExit(RegionExit exit)
-{
-	exit.m_shape.m_center = getLocation(exit.m_exit_name);
-	m_exits.push_back(exit);
-}
-
-void Region::insertTrigger(Trigger* trigger)
-{
-	m_triggers.push_back(trigger);
-}
-
-void Region::insertTimedTrigger(Trigger* trigger, float time)
-{
-	m_timed_trigger.push_back(std::make_pair(time,trigger));
-}
-
-void Region::addEvent(TriggerType trigger, Event* event)
-{
-	m_events.insert(std::make_pair(trigger,event));
-}
-
-void Region::deleteCopiedEvents()
-{
-	std::multimap<TriggerType, Event*>::iterator it,jt;
-	for (it = m_events.begin(); it != m_events.end(); )
-	{
-		jt = it;
-		++it;
-		Event* ev = jt->second;
-		if (ev->isCopy())
-		{
-			delete ev;
-			m_events.erase(jt);
-		}
-	}
-}
-
-void Region::copyEventsFromRegionData(RegionData* rdata)
-{
-	std::multimap<TriggerType, Event*>::iterator it;
-	Event* ev;
-	for (it = rdata->m_events.begin(); it != rdata ->m_events.end(); ++it)
-	{
-		ev = new Event(*(it->second));
-		addEvent(it->first,ev);
-	}
-}
-
-void Region::setCutsceneMode(bool mode)
-{
-	NetEvent event;
-	event.m_type = NetEvent::REGION_CUTSCENE;
-	event.m_id = getId();
-	event.m_data = (int) mode;
-	insertNetEvent(event);
-	
-	m_cutscene_mode = mode;
-}
-
-
-Dialogue* Region::getDialogue(int id)
-{
-	std::map<int, Dialogue*>::iterator it;
-	it = m_dialogues.find(id);
-	
-	if (it == m_dialogues.end())
-		return 0;
-	
-	return it->second;
-}
-
-void Region::insertDialogue(Dialogue* dia)
-{
-	m_dialogues.insert(std::make_pair(dia->getId(),dia));
-	
-	if (World::getWorld()->isServer())
-	{
-		NetEvent event;
-		event.m_type = NetEvent::DIALOGUE_CREATED;
-		event.m_id = dia->getId();
-		insertNetEvent(event);
-	}
-	DEBUGX("insert Dialogue %i",dia->getId());
-}
-
-void Region::deleteDialogue(Dialogue* dia)
-{
-	DEBUGX("delete Dialogue %i",dia->getId());
-	std::map<int, Dialogue*>::iterator it;
-	it = m_dialogues.find(dia->getId());
-	if (it != m_dialogues.end())
-	{
-		m_dialogues.erase(it);
-	}
-	
-	if (World::getWorld()->isServer())
-	{
-		NetEvent event;
-		event.m_type = NetEvent::DIALOGUE_DESTROYED;
-		event.m_id = dia->getId();
-		insertNetEvent(event);
-	}
-	
-	delete dia;
-}
-
-void Region::setNamedId(std::string name, int id)
-{
-	m_name_ids[name] = id;
-}
-
-int Region::getIdByName(std::string name)
-{
-	std::map<std::string,int>::iterator it;
-	it = m_name_ids.find(name);
-	if (it == m_name_ids.end())
-		return 0;
-	
-	return it->second;
-}
-
-void Region::visualizeDamage(int number, Vector position, FloatingText::Size size)
-{
-	std::stringstream stream;
-	stream << number;
-	TranslatableString text(stream.str());
-	createFloatingText(text, position, size);
-}
-
-void Region::createFloatingText(TranslatableString text,  Vector position, FloatingText::Size size, std::string colour, float time, float float_offset)
-{
-	static int id =0;
-	id ++;
-	FloatingText* dmgvis = new FloatingText;
-	m_floating_texts[id] = dmgvis;
-	dmgvis->m_text = text;
-	dmgvis->m_position = position;
-	dmgvis->m_size = size;
-	dmgvis->m_maxtime = time;
-	dmgvis->m_time = time;
-	dmgvis->m_float_offset = float_offset;
-	dmgvis->m_colour = colour;
-	
-	if (World::getWorld()->isServer())
-	{
-		NetEvent event;
-		event.m_type = NetEvent::DAMAGE_VISUALIZER_CREATED;
-		event.m_id = id;
-		insertNetEvent(event);
-	}
-}
-
-void Region::playSound(std::string soundname, Vector position, float volume , bool global)
-{
-	PlayedSound* sound = new PlayedSound;
-	sound->m_soundname = soundname;
-	sound->m_position = position;
-	sound->m_volume = volume;
-	sound->m_global = global;
-	
-	m_played_sounds.push_back(sound);
-}
-
-void Region::addMusicTrack(MusicTrack track)
-{
-	m_music_tracks.push_back(track);
-	
-	NetEvent event;
-	event.m_type = NetEvent::MUSIC_CHANGED;
-	event.m_id = getId();
-	insertNetEvent(event);
-}
-
-void Region::clearMusicTracks()
-{
-	m_music_tracks.clear();
-	if (World::getWorld()->getLocalPlayer() !=0
-		&& World::getWorld()->getLocalPlayer()->getRegion() == this)
-	{
-		MusicManager::instance().stop();
-	}
-	
-	NetEvent event;
-	event.m_type = NetEvent::MUSIC_CHANGED;
-	event.m_id = getId();
-	insertNetEvent(event);
-}
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "region.h"
+#include "world.h"
+#include "player.h"
+#include "eventsystem.h"
+#include "itemfactory.h"
+#include "scriptobject.h"
+
+//#include "music.h"
+
+// Allow using the list structure (used to store music tracks in region data).
+#include <list>
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+// Allow the use of the sound manager.
+#include "gussound.h"
+
+using gussound::SoundManager;
+
+RegionData::RegionData()
+{
+	m_id = -1;
+	m_dimx= 0;
+	m_dimy = 0;
+	m_area_percent = 0.0f;
+	m_complexity = 0.0f;
+	m_granularity = 0;
+	m_exit_directions[0] = false;
+	m_exit_directions[1] = false;
+	m_exit_directions[2] = false;
+	m_exit_directions[3] = false;
+  
+	for (int i=0; i<3; i++)
+	{
+		m_ambient_light[i] = 0.2;
+		m_hero_light[i] = 1.0;
+		m_directional_light[i] = 0.3;
+	}
+	m_has_waypoint = false;
+}
+
+
+RegionData::~RegionData()
+{
+	std::multimap<TriggerType, Event*>::iterator it;
+	for (it = m_events.begin(); it != m_events.end(); ++it)
+	{
+		delete it->second;
+	}
+	
+}
+
+void RegionData::addObjectGroup(ObjectGroupName group_name, int prio, int number,float probability, bool decoration)
+{
+	ObjectGroupSet newgroup;
+	newgroup.m_group_name = group_name;
+	newgroup.m_probability = probability;
+	newgroup.m_number = number;
+	newgroup.m_probability = probability;
+	newgroup.m_decoration = decoration;
+	
+	m_object_groups.insert(std::make_pair(prio,newgroup));
+}
+
+void RegionData::addEvent(TriggerType trigger, Event* event)
+{
+	m_events.insert(std::make_pair(trigger,event));
+}
+
+void RegionCamera::addPosition(Position& pos, float time)
+{
+	if (m_next_positions.empty() && World::getWorld()->isServer())
+	{
+		NetEvent event;
+		event.m_type = NetEvent::REGION_CAMERA;
+		event.m_id = m_region->getId();
+		m_region->insertNetEvent(event);
+	}
+	m_next_positions.push_back(std::make_pair(pos,time));
+}
+
+void RegionCamera::update(float time)
+{
+	if (m_next_positions.empty())
+		return;
+	
+	Position& pos = m_next_positions.front().first;
+	float& rtime = m_next_positions.front().second;
+	
+	if (rtime <= time)
+	{
+		// naechstes Etappenziel wurde erreicht
+		if (rtime != 0)
+		{
+			Trigger* tr = new Trigger("camera_move_complete");
+			m_region->insertTrigger(tr);
+		}
+		
+		m_position  = pos;
+		m_next_positions.pop_front();
+		
+		if (m_next_positions.empty())
+		{
+			Trigger* tr = new Trigger("all_camera_moves_complete");
+			m_region->insertTrigger(tr);
+		}
+		else
+		{
+			if ( World::getWorld()->isServer())
+			{
+				
+				NetEvent event;
+				event.m_type = NetEvent::REGION_CAMERA;
+				event.m_id = m_region->getId();
+				m_region->insertNetEvent(event);
+			}
+		}
+	}
+	else
+	{
+		// Phi so anpassen, dass jeweils der kuerzere Teilkreis genutzt wird
+		if (m_position.m_phi - pos.m_phi > 180)
+			m_position.m_phi -= 360;
+	
+		if (m_position.m_phi - pos.m_phi < -180)
+			m_position.m_phi += 360;
+		
+		float frac = time/rtime;
+		m_position.m_distance = (1-frac)*m_position.m_distance + frac* pos.m_distance;
+		m_position.m_phi = (1-frac)*m_position.m_phi + frac* pos.m_phi;
+		m_position.m_theta = (1-frac)*m_position.m_theta + frac* pos.m_theta;
+		m_position.m_focus = m_position.m_focus*(1-frac) + pos.m_focus*frac;
+		
+		rtime -= time;
+	}
+}
+
+void RegionCamera::toString(CharConv* cv)
+{
+	cv->toBuffer(m_position.m_distance);
+	cv->toBuffer(m_position.m_phi);
+	cv->toBuffer(m_position.m_theta);
+	cv->toBuffer(m_position.m_focus.m_x);
+	cv->toBuffer(m_position.m_focus.m_y);
+	if (m_next_positions.empty())
+	{
+		cv->toBuffer(static_cast<char>('0'));
+	}
+	else
+	{
+		cv->toBuffer(static_cast<char>('1'));
+		Position& pos = m_next_positions.front().first;
+		
+		cv->toBuffer(pos.m_distance);
+		cv->toBuffer(pos.m_phi);
+		cv->toBuffer(pos.m_theta);
+		cv->toBuffer(pos.m_focus.m_x);
+		cv->toBuffer(pos.m_focus.m_y);
+		cv->toBuffer(m_next_positions.front().second);
+			
+	}
+}
+
+void RegionCamera::fromString(CharConv* cv)
+{
+	cv->fromBuffer(m_position.m_distance);
+	cv->fromBuffer(m_position.m_phi);
+	cv->fromBuffer(m_position.m_theta);
+	cv->fromBuffer(m_position.m_focus.m_x);
+	cv->fromBuffer(m_position.m_focus.m_y);
+	
+	char c='0';
+	cv->fromBuffer(c);
+	if (c =='1')
+	{
+		Position pos;
+		
+		cv->fromBuffer(pos.m_distance);
+		cv->fromBuffer(pos.m_phi);
+		cv->fromBuffer(pos.m_theta);
+		cv->fromBuffer(pos.m_focus.m_x);
+		cv->fromBuffer(pos.m_focus.m_y);
+		
+		float time;
+		cv->fromBuffer(time);
+		
+		time -= cv->getDelay();
+		
+		if (time > 0)
+		{
+			addPosition(pos,time);
+		}
+		else
+		{
+			memcpy(&m_position,&pos,sizeof(Position));
+		}
+	}
+}
+
+
+void RegionLight::Light::update(float time)
+{
+	if (m_timer != 0)
+	{
+		if (m_timer < time)
+		{
+			for (int i=0; i<3; i++)
+				m_value[i] = m_goal_value[i];
+			m_timer =0;
+		}
+		else
+		{
+			float rel = time / m_timer;
+			for (int i=0; i<3; i++)
+			{
+				m_value[i] = rel*m_goal_value[i] + (1-rel)*m_value[i];
+			}
+			m_timer -= time;
+		}
+	}
+}
+
+
+void RegionLight::Light::toString(CharConv* cv)
+{
+	for (int i=0; i<3; i++)
+	{
+		cv->toBuffer(m_value[i]);
+	}
+	for (int i=0; i<3; i++)
+	{
+		cv->toBuffer(m_goal_value[i]);
+	}
+	cv->toBuffer(m_timer);
+}
+
+void RegionLight::Light::fromString(CharConv* cv)
+{
+	for (int i=0; i<3; i++)
+	{
+		cv->fromBuffer(m_value[i]);
+	}
+	for (int i=0; i<3; i++)
+	{
+		cv->fromBuffer(m_goal_value[i]);
+	}
+	cv->fromBuffer(m_timer);	
+}
+
+
+void RegionLight::init(float* ambient, float* herolight, float* directional)
+{
+	for (int i=0; i<3; i++)
+	{
+		m_ambient_light.m_value[i] = ambient[i];
+		m_hero_light.m_value[i] = herolight[i];
+		m_directional_light.m_value[i] = directional[i];	
+	}
+}
+
+void RegionLight::setLight(std::string lighttype, float* value, float time)
+{
+	Light* light =0;
+	if (lighttype == "ambient")
+		light = &m_ambient_light;
+	if (lighttype == "hero")
+		light = &m_hero_light;
+	if (lighttype == "directional")
+		light = &m_directional_light;
+	
+	if (light != 0)
+	{
+		if (time > 0)
+		{
+			for (int i=0; i<3; i++)
+			{
+				light->m_goal_value[i] = value[i];
+			}
+			light->m_timer = time;
+		}
+		else
+		{
+			
+			for (int i=0; i<3; i++)
+			{
+				light->m_value[i] = value[i];
+			}
+			light->m_timer=0;
+		}
+		
+		NetEvent event;
+		event.m_type = NetEvent::REGION_LIGHT;
+		event.m_id = m_region->getId();
+		m_region->insertNetEvent(event);
+	}
+}
+
+void RegionLight::toString(CharConv* cv)
+{
+	m_ambient_light.toString(cv);
+	m_hero_light.toString(cv);
+	m_directional_light.toString(cv);	
+}
+
+void RegionLight::fromString(CharConv* cv)
+{
+	m_ambient_light.fromString(cv);
+	m_hero_light.fromString(cv);
+	m_directional_light.fromString(cv);	
+}
+
+// Note: 
+// This is not recommended normally: sending a partially constructed object (this)
+// to an instantiated item (m_light). In this instance it works, since m_light only
+// stores the pointer. If any other operations would be attempted, it could spell disaster.
+Region::Region(short dimx, short dimy, short id, std::string name, RegionData* data):
+	m_dimx(dimx),
+	m_dimy(dimy),
+
+	m_data_grid(dimx, dimy),
+	m_height(dimx, dimy),
+
+	m_id(id),
+	m_name(name),
+	m_cutscene_mode(false),
+
+	m_revive_location(""),
+
+	m_light(this)
+{
+	SW_DEBUG ("creating region [%s]", m_name.c_str ());
+
+	m_data_grid.clear();
+	m_height.clear();
+	
+	Trigger* tr = new Trigger("create_region");
+	insertTrigger(tr);
+	
+	if (data)
+	{
+		m_light.init(data->m_ambient_light, data->m_hero_light, data->m_directional_light);
+		m_music_tracks = data->m_music_tracks;
+	}
+	
+	m_camera.m_region = this;
+
+	// Also create a playlist for this region, bearing the same name.
+	if (! SoundManager::getPtr ()->getMusicPlayer ()->isPlaylistRegistered (m_name))
+	{
+		SoundManager::getPtr ()->getMusicPlayer ()->registerPlaylist (m_name);
+		SoundManager::getPtr ()->getMusicPlayer ()->setRepeat (true);
+		SoundManager::getPtr ()->getMusicPlayer ()->setShuffle (true);
+		SoundManager::getPtr ()->getMusicPlayer ()->setFadePreferrences (false, false, false);
+
+		// The track names to be used are stored in rdata.
+		if (data)
+		{
+			for (std::list <std::string>::const_iterator it = data->m_music_tracks.begin ();
+				it != data->m_music_tracks.end (); ++ it)
+			{
+				try
+				{
+					// The region stores track names in the form:
+					// - tread_lightly.ogg
+					// - ambience_2.ogg
+					// The music player needs the files including their full path (absolute or relative), in the form:
+					// - .//./share/resources/music/tread_lightly.ogg
+					// - .//./share/resources/music/ambience_2.ogg
+
+					std::string fileName = SoundHelper::getNameWithPathForMusicTrack (*it);
+#if 1
+					// One could call the following function to add an "anonymous" track (with a name such as "track_01").
+					SoundManager::getPtr ()->addPlaylistTrack (m_name, fileName);
+#else
+					// Or one could opt for the manual 2 step solution:
+					SoundManager::getPtr ()->getRepository ()->addSound (*it	// sound name
+																		, fileName	// sound file path
+																		, false	// load into memory? don't do this for songs
+																		, gussound::GSC_Music // category: music.
+																		, true);	// allow only one instance of this sound to be played at one point.
+					SoundManager::getPtr ()->getMusicPlayer ()->addTrackToPlaylist (m_name, *it);
+#endif
+				}
+				catch (std::exception& e)
+				{
+					SW_DEBUG ("Region creation caught exception: %s", e.what ());
+				}
+			}
+		}
+	}
+
+	//SoundManager::getPtr ()->getMusicPlayer ()->stop ();
+	//SoundManager::getPtr ()->getMusicPlayer ()->play ();
+}
+
+Region::~Region()
+{
+	WorldObjectMap::iterator i;
+	for (i=m_objects.begin(); i!=m_objects.end();++i)
+	{
+		delete i->second;
+	}
+
+	for (i=m_static_objects.begin(); i!=m_static_objects.end();++i)
+	{
+		delete i->second;
+	}
+
+	ProjectileMap::iterator j;
+	for (j =  m_projectiles.begin(); j != m_projectiles.end(); ++j)
+	{
+		delete (j->second);
+	}
+
+
+	DropItemMap::iterator k;
+	for (k =  m_drop_items.begin(); k != m_drop_items.end(); ++k)
+	{
+		if (k->second->getItem() !=0)
+			delete k->second->getItem();
+		delete k->second;
+	}
+	
+	std::list<Trigger*>::iterator l;
+	for (l = m_triggers.begin(); l != m_triggers.end(); ++l)
+	{
+		delete *l;
+	}
+	
+	std::multimap<TriggerType, Event*>::iterator m;
+	for (m= m_events.begin(); m!= m_events.end(); ++m)
+	{
+		delete m->second;
+	}
+	
+	for (std::map<int,FloatingText*>::iterator it = m_floating_texts.begin(); it != m_floating_texts.end(); ++it)
+	{
+		delete it->second;
+	}
+	
+	for (std::list<PlayedSound*>::iterator it = m_played_sounds.begin(); it != m_played_sounds.end(); ++it)
+	{
+		delete *it;
+	}
+
+	// Note: it could be possible to remove the playlist here... but that would mean we would have to instantly cut the music.
+	// If we keep the named playlist alive, we can apply a fade-out, moving from the region playlist to the menu playlist.
+	// Once we create a new region playlist, we can remove the old one. (And if the old one is using the same ID, meaning: the user
+	// is loading the same region, we can even resume from where we were previously playing the track).
+}
+
+WorldObject* Region::getObject ( int id)
+{
+	WorldObjectMap::iterator iter;
+
+	// Objekt im Binärbaum suchen
+
+	iter = m_objects.find(id);
+
+	// Testen ob ein Objekt gefunden wurde
+	if (iter == m_objects.end())
+	{
+		// unter den statischen Objekten suchen
+		iter = m_static_objects.find(id);
+
+		// Testen ob ein Objekt gefunden wurde
+		if (iter == m_static_objects.end())
+		{
+			// keins gefunden, NULL ausgeben
+			return 0;
+		}
+		else
+		{
+			// Zeiger auf Objekt ausgeben
+			return iter->second;
+		}
+	}
+	else
+	{
+			// Zeiger auf Objekt ausgeben
+			return iter->second;
+	}
+}
+
+Projectile* Region::getProjectile(int id)
+{
+	ProjectileMap::iterator iter;
+
+	// Objekt im Binärbaum suchen
+	iter = m_projectiles.find(id);
+
+	// Testen ob ein Objekt gefunden wurde
+	if (iter == m_projectiles.end())
+	{
+		// keins gefunden, NULL ausgeben
+		return 0;
+	}
+	else
+	{
+		// Zeiger auf Objekt ausgeben
+		return iter->second;
+	}
+}
+
+GameObject* Region::getGameObject(int id)
+{
+	GameObjectMap::iterator iter;
+
+	iter = m_game_objects.find(id);
+
+	// Testen ob ein Objekt gefunden wurde
+	if (iter == m_game_objects.end())
+	{
+		return 0;
+	}
+	else
+	{
+		return iter->second;
+	}
+}
+
+bool Region::getFreePlace(Shape* shape, short layer, Vector & pos, WorldObject* omit)
+{
+	// Menge der bereits getesteten Felder
+	std::set<int> tfields;
+
+	// Schlange mit zu testenden Feldern
+	std::queue<int> fields;
+
+	float c = 1.1;
+	
+	// Position in 0.5 x 0.5 Feldern
+	int sx = (int) ((pos.m_x/c) + 0.5);
+	int sy = (int) ((pos.m_y/c) + 0.5);
+	
+	float fx = pos.m_x - sx*c;
+	float fy = pos.m_y - sy*c;
+	
+	int i;
+	fields.push(sx*10000+sy);
+
+	// Kopie der Form
+	Shape s;
+	memcpy(&s,shape,sizeof(Shape));
+
+	WorldObjectList res;
+	res.clear();
+
+    // true, solange alle Felder von festen Objekten blockiert sind
+    bool fixblock = true;
+
+	// eine Stelle suchen an der das Objekt passt
+	while (!fields.empty())
+	{
+		// erstes Feld aus der Queue nehmen
+		i = fields.front();
+		sx = i /10000;
+		sy = i %10000;
+		fields.pop();
+
+		DEBUGX("testing field %f %f",sx*c,sy*c);
+
+		// Testen ob dort keine festen Objekte sind
+		s.m_center = Vector(sx*c +fx,sy*c + fy);
+
+		res.clear();
+		getObjectsInShape(&s,&res,layer,WorldObject::FIXED,omit,true);
+
+		if (!res.empty())
+		{
+			// Objekt im Weg
+			res.clear();
+
+			// wenn alle bisherigen Plaetze von festen Objekten blockiert warten trotzdem weitersuchen
+			if (!fixblock)
+                continue;
+		}
+		else
+		{
+		    fixblock = false;
+		}
+
+		DEBUGX("no fixed obstacle");
+		// Testen, ob dort nicht gerade eine Kreatur steht
+		getObjectsInShape(&s,&res,layer,WorldObject::CREATURE,omit,true);
+		if (res.empty() && !fixblock)
+		{
+			DEBUGX("field is free");
+			// Stelle ist frei
+			pos = s.m_center;
+
+			return true;
+
+		}
+		else
+		{
+			DEBUGX("obstacle is %s at %f %f",obs->getNameId().c_str(), obs->getShape()->m_center.m_x,obs->getShape()->m_center.m_y);
+			// Stelle ist besetzt
+			tfields.insert(i);
+
+			// Nachbarfelder in die Liste der zu untersuchenden Felder einfuegen
+			if (sx>0)
+			{
+				i = (sx-1)*10000+sy;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sy>0)
+			{
+				i = (sx)*10000+sy-1;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sx<m_dimx*4-1)
+			{
+				i = (sx+1)*10000+sy;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sy<m_dimy*4-1)
+			{
+				i = (sx)*10000+sy+1;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+		}
+
+	}
+
+	// keine Stelle gefunden
+	return false;
+
+}
+
+bool  Region::addObjectsInShapeFromGridunit(Shape* shape, Gridunit* gu, WorldObjectList* result, short layer, short group,WorldObject* omit, bool empty_test )
+{
+	WorldObject* wo=0;
+	Shape* s=0;
+
+
+	std::vector<WorldObject*>& arr = gu->getObjects((WorldObject::Group) group);
+
+	int n = gu->getObjectsNr((WorldObject::Group) group);
+
+	DEBUGX("%i objects in layer %i, group %i",n,layer,group);
+
+	// Schleife ueber alle Objekte
+	// geprueft wird: Ebene, Schnitt mit der Flaeche
+	for (int k=0;k< n;k++)
+	{
+
+		wo = arr[k];
+		DEBUGX("testing obj %i layer %i",wo->getId(),wo->getLayer());
+
+		s = wo->getShape();
+
+		if ((wo->getLayer() & layer) && (wo->getGroup() & group))
+		{
+			DEBUGX("adding obj %i layer %i",wo->getId(), wo->getLayer());
+			if ((shape ==0) || shape->intersects(*s))
+			{
+
+				if (wo != omit)
+				{
+
+					result->push_back(wo);
+
+					if (empty_test)
+						return true;
+				}
+			}
+		}
+	}
+
+	return true;
+}
+
+bool Region::addObjectsOnLineFromGridunit(Line& line, Gridunit* gu, WorldObjectList* result, short layer, short group ,WorldObject* omit, bool empty_test )
+{
+	WorldObject* wo=0;
+	Shape* s=0;
+
+	std::vector<WorldObject*>& arr = gu->getObjects((WorldObject::Group) group);
+
+	int n = gu->getObjectsNr((WorldObject::Group) group);
+
+	DEBUGX("%i objects in layer %i, group %i",n,layer,group);
+	// Schleife ueber alle Objekte
+	// geprueft wird: Ebene, Schnitt mit der Linie
+	for (int k=0;k< n;k++)
+	{
+
+		wo = arr[k];
+		DEBUGX("testing %s %p",wo->getNameId().c_str(),wo->getNameId().c_str())
+		DEBUGX("testing %p",wo);
+		s = wo->getShape();
+
+		if ((wo->getLayer() & layer) && (wo->getGroup() & group))
+		{
+			if (s->intersects(line))
+			{
+				if (wo != omit)
+				{
+					result->push_back(wo);
+
+					if (empty_test)
+						return true;
+				}
+			}
+		}
+	}
+
+	return true;
+}
+
+
+bool Region::getObjectsInShape( Shape* shape,  WorldObjectList* result,short layer, short group, WorldObject* omit, bool empty_test)
+{
+
+	DEBUGX("shape %f %f %f",shape->m_center.m_x,shape->m_center.m_y,shape->m_radius);
+
+	 // Wenn der Resultat Zeiger 0 ist: Fehler ausgeben
+	if (result == 0)
+	{
+		ERRORMSG("no result list given");
+		return false;
+	}
+
+	if (shape == 0)
+	{
+		ERRORMSG("no shape given");
+		return false;
+	}
+
+
+	DEBUGX("layer %i group %i",layer,group);
+
+
+	if (group == WorldObject::PLAYER)
+	{
+		// Wenn nur nach Spielern gesucht ist, dann nur die Liste der Spieler durchsuchen
+
+		WorldObjectMap::iterator it;
+		for (it = m_players.begin(); it != m_players.end(); ++it)
+		{
+ 			if (shape->intersects(*(it->second->getShape()) ) && it->second != omit)
+			{
+				result->push_back(it->second);
+			}
+		}
+	}
+	else
+	{
+		int i,j;
+		Gridunit* gu=0;
+		// durchmustere alle 4*4 Felder die von dem Suchrechteck plus 4 Felder bedeckt werden
+
+		// Maximale Ausdehnung der Flaeche in Richtung der Koordinatenaxen
+		Vector ext = shape->getAxisExtent();
+		Vector d1 = shape->m_center +ext;
+		Vector d2 = shape->m_center -ext;
+
+
+		int xmin = (int) floor(0.25*(d2.m_x-4));
+		int ymin = (int) floor(0.25*(d2.m_y-4));
+		int xmax = (int) floor(0.25*(d1.m_x+4));
+		int ymax = (int) floor(0.25*(d1.m_y+4));
+		// Pruefen ob die Suchanfrage nicht aus der Region herauslaeuft
+
+		int is = MathHelper::Max (xmin,0);
+		int ie = MathHelper::Min(xmax,m_dimx-1);
+		int js = MathHelper::Max(ymin,0);
+		int je = MathHelper::Min(ymax,m_dimy-1);
+
+		DEBUGX("searching square (%i %i) (%i %i)",is,ie,js,je);
+
+		// Alle 4x4 Felder durchmustern
+		for (i = is;i<=ie;i++)
+		{
+			for (j=js;j<=je;j++)
+			{
+
+				DEBUGX("searching in Grid Tile %i %i",i,j);
+				// Durchmustern der Listen im 4x4-Feld
+				gu = &(m_data_grid)[i][j];
+
+				// Totenebene
+				if (group & WorldObject::DEAD)
+				{
+					DEBUGX("searching dead layer");
+
+					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::DEAD, omit, empty_test);
+					if (!result->empty() && empty_test)
+						return true;
+
+				}
+
+				// feste Objekte
+				if (group & WorldObject::FIXED )
+				{
+					DEBUGX("searching fixed layer");
+
+					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::FIXED, omit, empty_test);
+					if (!result->empty() && empty_test)
+						return true;
+
+				}
+
+				// lebende Objekte
+				if (group & WorldObject::CREATURE)
+				{
+
+					addObjectsInShapeFromGridunit(shape, gu, result, layer,group & WorldObject::CREATURE, omit, empty_test);
+					if (!result->empty() && empty_test)
+						return true;
+
+				}
+
+			}
+
+		}
+		
+		// grosse Objekte durchmustern
+		WorldObjectMap::iterator it;
+		for (it = m_large_objects.begin(); it != m_large_objects.end(); ++it)
+		{
+			if (( it->second->getGroup() & group) && (it->second->getLayer() & layer))
+			{
+				if (shape->intersects(*(it->second->getShape())) && it->second != omit )
+				{
+					result->push_back(it->second);
+					if (empty_test)
+						return true;
+				}
+			}
+		}
+		
+	}
+	return true;
+}
+
+
+WorldObject* Region::getObjectAt(Vector pos, short layer, short group)
+{
+	Shape s;
+	s.m_type = Shape::CIRCLE;
+	s.m_radius =0;
+	s.m_center = pos;
+
+	WorldObjectList l;
+	l.clear();
+	getObjectsInShape ( &s, &l,layer,group );
+	if (l.empty())
+	{
+		return 0;
+	}
+	else
+	{
+		return *(l.begin());
+	}
+}
+
+
+
+void Region::getObjectsOnLine(Line& line,  WorldObjectList* result,short layer, short group , WorldObject* omit)
+{
+	Gridunit* gu=0;
+
+	int xmin = (short) floor(0.25*(MathHelper::Min(line.m_start.m_x,line.m_end.m_x)-4));
+	int ymin = (short) floor(0.25*(MathHelper::Min(line.m_start.m_y,line.m_end.m_y)-4));
+	int xmax = (short) floor(0.25*(MathHelper::Max(line.m_start.m_x,line.m_end.m_x)+4));
+	int ymax = (short) floor(0.25*(MathHelper::Max(line.m_start.m_y,line.m_end.m_y)+4));
+	int i,j;
+	float d;
+
+	// Richtung der Linie
+	Vector dir = line.getDirection();
+	dir.normalize();
+	Vector p;
+
+	for (i = MathHelper::Max (xmin,0);i<=MathHelper::Min(xmax,m_dimx-1);i++)
+	{
+		for (j=MathHelper::Max(ymin,0);j<=MathHelper::Min(ymax,m_dimy-1);j++)
+		{
+			DEBUGX("searching in Grid Tile %i %i",i,j);
+
+			// Herausfiltern jener Felder die zu weit von der Linie entfernt sind
+			p.m_x = i*4.0+2;
+			p.m_y = j*4.0+2;
+			p -= line.m_start;
+
+			p.normalPartTo(dir);
+
+			d = p.getLength();
+			if (d>32)
+			{
+				DEBUGX("aborted");
+				continue;
+			}
+
+			// Durchmustern der Listen im 4x4-Feld
+			gu = &(m_data_grid)[i][j];
+
+			// Totenebene
+			if (group & WorldObject::DEAD)
+			{
+				DEBUGX("searching dead layer");
+
+				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::DEAD, omit);
+			}
+
+				// feste Objekte
+			if (group & WorldObject::FIXED )
+			{
+				DEBUGX("searching fixed layer");
+
+
+				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::FIXED, omit);
+			}
+
+				// lebende Objekte
+			if (group & WorldObject::CREATURE)
+			{
+
+
+				addObjectsOnLineFromGridunit(line, gu, result, layer,group & WorldObject::CREATURE, omit);
+			}
+
+
+		}
+
+	}
+	
+	WorldObjectMap::iterator it;
+	for (it = m_large_objects.begin(); it != m_large_objects.end(); ++it)
+	{
+		if (( it->second->getGroup() & group) && (it->second->getLayer() & layer))
+		{
+			if ((it->second->getShape()->intersects(line)) && it->second != omit )
+			{
+				result->push_back(it->second);
+			}
+		}
+	}
+}
+
+
+bool Region::insertObject(WorldObject* object, Vector pos, float angle )
+{
+	DEBUGX("try to insert %s at %f %f",object->getSubtype().c_str(), pos.m_x,pos.m_y);
+	bool result = true;
+	
+	bool collision_test = object->checkInteractionFlag(WorldObject::COLLISION_DETECTION);
+	
+	object->setRegionId(m_id);
+
+	 // Einfügen in den Binärbaum
+	if (object->getState() != WorldObject::STATE_STATIC)
+	{
+		result &= (m_objects.insert(std::make_pair(object->getId(),object))).second;
+		result &= (m_game_objects.insert(std::make_pair(object->getId(),object))).second;
+	}
+	else
+	{
+		result &= (m_static_objects.insert(std::make_pair(object->getId(),object))).second;
+	}
+
+
+	 // Wenn das Element bereits existiert ist die Antwort false
+	if (result==false)
+	{
+		SW_DEBUG("Object with id %i already exists",object->getId());
+		return result;
+	}
+
+	if (object->getType() == "PLAYER")
+	{
+		Player* pl = dynamic_cast<Player*>(object);
+		DEBUGX("player entered Region");
+		result &= (m_players.insert(std::make_pair(object->getId(),object))).second;
+		
+		if (m_revive_location != "")
+		{
+			pl->setRevivePosition(std::make_pair(getIdString(),m_revive_location));
+		}
+		
+		Trigger* tr = new Trigger("enter_region");
+		tr->addVariable("player", object->getId());
+		insertTrigger(tr);
+
+		// pruefen ob Party komplett in der Region
+		Party* party = pl->getParty();
+		std::set< int > & members = party->getMembers();
+		std::set< int >::iterator it;
+		bool complete = true;
+		for (it = members.begin(); it != members.end(); ++it)
+		{
+			if (getObject(*it) == 0)
+			{
+				complete = false;
+			}
+		}
+		
+		if (complete)
+		{
+			tr = new Trigger("party_complete");
+			insertTrigger(tr);
+		}
+	}
+	else
+	{
+		// fuer Nicht Spieler NetEvent erzeugen, dass das Objekt erschaffen wurde
+		
+		NetEvent event;
+		event.m_type = NetEvent::OBJECT_CREATED;
+		event.m_id = object->getId();
+		insertNetEvent(event);
+		DEBUGX("insert object %i",event.m_id);
+		
+		if (object->getGroup() & WorldObject::CREATURE)
+		{
+			Trigger* tr = new Trigger("create_unit");
+			tr->addVariable("unit", object->getId());
+			insertTrigger(tr);
+		}
+	}
+
+	object->getShape()->m_angle = angle;
+	
+	// Test auf Kollisionen und eventuelle Verschiebung
+	if (collision_test)
+	{
+		getFreePlace(object->getShape(), object->getLayer(), pos);
+	}
+
+	 // Koordinaten setzen
+	object->getShape()->m_center = pos;
+
+	 // Einfuegen in das Grid
+	int x_g = (int) floor(0.25*pos.m_x);
+	int y_g = (int) floor(0.25*pos.m_y);
+	object->getGridLocation()->m_grid_x = x_g;
+	object->getGridLocation()->m_grid_y = y_g;
+
+
+	 // Testen ob das Objekt in der Region liegt
+	if (x_g<0 || y_g<0 || x_g>=m_dimx || y_g>=m_dimy)
+	{
+		DEBUGX("create Object at %f %f",pos.m_x, pos.m_y);
+		return false;
+	}
+	else
+	{
+		if (object->getLayer() & WorldObject::LAYER_COLLISION)
+		{
+			// testen ob das Objekt zu den gesondert behandelten grossen Objekten gehoehrt
+			if (object->isLarge())
+			{
+				DEBUGX("object %s is large",object->getName().c_str());
+				m_large_objects.insert(std::make_pair(object->getId(),object));
+				result = true;
+			}
+			else
+			{
+				Gridunit *gu = (m_data_grid.ind(x_g,y_g));
+
+				result = gu->insertObject(object);
+			}
+		}
+
+	}
+
+	DEBUGX("object inserted %s %i at %f %f",object->getSubtype().c_str(), object->getId(), object->getShape()->m_center.m_x,object->getShape()->m_center.m_y);
+	return result;
+}
+
+int Region::createObject(ObjectTemplateType generictype, Vector pos, float angle, float height, WorldObject::State state)
+{
+	// Umgebung erfahren
+	EnvironmentName env = getEnvironment(pos);
+
+	// genauen Subtyp ermitteln
+	WorldObject::Subtype subtype = ObjectFactory::getObjectType(generictype, env);
+	
+	if (subtype == "notype")
+	{
+		// Objekt fuer die Umgebung explizit als nichtexistent gesetzt
+		return 0;
+	}
+	
+	if (subtype == "")
+	{
+		SW_DEBUG("no subtype found for generictype %s",generictype.c_str());
+		return 0;
+	}
+	
+	// Basistyp ermitteln
+	WorldObject::Type type = ObjectFactory::getObjectBaseType(subtype);
+	if (type == "NONE")
+	{
+		SW_DEBUG("no base type for subtype %s",subtype.c_str());
+		return 0;
+	}
+
+	// Objekt erstellen
+	WorldObject* object = ObjectFactory::createObject(type,subtype);
+
+	if (object ==0)
+	{
+		SW_DEBUG("could not create object for generictype %s",generictype.c_str());
+		return 0;
+	}
+
+	if (state != WorldObject::STATE_NONE)
+	{
+		object->setState(state,false);
+	}
+	
+	if (state == WorldObject::STATE_AUTO)
+	{
+		if (object->getType() == "FIXED_OBJECT")
+		{
+			object->setState(WorldObject::STATE_INACTIVE,false);
+		}
+		else
+		{
+			object->setState(WorldObject::STATE_ACTIVE,false);
+		}
+	}
+	
+			
+	// Objekt einfuegen
+	object->setHeight(height);
+	bool ret = insertObject(object,pos,angle);
+	if (!ret)
+	{
+		SW_DEBUG("insertion of object %s failed",object->getNameId().c_str());
+	}
+
+	return object->getId();
+
+}
+
+
+void Region::createObjectGroup(ObjectGroupName templname, Vector position, float angle, std::string name,WorldObject::State state)
+{
+	Trigger* tr=0;
+	
+	// Template aus der Datenbank heraussuchen
+	std::map<ObjectGroupName, ObjectGroup*>::iterator it;
+
+	
+	// Umgebung erfahren
+	EnvironmentName env = getEnvironment(position);
+	ObjectGroupName templnameneu = ObjectFactory::getObjectGroupType(templname,env);
+	
+	if (templnameneu == "notype")
+	{
+		// Objektgruppe fuer die Umgebung explizit als nichtexistent gesetzt
+		return;
+	}
+	
+	ObjectGroup* templ = ObjectFactory::getObjectGroup(templnameneu);
+	
+	if (templ != 0)
+	{
+		if (name != "" || !templ->getLocations()->empty())
+		{
+			tr = new Trigger("create_template");
+			tr->addVariable("templname",templname);
+			tr->addVariable("name",name);
+			tr->addVariable("position",position);
+			tr->addVariable("angle",angle);
+			
+			// Mittelpunkt eintragen
+			std::string locname = name;
+			locname += ":center";
+			addLocation(locname,position);
+			
+			// Flaeche eintragen
+			std::string areaname = name;
+			areaname += ":area";
+			addArea(areaname,*(templ->getShape()));
+		}
+		
+		// Template wurde gefunden
+		// Objekte platzieren
+		std::list<ObjectGroup::GroupObject>::iterator gt;
+		Vector pos;
+
+		float oangle=0;
+		for (gt = templ->getObjects()->begin(); gt != templ->getObjects()->end(); ++gt)
+		{
+			if (Random::random() < gt->m_probability)
+			{
+
+				pos = gt->m_center;
+				pos.rotate(angle);
+				pos += position;
+
+				oangle = gt->m_angle;
+				if (gt->m_prob_angle)
+				{
+					oangle = 2*3.14159*Random::random();
+				}
+
+				int id;
+				// Objekte mit Name sollte man loeschen / modifizieren koennen
+				// das wird erreicht, in dem der Status auf Inaktiv statt static gestellt wird
+				WorldObject::State ostate = state;
+				if (gt->m_name != "")
+				{
+					ostate = WorldObject::STATE_AUTO;
+				}
+				
+				id = createObject(gt->m_type, pos, angle+oangle,gt->m_height,ostate);
+				DEBUGX("inserting object %s at %f %f with id %i",gt->m_type.c_str(),pos.m_x, pos.m_y,id);
+				
+				if (gt->m_name != "")
+				{
+					setNamedId(gt->m_name,id);
+					if (tr != 0)
+					{
+						tr->addVariable(gt->m_name,id);
+					}
+				}
+			}
+		}
+
+		// Orte einfuegen
+		std::map<LocationName, Vector>::iterator lt;
+		for (lt = templ->getLocations()->begin(); lt != templ->getLocations()->end(); ++lt)
+		{
+			pos = lt->second;
+			pos.rotate(angle);
+			pos += position;
+
+			std::string locname;
+			if (name != "")
+			{
+				locname += name;
+				locname += ":";
+			}
+			locname += lt->first;
+			addLocation(locname,pos);
+			if (tr != 0)
+			{
+				tr->addVariable(lt->first,pos);
+			}
+			DEBUGX("template location %s",locname.c_str());
+		}
+		
+		std::map<AreaName, Shape>::iterator at;
+		Shape sh;
+		for (at = templ->getAreas().begin(); at != templ->getAreas().end(); ++at)
+		{
+			sh = at->second;
+			sh.m_angle += angle;
+			sh.m_center.rotate(angle);
+			sh.m_center += position;
+			
+			std::string aname;
+			if (name != "")
+			{
+				aname += name;
+				aname += ":";
+			}
+			aname += at->first;
+			
+			addArea(aname,sh);
+		}
+		
+		// Trigger der besagt dass das Template eingefuegt wurde
+		if (tr !=0)
+		{
+			insertTrigger(tr);
+		}
+	}
+	else
+	{
+		ERRORMSG("object group template %s not found",templname.c_str());
+	}
+}
+
+
+void Region::createMonsterGroup(MonsterGroupName mgname, Vector position, float radius, std::list<int>* monsters)
+{
+	MonsterGroup * mgroup = ObjectFactory::getMonsterGroup(mgname);
+
+	if (mgroup == 0)
+	{
+		SW_DEBUG("monster group %s not found",mgname.c_str());
+		return;
+	}
+
+	std::list<MonsterGroup::SubGroup>::iterator mt;
+	Vector pos;
+	float dx,dy;
+	
+	for (mt = mgroup->m_monsters.begin(); mt != mgroup->m_monsters.end(); ++mt)
+	{
+		int count =0;
+		for (int i=0; i< mt->m_number; i++)
+		{
+			pos = position;
+			do
+			{
+				dx = -radius + Random::randf(radius*2);
+				dy = -radius + Random::randf(radius*2);	
+			}
+			while (dx*dx+dy*dy > radius*radius);
+			
+			pos.m_x += dx;
+			pos.m_y += dy;	
+
+			if (Random::random() < mt->m_prob)
+			{
+				count ++;
+				int id = createObject(mt->m_subtype, pos,2*3.14159*Random::random());
+				DEBUGX("inserting monster %s at %f %f with id %i",mt->m_subtype.c_str(),pos.m_x, pos.m_y,id);
+				
+				if (monsters != 0)
+				{
+					monsters->push_back(id);
+				}
+			}
+		}
+		DEBUGX("monstergroup %s : %i x %s prob %f",mgname.c_str(), count, mt->m_subtype.c_str(), mt->m_prob);
+		
+	}
+}
+
+
+bool  Region::insertProjectile(Projectile* object, Vector pos)
+{
+	DEBUGX("projectile inserted: %s %i",object->getSubtype().c_str(), object->getId());
+	m_projectiles.insert(std::make_pair(object->getId(),object));
+	m_game_objects.insert(std::make_pair(object->getId(),object));
+	object->getShape()->m_center = pos;
+	object->setRegionId( m_id);
+
+	// NetEvent erzeugen: neues Projektil in der Region
+	NetEvent event;
+	event.m_type = NetEvent::PROJECTILE_CREATED;
+	event.m_id = object->getId();
+	insertNetEvent(event);
+
+	return true;
+}
+
+bool  Region::deleteObject (WorldObject* object)
+{
+	bool result = true;
+
+	if (object == 0)
+		return false;
+	
+	if (m_objects.count(object->getId()) == 0 && m_static_objects.count(object->getId()) == 0)
+	{
+		// Objekt nicht gefunden
+		return false;
+	}
+	
+	if (object->getType() != "PLAYER")
+	{
+		
+		NetEvent event;
+		event.m_type = NetEvent::OBJECT_DESTROYED;
+		event.m_id = object->getId();
+		insertNetEvent(event);
+		
+	}
+	
+	if (object->isCreature())
+	{
+		Creature* cr = dynamic_cast<Creature*>(object);
+		if (cr != 0 && cr->getDialogue() != 0)
+		{
+			cr->getDialogue()->removeSpeaker(object->getId());
+		}
+	}
+	
+	 // Aus dem Binärbaum loeschen
+	if (object->getState() != WorldObject::STATE_STATIC)
+	{
+		m_objects.erase(object->getId());
+		m_game_objects.erase(object->getId());
+	}
+	else
+	{
+		m_static_objects.erase(object->getId());
+	}
+
+	if (object->getType() == "PLAYER")
+	{
+		DEBUGX("Player deleted");
+		m_players.erase(object->getId());
+
+		
+		Trigger* tr = new Trigger("leave_region");
+		tr->addVariable("player", object->getId());
+		insertTrigger(tr);
+	}
+	
+	if (object->isLarge())
+	{
+		if (m_large_objects.count(object->getId()) == 0)
+		{
+			result = false;
+		}
+		else
+		{
+			m_large_objects.erase(object->getId());
+		}
+	}
+	else
+	{
+		// aus dem Grid loeschen
+		int x = object->getGridLocation()->m_grid_x;
+		int y = object->getGridLocation()->m_grid_y;
+		DEBUGX("deleting object in grid tile %i %i",x,y);
+	
+		if (object->getLayer() & WorldObject::LAYER_COLLISION)
+		{
+			Gridunit *gu = (m_data_grid.ind(x,y));
+			result = gu->deleteObject(object, object->getGridLocation()->m_index);
+		}
+	}
+
+	return result;
+}
+
+bool Region::deleteObject(int id)
+{
+	WorldObject* wo = getObject(id);
+	if (wo !=0)
+	{
+		return deleteObject(wo);
+	}
+	else
+	{
+		SW_DEBUG("no object with id %i",id);
+	}
+	return false;
+}
+
+bool Region::moveObject(WorldObject* object, Vector pos)
+{
+	bool result = true;
+	// Wenn NULL Zeiger übergeben -> Fehler anzeigen
+	if (object == 0)
+		return false;
+	
+	if (object->getState() == WorldObject::STATE_STATIC)
+	{
+		ERRORMSG("Cant move static object %s",object->getNameId().c_str());
+		return false;
+	}
+	
+	// grosse Objekte werden einfach verschoben (da sie nicht in der Gridunit sind)
+	if (object->isLarge())
+	{
+		object->getShape()->m_center = pos;
+		return true;
+	}
+	
+	if (object->getLayer() == WorldObject::LAYER_NOCOLLISION)
+	{
+		object->getShape()->m_center = pos;
+		return true;
+	}
+
+	// Testen ob das Objekt innerhalb des 4*4 Grid in ein neues Feld kommt
+	int x_old = object->getGridLocation()->m_grid_x;
+	int y_old = object->getGridLocation()->m_grid_y;
+	int x_new = (int) floor(0.25*pos.m_x);
+	int y_new = (int) floor(0.25*pos.m_y);
+
+	if (x_old == x_new && y_old == y_new)
+	{
+		object->getShape()->m_center = pos;
+		return true;
+	}
+	// Testen ob das Objekt in der Region liegt
+	if (x_new<0 || y_new<0 || x_new>=m_dimx || y_new>=m_dimy)
+	{
+		return false;
+	}
+	else
+	{
+		//DEBUG ("Moved object to [%d] x [%d] ; in region sized %d x %d", x_new, y_new, m_dimx, m_dimy);
+		Gridunit *gu = &(m_data_grid)[x_old][y_old];
+		result =gu->deleteObject(object, object->getGridLocation()->m_index);
+		if (result == false)
+		{
+			ERRORMSG("failed to remove object %i from gridunit %i %i",object->getId(),x_old, y_old);
+		}
+
+		gu = &(m_data_grid)[x_new][y_new];
+		result = gu->insertObject(object);
+		if (result == false)
+		{
+			ERRORMSG("failed to insert object %i into gridunit %i %i",object->getId(),x_old, y_old);
+		}
+
+
+		object->getGridLocation()->m_grid_x=x_new;
+		object->getGridLocation()->m_grid_y=y_new;
+
+		object->getShape()->m_center = pos;
+	}
+
+	return result;
+}
+
+
+bool Region::changeObjectGroup(WorldObject* object,WorldObject::Group group )
+{
+	bool result = true;
+
+	if (!object->isLarge())
+	{
+		int x = object->getGridLocation()->m_grid_x;
+		int y = object->getGridLocation()->m_grid_y;
+		DEBUGX("changing object in grid tile %i %i",x,y);
+	
+		Gridunit *gu = (m_data_grid.ind(x,y));
+		result = gu->moveObject(object,group);
+	}
+
+	return result;
+
+}
+
+bool Region::changeObjectLayer(WorldObject* object,WorldObject::Layer layer)
+{
+	short oldlayer = object->getLayer();
+	if (oldlayer == layer)
+		return true;
+	
+	bool result = true;
+	
+	if (oldlayer == WorldObject::LAYER_NOCOLLISION)
+	{
+		// Einfuegen in das Grid
+		Vector pos = object->getShape()->m_center;
+
+	 	// Einfuegen in das Grid
+		int x_g = (int) floor(0.25*pos.m_x);
+		int y_g = (int) floor(0.25*pos.m_y);
+		object->getGridLocation()->m_grid_x = x_g;
+		object->getGridLocation()->m_grid_y = y_g;
+
+
+	 	// Testen ob das Objekt in der Region liegt
+		if (x_g<0 || y_g<0 || x_g>=m_dimx || y_g>=m_dimy)
+		{
+			DEBUGX("create Object at %f %f",pos.m_x, pos.m_y);
+			return false;
+		}
+		else
+		{
+			if (object->isLarge())
+			{
+				DEBUGX("object %s is large",object->getName().c_str());
+				m_large_objects.insert(std::make_pair(object->getId(),object));
+				result = true;
+			}
+			else
+			{
+				Gridunit *gu = (m_data_grid.ind(x_g,y_g));
+
+				result = gu->insertObject(object);
+				DEBUGX("insert into grid %i %i",x_g,y_g);
+			}
+		}
+	}
+	
+	if (layer == WorldObject::LAYER_NOCOLLISION)
+	{
+		if (object->isLarge())
+		{
+			if (m_large_objects.count(object->getId()) == 0)
+			{
+				result = false;
+			}
+			else
+			{
+				m_large_objects.erase(object->getId());
+			}
+		}
+		else
+		{
+			// aus dem Grid loeschen
+			int x = object->getGridLocation()->m_grid_x;
+			int y = object->getGridLocation()->m_grid_y;
+			DEBUGX("deleting object in grid tile %i %i",x,y);
+			
+			Gridunit *gu = (m_data_grid.ind(x,y));
+			result = gu->deleteObject(object, object->getGridLocation()->m_index);
+			
+		}
+	}
+	
+	return result;
+}
+
+
+void Region::deleteProjectile(Projectile* proj)
+{
+	if (proj ==0)
+		return;
+	
+	int id = proj->getId();
+
+	if (m_projectiles.count(id)!=0)
+	{
+		m_projectiles.erase(m_projectiles.find(id));
+		DEBUGX("projectile deleted: %s %i",proj->getSubtype().c_str(), proj->getId());
+	}
+	m_game_objects.erase(id);
+}
+
+void Region::update(float time)
+{
+	DEBUGX("update region %i",getId());
+
+	DEBUGX("\nUpdate aller WeltObjekte starten\n");
+	//DEBUG("m_players %p",m_players);
+	// Iterator zum durchmustern einer solchen Liste
+	WorldObjectMap::iterator iter;
+	WorldObject* object;
+	ProjectileMap::iterator it3;
+
+	// clear the list of sounds from the previous update
+	for (std::list<PlayedSound*>::iterator it = m_played_sounds.begin(); it != m_played_sounds.end(); ++it)
+	{
+		delete *it;
+	}
+	m_played_sounds.clear();
+	
+	
+	// Durchmustern aller WorldObjects
+	for (iter =m_objects.begin(); iter!=m_objects.end(); )
+	{
+		object = iter->second;
+
+		if (object->getDestroyed()==true)
+		{
+			// Objekte selbststaendig loeschen darf nur der Server
+			if (World::getWorld()->isServer())
+			{
+				// nur Nichtspieler Objekte loeschen
+				if (object->getType() != "PLAYER")
+				{
+					DEBUGX("Objekt gelöscht: %i \n",object->getId());
+					
+					++iter;
+					object->destroy();
+					bool succ = deleteObject(object);
+					if (succ)
+					{
+						delete object;
+						continue;
+					}
+				}
+				else
+					++iter;
+			}
+			else
+			{
+				++iter;
+			}
+		}
+		else
+		{
+			++iter;
+		}
+
+	}
+	
+	for (iter =m_objects.begin(); iter!=m_objects.end(); ++iter)
+	{
+		object = iter->second;
+		if (object->getDestroyed()!=true)
+		{
+			// Polymorpher Funktionsaufruf
+			object->update(time);
+		}
+	}
+	DEBUGX("Update aller WeltObjekte abgeschlossen\n\n");
+
+	// alle Projektile updaten
+	Projectile* pr =0;
+
+	for (it3 = m_projectiles.begin(); it3 !=m_projectiles.end();)
+	{
+		pr = (it3->second);
+		DEBUGX("projectile %i",pr->getId());
+		if (pr->getDestroyed()==true)
+		{
+			// Projektile selbststaendig loeschen darf nur der Server
+			if (World::getWorld()->isServer())
+			{
+				
+				NetEvent event;
+				event.m_type = NetEvent::PROJECTILE_DESTROYED;
+				event.m_id = pr->getId();
+				insertNetEvent(event);
+				
+				DEBUGX("deleting projectile %i",pr->getId());
+				
+				++it3;
+				deleteProjectile(pr);
+				delete pr;
+				DEBUGX("loesche projektil");
+			}
+			else
+			{
+			 	++it3;
+			}
+
+		}
+		else
+		{
+			pr->update(time);
+			++it3;
+		}
+	}
+	DEBUGX("update projektile abgeschlossen");
+
+	// DropItems updaten
+	DropItemMap::iterator it4;
+	for (it4 = m_drop_items.begin(); it4 != m_drop_items.end(); ++it4)
+	{
+		it4->second->update(time);
+	}
+
+	if (World::getWorld()->isServer())
+	{
+		// NetEvents fuer geaenderte Objekte / Projektile erzeugen
+		for (iter =m_objects.begin(); iter!=m_objects.end(); ++iter)
+		{
+			object = iter->second;
+
+			// NetEvents durch Spieler werden global behandelt, daher hier nicht beruecksichtigen
+			if (object->getType() == "PLAYER")
+			{
+				continue;
+			}
+
+			if (object->getNetEventMask() !=0)
+			{
+				DEBUGX("object %i has event mask %i",object->getId(), object->getNetEventMask());
+				NetEvent event;
+				event.m_type = NetEvent::OBJECT_STAT_CHANGED;
+				event.m_data = object->getNetEventMask();
+				event.m_id = object->getId();
+				insertNetEvent(event);
+				
+				object->clearNetEventMask();
+			}
+		}
+
+		for (it3 = m_projectiles.begin(); it3 !=m_projectiles.end();++it3)
+		{
+			pr = (it3->second);
+			if (pr->getNetEventMask() !=0)
+			{
+				NetEvent event;
+				event.m_type = NetEvent::PROJECTILE_STAT_CHANGED;
+				event.m_data = pr->getNetEventMask();
+				event.m_id = pr->getId();
+				insertNetEvent(event);
+				
+				pr->clearNetEventMask();
+			}
+		}
+	}
+
+	// pruefen ob ein Spieler die Region verlassen hat
+	bool del = false;
+	for (iter = m_players.begin(); iter != m_players.end(); )
+	{
+		// Schleife ueber die Ausgaenge
+		std::list<RegionExit>::iterator eit;
+		for (eit = m_exits.begin(); eit != m_exits.end(); ++eit)
+		{
+			if (iter->second->getShape()->intersects(eit->m_shape))
+			{
+				// Spieler befindet sich im Ausgang
+				// ID der neuen Region
+				int id = World::getWorld()->getRegionId(eit->m_destination_region);
+
+				WorldObjectMap::iterator iter2 = iter;
+				++iter;
+				del = true;
+
+				// Spieler aus der Region entfernen
+				WorldObject* pl = iter2->second;
+				deleteObject(pl);
+
+				// Spieler in die neue Region einfuegen
+				World::getWorld()->insertPlayerIntoRegion(pl, id, eit->m_destination_location);
+
+				break;
+			}
+		}
+
+
+		if (del == false)
+		{
+
+			// Pruefen ob der Spieler getoetet wurde
+			if (iter->second->getState() == WorldObject::STATE_DEAD)
+			{
+				// Lebenspunkte wieder fuellen etc
+				Player* pl = static_cast<Player*>(iter->second);
+				pl->revive();
+
+				// Zielpunkt ermitteln
+				RegionLocation regloc = pl->getRevivePosition();
+				int id = World::getWorld()->getRegionId(regloc.first);
+
+				if (id == getId())
+				{
+					DEBUGX("revive in current region");
+					// Spieler bleibt in der aktuellen Region
+					Vector pos = getLocation(regloc.second);
+					getFreePlace(pl->getShape(), pl->getLayer(), pos, pl);
+
+					pl->moveTo(pos);
+				}
+				else
+				{
+					DEBUGX("revive in other region %i ", id);
+
+					// Spieler verlaesst die Region
+					WorldObjectMap::iterator iter2 = iter;
+					++iter;
+					del = true;
+
+					// Spieler aus der Region entfernen
+					deleteObject(pl);
+
+					// Spieler in die neue Region einfuegen
+					World::getWorld()->insertPlayerIntoRegion(pl, id, regloc.second);
+				}
+			}
+
+			if (del == false)
+				++iter;
+		}
+		del = false;
+	}
+	
+	// Spieler die die Region per Wegpunkt verlassen bearbeiten
+	std::map<int,RegionLocation>::iterator wt;
+	for (wt = m_teleport_players.begin(); wt != m_teleport_players.end(); ++wt)
+	{
+		Player* pl = static_cast<Player*>(getObject (wt->first));
+		
+		// Spieler aus der Region entfernen
+		deleteObject(pl);
+
+		// Spieler in die neue Region einfuegen
+		int id = World::getWorld()->getRegionId(wt->second.first);
+		World::getWorld()->insertPlayerIntoRegion(pl, id, wt->second.second);
+	}
+	m_teleport_players.clear();
+	
+	// Trigger & Events abarbeiten
+	// Zeitverzoegerte Trigger
+	std::list<std::pair<float, Trigger*> > ::iterator tit, tjt;
+	for (tit = tjt = m_timed_trigger.begin(); tjt != m_timed_trigger.end(); )
+	{
+		tit = tjt;
+		++tjt;
+		
+		tit->first -= time;
+		if (tit->first<=0)
+		{
+			insertTrigger(tit->second);
+			m_timed_trigger.erase(tit);
+		}
+	}
+	
+	// Schleife ueber die Trigger
+	std::multimap<TriggerType, Event*>::iterator it, itend, jt;
+	
+	while (!m_triggers.empty())
+	{
+		EventSystem::setRegion(this);
+		TriggerType type;
+		type = m_triggers.front()->getType();
+		
+		DEBUGX("trigger: %s",type.c_str());
+		
+		// Schleife ueber die ausgeloesten Events
+		it = m_events.lower_bound(type);
+		itend = m_events.upper_bound(type);
+		while (it != itend)
+		{
+			jt = it;
+			++it;
+			
+			// vom Trigger definierte Variablen einfuegen
+			EventSystem::doString((char*) m_triggers.front()->getLuaVariables().c_str());
+			DEBUGX("lua code \n %s",m_triggers.front()->getLuaVariables().c_str());
+			
+			// ggf Dialog setzen
+			if (m_triggers.front()->getDialogueId() != 0)
+			{
+				EventSystem::setDialogue( getDialogue( m_triggers.front()->getDialogueId() ) );
+			}
+				
+			// Event ausfuehren
+			bool ret = EventSystem::executeEvent(jt->second);
+			
+			if (ret)
+			{
+				DEBUGX("event on trigger: %s",type.c_str());
+			}
+			
+			// einmalige Ereignisse loeschen, wenn erfolgreich ausgefuehrt
+			if (jt->second->getOnce() &&  ret)
+			{
+				delete jt->second;
+				m_events.erase(jt);
+			}
+			
+		}
+		
+		// Objektbezogene Events ausloesen
+		int id = m_triggers.front()->getObjectId();
+		if (id != 0)
+		{
+			ScriptObject* so = dynamic_cast<ScriptObject*>(getObject(id));
+			if (so != 0)
+			{
+				so->activateTrigger(m_triggers.front());
+			}
+		}
+		
+		delete m_triggers.front();
+		m_triggers.pop_front();
+	}
+	
+	// update der Dialoge
+	if (World::getWorld()->isServer())
+	{
+		std::map<int, Dialogue*>::iterator it5;
+		Dialogue* dia;
+		for (it5 = m_dialogues.begin(); it5!= m_dialogues.end(); )
+		{
+			EventSystem::setDialogue(it5->second);
+			
+			it5->second->update(time);
+			
+			if (it5->second->isFinished())
+			{
+				dia = it5->second;
+				++it5;
+				deleteDialogue(dia);
+			}
+			else 
+			{
+				if (it5->second->getEventMaskRef() != 0)
+				{
+					DEBUGX("update dialogue %i",it5->second->getId());
+					NetEvent event;
+					event.m_type = NetEvent::DIALOGUE_STAT_CHANGED;
+					event.m_data = it5->second->getEventMaskRef();
+					event.m_id = it5->second->getId();
+					insertNetEvent(event);
+					it5->second->clearNetEventMask();
+				}
+				++it5;
+			}
+		}
+		EventSystem::setDialogue(0);
+	}
+	
+	m_camera.update(time);
+	m_light.update(time);
+	
+	// Schadensanzeigen aktualisieren
+	std::map<int,FloatingText*>::iterator dit;
+	for (dit = m_floating_texts.begin(); dit != m_floating_texts.end(); )
+	{
+		dit->second->m_time -= time;
+		if (dit->second->m_time <= 0)
+		{
+			delete dit->second;
+			m_floating_texts.erase(dit++);
+		}
+		else
+		{
+			++dit;
+		}
+	}
+}
+
+void Region::getRegionData(CharConv* cv)
+{
+	// Dimension des Feldes angeben
+	cv->toBuffer((short) m_dimx);
+	cv->toBuffer((short) m_dimy);
+
+	// Name der Region
+	cv->toBuffer(m_name);
+
+	cv->toBuffer(m_ground_material);
+	
+
+	// Anzahl der statischen Objekte eintragen
+	DEBUGX("static objects: %i",m_static_objects.size());
+	cv->toBuffer((short) m_static_objects.size());
+
+	// statische Objekte in den Puffer eintragen
+	WorldObjectMap::iterator it;
+	for (it = m_static_objects.begin();it!=m_static_objects.end();++it)
+	{
+		(it->second)->toString(cv);
+		DEBUGX("static object: %s",(it->second)->getNameId().c_str());
+	}
+
+
+	// Anzahl der nicht  statischen Objekte eintragen
+	WorldObjectMap::iterator jt;
+	short nr=0;
+	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
+	{
+		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
+			nr++;
+	}
+	DEBUGX("nonstatic objects: %i",nr);
+	cv->toBuffer((short) nr);
+
+	// nicht statische Objekte in den Puffer eintragen
+
+	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
+	{
+		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
+		{
+			DEBUGX("write offset: %i",cv->writeBits());
+			(jt->second)->toString(cv);
+
+			DEBUGX("object: %s",(jt->second)->getNameId().c_str());
+		}
+	}
+
+	// Anzahl der Projektile eintragen
+	cv->toBuffer((short) m_projectiles.size());
+	DEBUGX("projectiles: %i",m_projectiles.size());
+
+	// Projektile in den Puffer eintragen
+	ProjectileMap::iterator kt;
+	for (kt = m_projectiles.begin(); kt != m_projectiles.end(); ++kt)
+	{
+		kt->second->toString(cv);
+	}
+
+	cv->toBuffer((short) m_drop_items.size());
+	DEBUGX("dropped items: %i",m_drop_items.size());
+
+	//  Items in den Puffer eintragen
+	DropItemMap::iterator lt;
+	for (lt = m_drop_items.begin(); lt != m_drop_items.end(); ++lt)
+	{
+		lt->second->toString(cv);
+	}
+	
+	// Dialoge eintragen
+	std::map<int, Dialogue*>::iterator dt;
+	cv->toBuffer((short) m_dialogues.size());
+	for (dt = m_dialogues.begin(); dt != m_dialogues.end(); ++dt)
+	{
+		dt->second->toString(cv);
+	}
+	
+	// Musik
+	writeMusicTracksToString(cv);
+	
+	// Cutscene modus
+	cv->toBuffer(m_cutscene_mode);
+	getCamera().toString(cv);
+	
+	// Licht
+	m_light.toString(cv);
+	
+	// Untergrund
+	cv->toBuffer(m_ground_material);
+	
+	
+}
+
+
+void Region::createObjectFromString(CharConv* cv, WorldObjectMap* players)
+{
+	WorldObject::Type type;
+	WorldObject::Subtype subt;
+	int id;
+
+	WorldObject* obj;
+
+	DEBUGX("read offset: %i",cv->readBits());
+
+	cv->fromBuffer(type);
+	cv->fromBuffer(subt);
+	cv->fromBuffer(id);
+	
+	DEBUGX("read offset: %i",cv->readBits());
+
+	DEBUGX("object %s id %i",subt.c_str(),id);
+
+	// alle Objekte ausser den Spielern werden neu angelegt
+	// die Spieler existieren schon
+	if (type != "PLAYER")
+	{
+		obj = ObjectFactory::createObject(type, subt,id);
+	}
+	else
+	{
+		if (players->count(id) ==0)
+		{
+			ERRORMSG("player (%s) with id %i does not exist",subt.c_str(),id);
+		}
+		obj = (*players)[id];
+	}
+
+	if (obj==0)
+	{
+		ERRORMSG("failed to create Object %s",subt.c_str());
+	}
+	
+	obj->fromString(cv);
+
+	WorldObject* oldobj = getObject(obj->getId());
+	if (oldobj != 0)
+	{
+		SW_DEBUG("Object %i already exists",oldobj->getId());
+		oldobj->destroy();
+		deleteObject(oldobj);
+		delete oldobj;
+	}
+	insertObject(obj,obj->getShape()->m_center,obj->getShape()->m_angle);
+}
+
+
+void Region::createProjectileFromString(CharConv* cv)
+{
+
+	GameObject::Type type;
+	GameObject::Subtype subt;
+	int id;
+	Projectile* proj;
+
+	cv->fromBuffer(type);
+	cv->fromBuffer(subt);
+	cv->fromBuffer(id);
+
+	DEBUGX("new projectile %s  id %i",subt.c_str(),id);
+
+	proj = ObjectFactory::createProjectile(subt,id);
+
+	proj->fromString(cv);
+
+	Projectile* oldproj = getProjectile(proj->getId());
+	if (oldproj != 0)
+	{
+		SW_DEBUG("Projectile %i already exists",oldproj->getId());
+		deleteProjectile(oldproj);
+		delete oldproj;
+	}
+	insertProjectile(proj,proj->getShape()->m_center);
+}
+
+void Region::createItemFromString(CharConv* cv)
+{
+	GameObject::Type type;
+	GameObject::Subtype subt;
+	int id;
+	
+	cv->fromBuffer(type);
+	cv->fromBuffer(subt);
+	cv->fromBuffer(id);
+	
+	DEBUGX("got Item %i %s %s",id,type.c_str(),subt.c_str());
+	
+	DropItem* di = new DropItem(id);
+	di->fromString(cv);
+
+	if (m_drop_items.count(id) >0)
+	{
+		DEBUGX("Item %i already exists",di->getId());
+		deleteItem(id);
+	}
+	m_drop_items.insert(std::make_pair(id,di));
+	m_drop_item_locations.insert(std::make_pair(di->getLocationId(),di));
+	m_game_objects.insert(std::make_pair(di->getId(),di));
+}
+
+void Region::createDialogueFromString(CharConv* cv)
+{
+	int id;
+	cv->fromBuffer(id);
+	
+	if (m_dialogues.count(id) >0)
+	{
+		SW_DEBUG("Dialogue %i already exists",id);
+		deleteDialogue(m_dialogues[id]);
+	}	
+	
+	Dialogue* dia = new Dialogue(this,"",id);
+	dia->fromString(cv);
+	insertDialogue(dia);
+	
+}
+
+void Region::setRegionData(CharConv* cv,WorldObjectMap* players)
+{	
+	// Groesse der Region wird schon vorher eingelesen
+
+	// Name der Region
+	
+	cv->fromBuffer(m_name);
+	cv->fromBuffer(m_ground_material);
+
+
+	// alle bisherigen statischen Objekte entfernen
+	WorldObjectMap::iterator it, itnext;
+	for (it = m_static_objects.begin();it!=m_static_objects.end();++it)
+	{
+		itnext = it;
+		++itnext;
+		
+		it->second->destroy();
+		deleteObject(it->second);
+		delete it->second;
+		
+		it = itnext;
+	}
+	m_static_objects.clear();
+
+	// alle bisherigen nichtstatischen Objekte entfernen
+	// die SpielerObjekte bleiben erhalten, alle anderen werden geloescht
+	WorldObjectMap::iterator jt, jtnext;
+	for (jt = m_objects.begin();jt!=m_objects.end();)
+	{
+		jtnext = jt;
+		++jtnext;
+		if (jt->second->getType() != "PLAYER")
+		{
+			jt->second->destroy();
+			deleteObject(jt->second);
+			delete jt->second;
+		}
+		jt = jtnext;
+	}
+	m_objects.clear();
+	m_players.clear();
+	
+	// DropItems loeschen
+	DropItemMap::iterator k;
+	for (k =  m_drop_items.begin(); k != m_drop_items.end(); ++k)
+	{
+		if (k->second->getItem() !=0)
+		{
+			delete k->second->getItem();
+		}
+		m_game_objects.erase(k->second->getId());
+		delete k->second;
+	}
+	m_drop_items.clear();
+	
+	std::list<Trigger*>::iterator l;
+	for (l = m_triggers.begin(); l != m_triggers.end(); ++l)
+	{
+		delete *l;
+	}
+	m_triggers.clear();
+
+	// statische Objekte einlesen
+	short nr_stat;
+	cv->fromBuffer(nr_stat);
+	DEBUGX("static objects: %i",nr_stat);
+
+	for (int i=0; i<nr_stat;i++)
+	{
+		createObjectFromString(cv,players);
+	}
+
+
+
+	// neue Objekte einlesen
+	short nr_nonstat;
+	cv->fromBuffer(nr_nonstat);
+	DEBUGX("nonstatic objects: %i",nr_nonstat);
+
+	for (int i=0; i<nr_nonstat;i++)
+	{
+		createObjectFromString(cv,players);
+	}
+
+
+	// Anzahl der Projektile einlesen
+	short nr_proj;
+	cv->fromBuffer(nr_proj);
+	DEBUGX("projectiles: %i",nr_proj);
+	// Projektile einlesen
+	for (int i=0; i<nr_proj;i++)
+	{
+		createProjectileFromString(cv);
+	}
+
+	// Anzahl Gegenstaende einlesen
+	short nr_items;
+	cv->fromBuffer(nr_items);
+	DEBUGX("items: %i",nr_items);
+	// Gegenstaende einlesen
+	for (int i=0; i<nr_items;i++)
+	{
+		createItemFromString(cv);
+	}
+	
+	// Dialoge einlesen
+	short nr_dia;
+	cv->fromBuffer(nr_dia);
+	for (int i=0; i< nr_dia; i++)
+	{
+		createDialogueFromString(cv);
+	}
+	
+	// Musik
+	readMusicTracksFromString(cv);
+
+	// Cutscene modus
+	cv->fromBuffer(m_cutscene_mode);
+	getCamera().fromString(cv);
+	
+	// Licht
+	m_light.fromString(cv);
+	
+	// Untergrund
+	cv->fromBuffer(m_ground_material);
+	
+}
+
+void Region::getRegionCheckData(CharConv* cv)
+{
+
+
+	// Anzahl der nicht  statischen Objekte eintragen
+	WorldObjectMap::iterator jt;
+	short nr=0;
+	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
+	{
+		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
+			nr++;
+	}
+	DEBUGX("nonstatic objects: %i",nr);
+	cv->toBuffer((short) nr);
+
+	// nicht statische Objekte in den Puffer eintragen
+
+	for (jt = m_objects.begin();jt!=m_objects.end();++jt)
+	{
+		if (jt->second->getLayer() & WorldObject::LAYER_ALL)
+		{
+			cv->toBuffer((jt->second)->getId());
+			DEBUGX("object: %s",(jt->second)->getNameId().c_str());
+		}
+	}
+
+	// Anzahl der Projektile eintragen
+	cv->toBuffer((short) m_projectiles.size());
+	DEBUGX("projectiles: %i",m_projectiles.size());
+
+	// Projektile in den Puffer eintragen
+	ProjectileMap::iterator kt;
+	for (kt = m_projectiles.begin(); kt != m_projectiles.end(); ++kt)
+	{
+		cv->toBuffer((kt->second)->getId());
+	}
+
+	cv->toBuffer((short) m_drop_items.size());
+	DEBUGX("dropped items: %i",m_drop_items.size());
+
+	//  Items in den Puffer eintragen
+	DropItemMap::iterator lt;
+	for (lt = m_drop_items.begin(); lt != m_drop_items.end(); ++lt)
+	{
+		cv->toBuffer((lt->second)->getId());
+	}
+	
+	// Cutscene modus
+	cv->toBuffer(m_cutscene_mode);
+}
+
+void Region::checkRegionData(CharConv* cv)
+{
+	short nr;
+	std::set<int> objects;
+	int id;
+	
+	WorldObject* wo;
+	Projectile* pr;
+	DropItem* di;
+	
+	static std::set<int> objectstodelete;
+	static std::set<int> objectsmissing;
+	static std::set<int> projtodelete;
+	static std::set<int> projmissing;
+	static std::set<int> itemtodelete;
+	static std::set<int> itemmissing;
+	static std::set<int>::iterator setit;
+	
+	// Objekte die nach dem letzten Check fraglich waren loeschen
+	// bzw neu anfordern
+	WorldObjectList::iterator wit;
+	WorldObjectMap::iterator it;
+	
+	// WorldObjects
+	for (setit = objectstodelete.begin(); setit != objectstodelete.end(); ++setit)
+	{
+		wo = getObject((*setit));
+		if (wo != 0)
+		{
+			WARNING("object %i does not exist at server",wo->getId());
+			deleteObject(wo);
+			if (wo->getType() != "PLAYER")
+			{
+				wo->destroy();
+				delete wo;
+			}
+		}
+	}
+	for (setit = objectsmissing.begin(); setit != objectsmissing.end(); ++setit)
+	{
+		wo = getObject((*setit));
+		if (wo ==0)
+		{
+			WARNING("object %i is missing",(*setit));
+			// fehlende Daten zur Region anfordern
+			PackageHeader header;
+			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
+			header.m_number =1;
+
+			ClientDataRequest datareq;
+			datareq.m_data = ClientDataRequest::OBJECT;
+			datareq.m_id = *setit;
+			datareq.m_region_id = getId();
+
+			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
+			header.toString(msg);
+			datareq.toString(msg);
+
+			World::getWorld()->getNetwork()->pushSlotMessage(msg);
+			World::getWorld()->getNetwork()->deallocatePacket(msg);
+		}
+	}
+	
+	// Projektile
+	for (setit = projtodelete.begin(); setit != projtodelete.end(); ++setit)
+	{
+		pr = getProjectile(*setit);
+		if (pr != 0)
+		{
+			WARNING("projectile %i does not exist at server",pr->getId());
+			deleteProjectile(pr);
+			delete pr;
+		}
+	}
+	for (setit = projmissing.begin(); setit != projmissing.end(); ++setit)
+	{
+		pr = getProjectile(*setit);
+		if (pr ==0)
+		{
+			WARNING("projectile %i is missing",(*setit));
+			// fehlende Daten zur Region anfordern
+			PackageHeader header;
+			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
+			header.m_number =1;
+
+			ClientDataRequest datareq;
+			datareq.m_data = ClientDataRequest::PROJECTILE;
+			datareq.m_id = *setit;
+			datareq.m_region_id = getId();
+
+			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
+			
+			header.toString(msg);
+			datareq.toString(msg);
+
+			World::getWorld()->getNetwork()->pushSlotMessage(msg);
+			World::getWorld()->getNetwork()->deallocatePacket(msg);
+		}
+	}
+	
+	// DropItem
+	for (setit = itemtodelete.begin(); setit != itemtodelete.end(); ++setit)
+	{
+		di = getDropItem(*setit);
+		if (di != 0)
+		{
+			WARNING("dropitem %i does not exist at server",di->getId());
+			deleteItem(di->getId(), true);
+		}
+	}
+	for (setit = itemmissing.begin(); setit != itemmissing.end(); ++setit)
+	{
+		di = getDropItem(*setit);
+		if (di ==0)
+		{
+			WARNING("dropitem %i is missing",(*setit));
+			// fehlende Daten zur Region anfordern
+			PackageHeader header;
+			header.m_content = PTYPE_C2S_DATA_REQUEST; 	// Data Request von Client zu Server
+			header.m_number =1;
+
+			ClientDataRequest datareq;
+			datareq.m_data = ClientDataRequest::ITEM;
+			datareq.m_id = *setit;
+			datareq.m_region_id = getId();
+
+			NetworkPacket* msg = World::getWorld()->getNetwork()->createPacket();
+			
+			header.toString(msg);
+			datareq.toString(msg);
+
+			World::getWorld()->getNetwork()->pushSlotMessage(msg);	
+			World::getWorld()->getNetwork()->deallocatePacket(msg);
+		}
+	}
+	
+	
+	objectstodelete.clear();
+	objectsmissing.clear();
+	projtodelete.clear();
+	projmissing.clear();
+	itemtodelete.clear();
+	itemmissing.clear();
+	
+	
+	
+	cv->fromBuffer(nr);
+	DEBUGX("nonstatic Objects %i",nr);
+	for (int i=0; i<nr; i++)
+	{
+		cv->fromBuffer(id);
+		objects.insert(id);
+		
+		if (m_objects.count(id) ==0)
+		{
+			// Objekt fehlt beim Client
+			objectsmissing.insert(id);
+		}
+	}
+	
+	for (it = m_objects.begin();it!=m_objects.end();++it)
+	{
+		wo = it->second;
+		if (objects.count(wo->getId()) ==0)
+		{
+			// Objekt ist beim Client zu viel
+			objectstodelete.insert(wo->getId());
+		}
+	}
+	
+	objects.clear();
+	
+	cv->fromBuffer(nr);
+	ProjectileMap::iterator kt;
+	
+	DEBUGX("projectiles %i",nr);
+	for (int i=0; i<nr; i++)
+	{
+		cv->fromBuffer(id);
+		objects.insert(id);
+		
+		if (m_projectiles.count(id) ==0)
+		{
+			// Objekt fehlt beim Client
+			projmissing.insert(id);
+		}
+	}
+	
+	for (kt = m_projectiles.begin(); kt!=m_projectiles.end();++kt)
+	{
+		pr = kt->second;
+		if (objects.count(pr->getId()) ==0)
+		{
+			// Objekt ist beim Client zu viel
+			projtodelete.insert(pr->getId());
+		}
+	}
+	
+	objects.clear();
+	
+	cv->fromBuffer(nr);
+	DropItemMap::iterator lt;
+	
+	DEBUGX("dropitems %i",nr);
+	for (int i=0; i<nr; i++)
+	{
+		cv->fromBuffer(id);
+		objects.insert(id);
+		
+		if (m_drop_items.count(id) ==0)
+		{
+			// Objekt fehlt beim Client
+			itemmissing.insert(id);
+		}
+	}
+	
+	for (lt = m_drop_items.begin(); lt!=m_drop_items.end();++lt)
+	{
+		di = lt->second;
+		if (objects.count(di->getId()) ==0)
+		{
+			// Objekt ist beim Client zu viel
+			itemtodelete.insert(di->getId());
+		}
+	}
+}
+
+void Region::writeMusicTracksToString(CharConv* cv)
+{
+	cv->toBuffer((short) m_music_tracks.size());
+	std::list<MusicTrack>::iterator mt;
+	for (mt = m_music_tracks.begin(); mt != m_music_tracks.end(); ++mt)
+	{
+		cv->toBuffer(*mt);
+	}
+}
+
+void Region::readMusicTracksFromString(CharConv* cv)
+{
+	clearMusicTracks();
+	
+	short nr;
+	cv->fromBuffer(nr);
+	std::string music;
+	for (int i=0; i<nr; i++)
+	{
+		cv->fromBuffer(music);
+		addMusicTrack(music);
+	}
+}
+
+
+bool  Region::dropItem(Item* item, Vector pos)
+{
+	DEBUGX("drop %s %i",item->m_subtype.c_str(), item->m_id);
+	// Menge der bereits getesteten Felder
+	std::set<int> tfields;
+
+	// Schlange mit zu testenden Feldern
+	std::queue<int> fields;
+
+	// Position in 0.5 x 0.5 Feldern
+	int sx = (int) (pos.m_x*2);
+	int sy = (int) (pos.m_y*2);
+	int i;
+	fields.push(sx*10000+sy);
+
+  	// true, solange alle Felder von festen Objekten blockiert sind
+	bool fixblock = true;
+	
+	// Flaeche auf die das Item gedroppt wird
+	Shape s;
+	s.m_type= Shape::RECT;
+	s.m_extent = Vector(0.5,0.5);
+
+
+	WorldObjectList res;
+
+	// eine Stelle suchen an der das Item fallen gelassen werden kann
+	while (!fields.empty())
+	{
+		// erstes Feld aus der Queue nehmen
+		i = fields.front();
+		sx = i /10000;
+		sy = i %10000;
+		fields.pop();
+
+		DEBUGX("testing field %i %i",sx,sy);
+
+		// Testen ob dort keine festen Objekte sind
+		s.m_center = Vector(sx*0.5, sy*0.5);
+
+
+		res.clear();
+		getObjectsInShape(&s,&res,WorldObject::LAYER_BASE,WorldObject::FIXED,0,true);
+
+		if (!res.empty())
+		{
+			// Objekt im Weg
+			res.clear();
+
+			// wenn alle bisherigen Plaetze von festen Objekten blockiert warten trotzdem weitersuchen
+			if (!fixblock)
+				continue;
+		}
+		else
+		{
+			fixblock = false;
+		}
+
+		// Testen, ob dort nicht schon ein Item liegt
+		if (!fixblock && m_drop_item_locations.find(i) == m_drop_item_locations.end())
+		{
+			DEBUGX("field is free");
+			// Stelle ist frei
+			// Item einfuegen
+			DropItem* di = new DropItem(item);
+			di->setPosition(Vector(sx/2.0f, sy/2.0f));
+			DEBUGX("dropped item %i", sx*10000+sy);
+			
+			m_drop_items.insert(std::make_pair(di->getId(),di));
+			m_drop_item_locations.insert(std::make_pair(i,di));
+			m_game_objects.insert(std::make_pair(di->getId(),di));
+
+			DEBUGX("items dropped at %f %f locID %i %p",sx/2.0f,sy/2.0f, di->getLocationId(),item);
+
+			if (World::getWorld()->isServer())
+			{
+				
+				NetEvent event;
+				event.m_type = NetEvent::ITEM_DROPPED;
+				event.m_id = di->getId();
+
+				insertNetEvent(event);
+				
+			}
+
+			return true;
+
+		}
+		else
+		{
+			// an der Stelle liegt bereits ein Item
+			tfields.insert(i);
+
+			// Nachbarfelder in die Liste der zu untersuchenden Felder einfuegen
+			if (sx>0)
+			{
+				i = (sx-1)*10000+sy;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sy>0)
+			{
+				i = (sx)*10000+sy-1;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sx<m_dimx*8-1)
+			{
+				i = (sx+1)*10000+sy;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+			if (sy<m_dimy*8-1)
+			{
+				i = (sx)*10000+sy+1;
+				if (tfields.find(i)==tfields.end())
+				{
+					fields.push(i);
+				}
+			}
+
+		}
+
+	}
+
+	// keine Stelle gefunden um das Item zu droppen
+	return false;
+
+}
+
+bool Region::dropItem(Item::Subtype subtype, Vector pos, int magic_power)
+{
+		
+	Item::Type type = ItemFactory::getBaseType(subtype);
+	if (type == Item::NOITEM)
+	{
+		return false;
+	}
+	
+	Item* item= ItemFactory::createItem(type,subtype,0,magic_power);
+	DEBUGX("drop item %s at %f %f %p",subtype.c_str(),pos.m_x,pos.m_y,item);
+	
+	if (item !=0)
+	{
+		return dropItem(item, pos);
+	}
+	
+	return false;
+}
+
+
+Item*  Region::getItemAt(Vector pos)
+{
+	DropItemMap::iterator it;
+	short sx = (int) (pos.m_x*2 + 0.5);
+	short sy = (int) (pos.m_y*2 + 0.5);
+	int id = sx*10000 + sy;
+
+	it = m_drop_item_locations.find(id);
+	if (it == m_drop_items.end())
+	{
+		return 0;
+	}
+	else
+	{
+		return it->second->getItem();
+	}
+}
+
+Item* Region::getItem(int id)
+{
+	DropItemMap::iterator it;
+	it = m_drop_items.find(id);
+	if (it == m_drop_items.end())
+	{
+		return 0;
+	}
+	else
+	{
+		return it->second->getItem();
+	}
+}
+
+DropItem* Region::getDropItem(int id)
+{
+	DropItemMap::iterator it;
+	it = m_drop_items.find(id);
+	if (it == m_drop_items.end())
+	{
+		return 0;
+	}
+	else
+	{
+		return it->second;
+	}
+}
+
+
+bool Region::deleteItem(int id, bool delitem)
+{
+
+	DropItemMap::iterator it;
+	DropItemMap::iterator it2;
+	it = m_drop_items.find(id);
+	if (it == m_drop_items.end())
+	{
+		return false;
+	}
+	else
+	{
+		// Item Wrapper loeschen
+		int pos = it->second->getLocationId();
+		it2 = m_drop_item_locations.find(pos);
+
+		
+		NetEvent event;
+		event.m_type = NetEvent::ITEM_REMOVED;
+		event.m_id = it->second->getId();
+		insertNetEvent(event);
+
+		if (delitem)
+		{
+			delete it->second->getItem();
+		}
+		delete (it->second);
+
+		m_drop_items.erase(it);
+		if (it2 != m_drop_item_locations.end())
+		{
+			m_drop_item_locations.erase(it2);
+		}
+		m_game_objects.erase(id);
+
+
+		return true;
+	}
+}
+
+EnvironmentName Region::getEnvironment(Vector pos)
+{
+	if (m_environments.empty())
+	{
+		ERRORMSG("no environments defined");
+	}
+	// Hoehe an der angegebenen Stelle
+	float height = *(m_height.ind(int(pos.m_x/4),int(pos.m_y/4)));
+
+	std::map<float, EnvironmentName>::iterator it;
+
+	for (it = m_environments.begin(); it !=m_environments.end();++it)
+	{
+		if (height < it->first)
+		{
+			DEBUGX("environment %s", it->second.c_str());
+			return it->second;
+		}
+	}
+
+	return m_environments.rbegin()->second;
+}
+
+Vector Region::getLocation(LocationName name)
+{
+	std::map<LocationName, Vector>::iterator it;
+	it = m_locations.find(name);
+
+	if (it == m_locations.end())
+	{
+		WARNING("Location %s does not exist",name.c_str());
+		return Vector(-1,-1);
+	}
+
+	return it->second;
+}
+
+Shape Region::getArea(AreaName name)
+{
+	std::map<AreaName, Shape>::iterator it;
+	it = m_areas.find(name);
+
+	if (it == m_areas.end())
+	{
+		return Shape();
+	}
+
+	return it->second;
+}
+
+
+void Region::addExit(RegionExit exit)
+{
+	exit.m_shape.m_center = getLocation(exit.m_exit_name);
+	m_exits.push_back(exit);
+}
+
+void Region::insertTrigger(Trigger* trigger)
+{
+	m_triggers.push_back(trigger);
+}
+
+void Region::insertTimedTrigger(Trigger* trigger, float time)
+{
+	m_timed_trigger.push_back(std::make_pair(time,trigger));
+}
+
+void Region::addEvent(TriggerType trigger, Event* event)
+{
+	m_events.insert(std::make_pair(trigger,event));
+}
+
+void Region::deleteCopiedEvents()
+{
+	std::multimap<TriggerType, Event*>::iterator it,jt;
+	for (it = m_events.begin(); it != m_events.end(); )
+	{
+		jt = it;
+		++it;
+		Event* ev = jt->second;
+		if (ev->isCopy())
+		{
+			delete ev;
+			m_events.erase(jt);
+		}
+	}
+}
+
+void Region::copyEventsFromRegionData(RegionData* rdata)
+{
+	std::multimap<TriggerType, Event*>::iterator it;
+	Event* ev;
+	for (it = rdata->m_events.begin(); it != rdata ->m_events.end(); ++it)
+	{
+		ev = new Event(*(it->second));
+		addEvent(it->first,ev);
+	}
+}
+
+void Region::setCutsceneMode(bool mode)
+{
+	NetEvent event;
+	event.m_type = NetEvent::REGION_CUTSCENE;
+	event.m_id = getId();
+	event.m_data = (int) mode;
+	insertNetEvent(event);
+	
+	m_cutscene_mode = mode;
+}
+
+
+Dialogue* Region::getDialogue(int id)
+{
+	std::map<int, Dialogue*>::iterator it;
+	it = m_dialogues.find(id);
+	
+	if (it == m_dialogues.end())
+		return 0;
+	
+	return it->second;
+}
+
+void Region::insertDialogue(Dialogue* dia)
+{
+	m_dialogues.insert(std::make_pair(dia->getId(),dia));
+	
+	if (World::getWorld()->isServer())
+	{
+		NetEvent event;
+		event.m_type = NetEvent::DIALOGUE_CREATED;
+		event.m_id = dia->getId();
+		insertNetEvent(event);
+	}
+	DEBUGX("insert Dialogue %i",dia->getId());
+}
+
+void Region::deleteDialogue(Dialogue* dia)
+{
+	DEBUGX("delete Dialogue %i",dia->getId());
+	std::map<int, Dialogue*>::iterator it;
+	it = m_dialogues.find(dia->getId());
+	if (it != m_dialogues.end())
+	{
+		m_dialogues.erase(it);
+	}
+	
+	if (World::getWorld()->isServer())
+	{
+		NetEvent event;
+		event.m_type = NetEvent::DIALOGUE_DESTROYED;
+		event.m_id = dia->getId();
+		insertNetEvent(event);
+	}
+	
+	delete dia;
+}
+
+void Region::setNamedId(std::string name, int id)
+{
+	m_name_ids[name] = id;
+}
+
+int Region::getIdByName(std::string name)
+{
+	std::map<std::string,int>::iterator it;
+	it = m_name_ids.find(name);
+	if (it == m_name_ids.end())
+		return 0;
+	
+	return it->second;
+}
+
+void Region::visualizeDamage(int number, Vector position, FloatingText::Size size)
+{
+	std::stringstream stream;
+	stream << number;
+	TranslatableString text(stream.str());
+	createFloatingText(text, position, size);
+}
+
+void Region::createFloatingText(TranslatableString text,  Vector position, FloatingText::Size size, std::string colour, float time, float float_offset)
+{
+	static int id =0;
+	id ++;
+	FloatingText* dmgvis = new FloatingText;
+	m_floating_texts[id] = dmgvis;
+	dmgvis->m_text = text;
+	dmgvis->m_position = position;
+	dmgvis->m_size = size;
+	dmgvis->m_maxtime = time;
+	dmgvis->m_time = time;
+	dmgvis->m_float_offset = float_offset;
+	dmgvis->m_colour = colour;
+	
+	if (World::getWorld()->isServer())
+	{
+		NetEvent event;
+		event.m_type = NetEvent::DAMAGE_VISUALIZER_CREATED;
+		event.m_id = id;
+		insertNetEvent(event);
+	}
+}
+
+void Region::playSound(std::string soundname, Vector position, float volume , bool global)
+{
+	PlayedSound* sound = new PlayedSound;
+	sound->m_soundname = soundname;
+	sound->m_position = position;
+	sound->m_volume = volume;
+	sound->m_global = global;
+	
+	m_played_sounds.push_back(sound);
+}
+
+void Region::addMusicTrack(MusicTrack track)
+{
+	SW_DEBUG ("Region: adding music track: %s", track.c_str ());
+	//
+	MusicTrack copiedName = track;
+	copiedName = SoundHelper::getNameWithPathForMusicTrack (copiedName);
+	m_music_tracks.push_back(copiedName);
+	
+	// Now also affect the music player. Add the track to the playlist with the name of this region.
+	SoundManager::getPtr ()->addPlaylistTrack (getName (), copiedName);
+
+	NetEvent event;
+	event.m_type = NetEvent::MUSIC_CHANGED;
+	event.m_id = getId();
+	insertNetEvent(event);
+}
+
+void Region::clearMusicTracks()
+{
+	m_music_tracks.clear();
+	if (World::getWorld()->getLocalPlayer() !=0
+		&& World::getWorld()->getLocalPlayer()->getRegion() == this)
+	{
+		//MusicManager::instance().stop();
+		SoundManager::getPtr ()->getMusicPlayer ()->stop ();
+	}
+	
+	NetEvent event;
+	event.m_type = NetEvent::MUSIC_CHANGED;
+	event.m_id = getId();
+	insertNetEvent(event);
+}
--- a/src/core/scriptobject.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/scriptobject.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -70,7 +70,7 @@
 	{
 		Vector speed = EventSystem::getVector(EventSystem::getLuaState(),-1);
 		lua_pop(EventSystem::getLuaState(), 1);
-		DEBUG("speed %f %f",speed.m_x,speed.m_y);
+		SW_DEBUG("speed %f %f",speed.m_x,speed.m_y);
 		setSpeed(speed);
 		return 1;
 	}
--- a/src/core/servernetwork.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/servernetwork.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -46,7 +46,7 @@
 ServerNetwork::ServerNetwork(int max_slots)
 	: Network()
 {
-    DEBUG("Max slots %d", max_slots);
+    SW_DEBUG("Max slots %d", max_slots);
 	m_slots.resize(max_slots);
 	m_max_slots = max_slots;
 	m_active = false;
--- a/src/core/sumwarshelper.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/sumwarshelper.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -102,9 +102,15 @@
         }
     }
 #else
+#ifdef _DEBUG
+    std::string ogreCfgUser = ".sumwars/ogre.cfg";
+    std::string pluginsCfgUser = ".sumwars/pluginsdbg.cfg";
+    std::string resourcesCfgUser = ".sumwars/resources.cfg";
+#else
     std::string ogreCfgUser = ".sumwars/ogre.cfg";
     std::string pluginsCfgUser = ".sumwars/plugins.cfg";
     std::string resourcesCfgUser = ".sumwars/resources.cfg";
+#endif
 
     /*
     We have to have something in the default ogre.cfg file, otherwise the options window will
@@ -240,11 +246,11 @@
 	guiAspectRatios_[std::string ("016_009")] = (double)16 / (double)9;
 
 	// Fill in the expected default fonts for each screen resolution (height).
-	guiDefaultFonts_[600] = std::string ("DejaVuSerif-8");
-	guiDefaultFonts_[768] = std::string ("DejaVuSerif-10");
-	guiDefaultFonts_[1024] = std::string ("DejaVuSerif-10");
-	guiDefaultFonts_[1050] = std::string ("DejaVuSerif-12");
-	guiDefaultFonts_[1080] = std::string ("DejaVuSerif-12");
+	guiDefaultFonts_[600] = std::string ("SWB-S");
+	guiDefaultFonts_[768] = std::string ("SWB-S");
+	guiDefaultFonts_[1024] = std::string ("SWB-M");
+	guiDefaultFonts_[1050] = std::string ("SWB-M");
+	guiDefaultFonts_[1080] = std::string ("SWB-M");
 
 	return true;
 }
@@ -464,13 +470,13 @@
 		// return the first entry in the map?
 		if (! guiAspectRatios_.empty ())
 		{
-			DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): zero height specied; returning any available ratio!");
+			SW_DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): zero height specied; returning any available ratio!");
 			return guiAspectRatios_.begin ()->first;
 		}
 		else
 		{
 			// this should not occur!
-			DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiAspectRatios_! (empty map)");
+			SW_DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiAspectRatios_! (empty map)");
 			return returnValue;
 		}
 	}
@@ -512,13 +518,13 @@
 		// return the first entry in the map?
 		if (! guiDefaultFonts_.empty ())
 		{
-			DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): zero height specied; returning any available font!");
+			SW_DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): zero height specied; returning any available font!");
 			return guiDefaultFonts_.begin ()->second;
 		}
 		else
 		{
 			// this should not occur!
-			DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiDefaultFonts_! (empty map)");
+			SW_DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiDefaultFonts_! (empty map)");
 			return returnValue;
 		}
 	}
@@ -551,7 +557,7 @@
  */
 void SumwarsHelper::addResourceLocationList (const std::vector<std::string> &locList, const std::string &groupToAddTo)
 {
-	DEBUG ("SumwarsHelper: Adding resource locations (%d items)...", locList.size ());
+	SW_DEBUG ("SumwarsHelper: Adding resource locations (%d items)...", locList.size ());
 	for (std::vector<std::string>::const_iterator it = locList.begin(); it!= locList.end(); ++it )
 	{
 		addResourceLocation (*it, groupToAddTo);
@@ -606,7 +612,7 @@
 			}
 			else
 			{
-				DEBUG ("SumwarsHelper: There is a variable in use that is not YET defined: %s", variableName.c_str ());
+				SW_DEBUG ("SumwarsHelper: There is a variable in use that is not YET defined: %s", variableName.c_str ());
 			}
 		}
 	}
@@ -621,12 +627,12 @@
 
 	if (bCanAddThis)
 	{
-		DEBUG ("SumwarsHelper: Adding location to resource list: [%s], group:[%s]", location.c_str (), secName.c_str ());
+		SW_DEBUG ("SumwarsHelper: Adding location to resource list: [%s], group:[%s]", location.c_str (), secName.c_str ());
 		Ogre::ResourceGroupManager::getSingleton ().addResourceLocation (location, typeName, secName, true);
 	}
 	else
 	{
-		DEBUG ("SumwarsHelper: Adding location to incomplete resource group list: [%s], group:[%s]. Try calling [retryToAddIncompleteResourceDirs] later on.", location.c_str (), secName.c_str ());
+		SW_DEBUG ("SumwarsHelper: Adding location to incomplete resource group list: [%s], group:[%s]. Try calling [retryToAddIncompleteResourceDirs] later on.", location.c_str (), secName.c_str ());
 		incompleteResourceGroupDirs_ [secName] = location;
 	}
 }
@@ -640,7 +646,7 @@
  */
 void SumwarsHelper::setPrefferedAspectRatioString (const std::string& aspectRatio)
 {
-	DEBUG ("SumwarsHelper: setting preffered aspect ratio string to: %s", aspectRatio.c_str ());
+	SW_DEBUG ("SumwarsHelper: setting preffered aspect ratio string to: %s", aspectRatio.c_str ());
 	getEditableApplicationVariablesMapping ()["ASPECT_RATIO"] = aspectRatio;
 }
 
--- a/src/core/treasure.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/treasure.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -74,7 +74,7 @@
 	{
 		addToNetEventMask(NetEvent::DATA_FLAGS);
 		
-		DEBUG("treasure opened");
+		SW_DEBUG("treasure opened");
 		m_open = true;
 		m_open_timer = 0;
 		
--- a/src/core/world.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/world.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -186,7 +186,7 @@
 
 	if (m_data_reload_requests & DATA_LUACODE)
 	{
-		DEBUG("Loading lua files.");
+		SW_DEBUG("Loading lua files.");
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("lua","*.lua");
 		for (it = files->begin(); it != files->end(); ++it)
 		{
@@ -200,7 +200,7 @@
 	// Aktionen initialisieren
 	if (m_data_reload_requests & DATA_ABILITIES)
 	{
-		DEBUG("Loading ability data.");
+		SW_DEBUG("Loading ability data.");
 		Action::init();
 
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("abilities","*.xml");
@@ -217,7 +217,7 @@
 
 	if (m_data_reload_requests & DATA_MONSTERS)
 	{
-		DEBUG("Loading monster data.");
+		SW_DEBUG("Loading monster data.");
 		// Monster Data
 		ObjectFactory::init();
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("monsters","*.xml");
@@ -237,7 +237,7 @@
 
 	if (m_data_reload_requests & DATA_PROJECTILES)
 	{
-		DEBUG("Loading missile data.");
+		SW_DEBUG("Loading missile data.");
 		// Projectile Data
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("projectiles","*.xml");
 		for (it = files->begin(); it != files->end(); ++it)
@@ -252,7 +252,7 @@
 
 	if (m_data_reload_requests & DATA_OBJECTS)
 	{
-		DEBUG("Loading fixed object data.");
+		SW_DEBUG("Loading fixed object data.");
 		// fixed object Data
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("objects","*.xml");
 		for (it = files->begin(); it != files->end(); ++it)
@@ -275,7 +275,7 @@
 
 		if (m_data_reload_requests & DATA_EVENTS)
 		{
-			DEBUG("Loading region data.");
+			SW_DEBUG("Loading region data.");
 			files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("world","*.xml");
 			for (it = files->begin(); it != files->end(); ++it)
 			{
@@ -288,7 +288,7 @@
 
 		if (m_data_reload_requests & DATA_EVENTS)
 		{
-			DEBUG("Loading npc data.");
+			SW_DEBUG("Loading npc data.");
 
 			files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("npc","*.xml");
 			for (it = files->begin(); it != files->end(); ++it)
@@ -299,7 +299,7 @@
 				worldloader.loadNPCData(file.c_str());
 			}
 			
-			DEBUG("Loading quest data.");
+			SW_DEBUG("Loading quest data.");
 
 			files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("quests","*.xml");
 			for (it = files->begin(); it != files->end(); ++it)
@@ -404,8 +404,6 @@
 
 bool World::createRegion(short region)
 {
-
-
 	DEBUGX("creating region %i",region);
 	int type = 1;
 	if (type==1)
@@ -499,9 +497,9 @@
 			header.fromString(data);
 			if (header.m_content == PTYPE_C2S_SAVEGAME)
 			{
-				DEBUG("got savegame from slot %i",(*i));
+				SW_DEBUG("got savegame from slot %i",(*i));
 				
-				if (m_player_slots->size() < m_max_nr_players)
+				if (m_player_slots->size() < (unsigned)m_max_nr_players)
 				{
 					handleSavegame(data,*i);
 				}
@@ -509,7 +507,7 @@
 				{
 					// reject the player, if the server is full
 					// send a reject notification
-					DEBUG("Rejected Savegame from Slot %i", (*i));
+					SW_DEBUG("Rejected Savegame from Slot %i", (*i));
 					PackageHeader header;
 					header.m_content = PTYPE_S2C_REJECT;
 					header.m_number =1;
@@ -525,7 +523,7 @@
 			}
 			else
 			{
-				DEBUG("unknown type %i",header.m_content);
+				SW_DEBUG("unknown type %i",header.m_content);
 			}
 			m_network->deallocatePacket(data);
 		}
@@ -779,7 +777,7 @@
 				ERRORMSG("cant open new party");
 			}
 			p->clear();
-			DEBUG("opened Party %i",p->getId());
+			SW_DEBUG("opened Party %i",p->getId());
 		}
 		p->addMember(player->getId());
 	}
@@ -872,7 +870,7 @@
 				}
 				// Auf Datenanfrage seitens des Client warten
 				player->setState(WorldObject::STATE_REGION_DATA_WAITING,false);
-				DEBUG("waiting for a client data request");
+				SW_DEBUG("waiting for a client data request");
 			}
 
 
@@ -918,7 +916,7 @@
 		{
 			if (!reg->hasLocation(m_region_enter_loc[player->getId()]))
 			{
-				DEBUG("location %s does not exist",m_region_enter_loc[player->getId()].c_str());
+				SW_DEBUG("location %s does not exist",m_region_enter_loc[player->getId()].c_str());
 				m_region_enter_loc[player->getId()] = m_player_start_location.second;
 
 				static_cast<Player*>(player)->setRevivePosition(m_player_start_location);
@@ -1553,7 +1551,7 @@
 			}
 
 
-			DEBUG("player %i has quit",pl->getId());
+			SW_DEBUG("player %i has quit",pl->getId());
 
 			delete pl;
 			continue;
@@ -1562,7 +1560,7 @@
 		// Spielern die auf Daten zur aktuellen Region warten, Daten senden
 		if (pl->getState() == WorldObject::STATE_REGION_DATA_REQUEST)
 		{
-			DEBUG("send data request to server");
+			SW_DEBUG("send data request to server");
 			// Client wartet auf Daten zur Region
 			pl->setState(WorldObject::STATE_REGION_DATA_WAITING,false);
 
@@ -1613,7 +1611,7 @@
 
 				if (cv->getDelay()>1000)
 				{
-					DEBUG("got packet with delay %f",cv->getDelay());
+					SW_DEBUG("got packet with delay %f",cv->getDelay());
 				}
 
 				headerp.fromString(cv);
@@ -1714,7 +1712,7 @@
 						cv->fromBuffer(id);
 						WorldObject* player;
 
-						DEBUG("got data for player %s id %i",subt.c_str(),id);
+						SW_DEBUG("got data for player %s id %i",subt.c_str(),id);
 
 						// Spieler entweder neu anlegen oder aus den existierenden herraussuchen
 						if (m_players->count(id)==0)
@@ -1736,7 +1734,7 @@
 				else if (headerp.m_content == PTYPE_S2C_REGION)
 				{
 					// Daten zu einer Region erhalten
-					DEBUG("got data for region %i",headerp.m_number);
+					SW_DEBUG("got data for region %i",headerp.m_number);
 					short dimx, dimy;
 
 					// Groesse der Region
@@ -1769,20 +1767,20 @@
 				{
 					int id;
 					cv->fromBuffer(id);
-					DEBUG("ID at server %i (old ID %i)",id, m_local_player->getId());
+					SW_DEBUG("ID at server %i (old ID %i)",id, m_local_player->getId());
 					m_players->erase(m_local_player->getId());
 					m_local_player->setId(id);
 
 					int frac;
 					cv->fromBuffer(frac);
 					m_local_player->setFraction((Fraction::Id) frac);
-					DEBUG("fraction %i",frac);
+					SW_DEBUG("fraction %i",frac);
 
 					insertPlayer(m_local_player, LOCAL_SLOT);
 				}
 				else if (headerp.m_content == PTYPE_S2C_REJECT)
 				{
-					DEBUG("Got notification that the server rejected the Savegame");
+					SW_DEBUG("Got notification that the server rejected the Savegame");
 					if (m_network != 0)
 					{
 						m_network->setSlotStatus(NET_SLOTS_FULL);
@@ -1912,7 +1910,7 @@
 				}
 				else
 				{
-					DEBUG("got package with unknown type %i", headerp.m_content);
+					SW_DEBUG("got package with unknown type %i", headerp.m_content);
 				}
 
 				m_network->deallocatePacket(cv);
@@ -2262,7 +2260,7 @@
 
 	if (event->m_type == NetEvent::PARTY_RELATION_CHANGED)
 	{
-		DEBUG("party %i changed relation to %i to %i",event->m_data, event->m_id, getParty(event->m_data)->getRelations()[event->m_id]);
+		SW_DEBUG("party %i changed relation to %i to %i",event->m_data, event->m_id, getParty(event->m_data)->getRelations()[event->m_id]);
 		cv->toBuffer(static_cast<char>(getParty(event->m_data)->getRelations()[event->m_id]));
 	}
 
@@ -2400,7 +2398,7 @@
 				}
 				else
 				{
-					DEBUG("projectile %i for event does not exist",event.m_id);
+					SW_DEBUG("projectile %i for event does not exist",event.m_id);
 					return false;
 				}
 			}
@@ -2645,7 +2643,7 @@
 			char tmp;
 			cv->fromBuffer(tmp);
 			setRelation(event.m_id, event.m_data, (Fraction::Relation) tmp);
-			DEBUG("set relation %i %i to %i",event.m_id, event.m_data, (int) tmp);
+			SW_DEBUG("set relation %i %i to %i",event.m_id, event.m_data, (int) tmp);
 
 			break;
 
@@ -2812,7 +2810,7 @@
 	}
 	else if (request->m_data == ClientDataRequest::OBJECT)
 	{
-		DEBUG("Daten zu Objekt %i gefordert",request->m_id);
+		SW_DEBUG("Daten zu Objekt %i gefordert",request->m_id);
 		if (region!=0)
 		{
 			// Daten werden per Event aktualisiert
--- a/src/core/worldloader.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/worldloader.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -19,6 +19,7 @@
 
 #include <iostream>
 
+
 std::string WorldLoader::m_filename;
 
 void WorldLoader::loadEvent( TiXmlNode* node, Event *ev, TriggerType &type)
@@ -66,6 +67,7 @@
 
 bool WorldLoader::loadRegionData(const char* pFilename)
 {
+	SW_DEBUG ("Loading region data from file: [%s]", pFilename);
 	TiXmlDocument doc(pFilename);
 	bool loadOkay = doc.LoadFile();
 
@@ -130,7 +132,6 @@
 
 bool WorldLoader::loadRegion(TiXmlNode* node, RegionData* rdata)
 {
-	
 	TiXmlNode* child;
 	TiXmlNode* child2;
 	for ( child = node->FirstChild(); child != 0; child = child->NextSibling())
@@ -168,6 +169,7 @@
 						if (music != "")
 						{
 							rdata->m_music_tracks.push_back(music);
+							SW_DEBUG ("Loading region [%s]. Adding music track to region data: %s", rdata->m_name.c_str (), music.c_str ());
 						}
 					}
 					else if (child2->Type()!=TiXmlNode::TINYXML_COMMENT)
--- a/src/core/worldobject.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/core/worldobject.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -227,14 +227,14 @@
 	{
 		if (getType() == "PLAYER")
 		{
-			DEBUG("You cant change the fraction of a player");
+			SW_DEBUG("You cant change the fraction of a player");
 			return false;
 		}
 		std::string fraction  = lua_tostring(EventSystem::getLuaState() ,-1);
 		lua_pop(EventSystem::getLuaState(), 1);
 		Fraction::Id id = World::getWorld()->getFractionId(fraction);
 		setFraction(id);
-		DEBUG("fraction is now %i",getFraction());
+		SW_DEBUG("fraction is now %i",getFraction());
 		return true;
 	}
 	else if (valname == "position")
--- a/src/gui/application.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/application.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -18,7 +18,7 @@
 #include "tooltipmanager.h"
 #include "itemwindow.h"
 #include "templateloader.h"
-#include "music.h"
+//#include "music.h"
 #include "sumwarshelper.h"
 
 #ifdef SUMWARS_BUILD_TOOLS
@@ -57,6 +57,48 @@
 // Utilities for handling CEGUI
 #include "ceguiutility.h"
 
+// Sound and music management classes.
+#include "gussound.h"
+#include "gopenal.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+
+//locally defined listener.
+class SWOgreResListener : public Ogre::ResourceGroupListener
+{
+protected:
+public:
+	SWOgreResListener () {}
+	void resourceGroupScriptingStarted (const Ogre::String& groupName, size_t scriptCount)
+	{
+		SoundHelper::signalSoundManager ();
+	}
+	void scriptParseStarted (const Ogre::String& scriptName, bool &skipThisScript)
+	{
+		SoundHelper::signalSoundManager ();
+	}
+	void scriptParseEnded (const Ogre::String& scriptName, bool skipped) {}
+	void resourceGroupScriptingEnded (const Ogre::String& groupName) {}
+	void resourceGroupLoadStarted (const Ogre::String& groupName, size_t resourceCount)
+	{
+		SoundHelper::signalSoundManager ();
+	}
+	void resourceLoadStarted (const Ogre::ResourcePtr& resource)
+	{
+		SoundHelper::signalSoundManager ();
+	}
+	void resourceLoadEnded (void) {}
+	void worldGeometryStageStarted (const Ogre::String& description)
+	{
+		SoundHelper::signalSoundManager ();
+	}
+	void worldGeometryStageEnded (void) {}
+	void resourceGroupLoadEnded (const Ogre::String& groupName) {}
+};
+
+
 /**
 	Application constructor. Will call the init function.
 */
@@ -70,14 +112,14 @@
 	m_shutdown = false;
 
 	// Call the specialized initialization function.
-	try
+	//try
 	{
 		ret = init();
 	}
-	catch (std::exception &e)
-	{
-		ERRORMSG("Error message: %s",e.what());
-	}
+	//catch (std::exception &e)
+	//{
+	//	ERRORMSG("Error message: %s",e.what());
+	//}
 
 	if (ret == false)
 	{
@@ -115,7 +157,7 @@
 	LogManager::instance ().addLog ("stdout", new StdOutLog(Log::LOGLEVEL_DEBUG));
 	LogManager::instance ().addLog ("logfile", new FileLog (operationalPath + "/sumwars.log", Log::LOGLEVEL_DEBUG));
 
-	DEBUG ("Initialized logging. Level: %d", Log::LOGLEVEL_DEBUG);
+	SW_DEBUG ("Initialized logging. Level: %d", Log::LOGLEVEL_DEBUG);
 	Timer tm;
 	m_timer.start();
 
@@ -128,18 +170,40 @@
 				     SumwarsHelper::macPath() + "/ogre.cfg",
 				     operationalPath + "/ogre.log");
 #else
-	m_ogre_root = new Ogre::Root (operationalPath + "/plugins.cfg", operationalPath + "/ogre.cfg", operationalPath + "/ogre.log");
+
+	Ogre::String pluginsFileName;
+	Ogre::String configFileName;
+	Ogre::String logFileName;
+
+#ifdef _DEBUG
+	pluginsFileName = operationalPath + "/pluginsdbg.cfg";
+	configFileName = operationalPath + "/ogre.cfg";
+	logFileName = operationalPath + "/ogre.log";
+#else
+	pluginsFileName = operationalPath + "/plugins.cfg";
+	configFileName = operationalPath + "/ogre.cfg";
+	logFileName = operationalPath + "/ogre.log";
+#endif
+
+	m_ogre_root = new Ogre::Root (pluginsFileName, configFileName, logFileName);
 #endif
 
 	if (m_ogre_root == 0)
 		return false;
 
+	bool ret = true;
+
+	ret = initOpenAL();
+	if (ret == false)
+	{
+		ERRORMSG("Sound initialisation failed");
+	}
+
+	SW_DEBUG ("Reading options file (options.xml)...");
 	// Augustin Preda, 2011.11.15: trial code: load the options.xml file; it's required
 	// TODO: don't load it again later. Currently it's done via m_document->loadSettings();
 	Options::getInstance()->readFromFile(operationalPath + "/options.xml");
 
-	bool ret = true;
-
 #ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
     new OnlineServicesManager(operationalPath);
 #endif
@@ -185,6 +249,9 @@
 		return false;
 	}
 
+	// Load menu playlist and start music play.
+	loadAndPlayMenuMusic ();
+
 	// Document anlegen
 	ret = createDocument();
 	if (ret==false)
@@ -200,13 +267,7 @@
 		return false;
 	}
 
-	ret = initOpenAL();
-	if (ret == false)
-	{
-		ERRORMSG("Sound initialisation failed");
-	}
-
-	DEBUG("time to start %f",tm.getTime());
+	SW_DEBUG("time to start %f",tm.getTime());
 	// Ressourcen laden
 	ret = loadResources();
 	if (ret == false)
@@ -214,7 +275,7 @@
 		ERRORMSG("could not load ressources");
 	}
 
-	DEBUG ("Application initialized. Storing data in folder [%s]\n\n", operationalPath.c_str ());
+	SW_DEBUG ("Application initialized. Storing data in folder [%s]\n\n", operationalPath.c_str ());
 	// debugging
 	//MyFrameListener* mfl = new MyFrameListener(m_main_window,m_document);
 	//m_ogre_root->addFrameListener(mfl);
@@ -250,12 +311,20 @@
 		delete m_ogre_root;
 	}
 	
+	//
+	// Destroy the singletons
+	//
 	
 	ObjectFactory::cleanup();
 	ItemFactory::cleanup();
-	SoundSystem::cleanup();
+	//SoundSystem::cleanup();
+
+	// Destroy the sound system
+    SoundManager::destroy ();
+
 	LogManager::cleanup();
-    
+
+
     PHYSFS_deinit();
 
 	// Free the singletons? - Should be cleaned up automatically along with the rest of the application memory space.
@@ -311,14 +380,14 @@
 			{
 				count =0;
 				
-				DEBUG("average stats over %i frames",nr);
-				DEBUG("frame time: %f (%f fps)",time[0]/nr, 1000/(time[0]/nr));
-				DEBUG("app update time: %f",time[1]/nr);
-				DEBUG("message pump time: %f",time[2]/nr);
-				DEBUG("world update time: %f",time[3]/nr);
-				DEBUG("scene update time: %f",time[4]/nr);
-				DEBUG("gui update time: %f",time[5]/nr);
-				DEBUG("ogre  time: %f \n",time[6]/nr);
+				SW_DEBUG("average stats over %i frames",nr);
+				SW_DEBUG("frame time: %f (%f fps)",time[0]/nr, 1000/(time[0]/nr));
+				SW_DEBUG("app update time: %f",time[1]/nr);
+				SW_DEBUG("message pump time: %f",time[2]/nr);
+				SW_DEBUG("world update time: %f",time[3]/nr);
+				SW_DEBUG("scene update time: %f",time[4]/nr);
+				SW_DEBUG("gui update time: %f",time[5]/nr);
+				SW_DEBUG("ogre  time: %f \n",time[6]/nr);
 
 
 				for (int i=0; i<7; i++)
@@ -335,9 +404,10 @@
 		time[1] += t;
 		if (t > 20)
 		{
-			DEBUG("update time was %f",t);
+			SW_DEBUG("update time was %f",t);
 		}
 
+		float musicUpdateTimer = frametime;
 
 		timer2.reset();
 		// run the message pump
@@ -397,7 +467,7 @@
 
 		timer2.reset();
 
-		m_cegui_system->injectTimePulse(frametime/1000.0);
+		CEGUIUtility::injectTimePulse (frametime/1000.0);
 
 		t =timer2.getMicroseconds ()/1000.0;
 		time[5] += t;
@@ -423,10 +493,13 @@
 		}
 
 		// Musik aktualisieren
-		MusicManager::instance().update();
+		//MusicManager::instance().update();
+
+		// Do the update for the sounds
+		SoundHelper::signalSoundManager ();
 	}
 
-	DEBUG ("Application: run function has run its course");
+	SW_DEBUG ("Application: run function has run its course");
 
 
 }
@@ -479,13 +552,13 @@
 				it != myCfgMap.end (); 
 				++ it)
 		{
-			DEBUG ("option name=[%s], val=[%s]", it->second.name.c_str (), it->second.currentValue.c_str ());
+			SW_DEBUG ("option name=[%s], val=[%s]", it->second.name.c_str (), it->second.currentValue.c_str ());
 		}
 
 		Ogre::ConfigOptionMap::iterator opt_it = myCfgMap.find ("Video Mode");
 		if (opt_it != myCfgMap.end ())
 		{
-			DEBUG ("Currently selected video mode: %s",  opt_it->second.currentValue.c_str ());
+			SW_DEBUG ("Currently selected video mode: %s",  opt_it->second.currentValue.c_str ());
 			returnValue = opt_it->second.currentValue;
 			std::string sLeft, sRight;
 			int nPos = returnValue.find (" ");
@@ -531,7 +604,7 @@
 */
 bool Application::initOgre()
 {
-	DEBUG("init ogre");
+	SW_DEBUG("init ogre");
 
 	// Create window.
 	// Here, we have 2 options:
@@ -584,8 +657,8 @@
 	usedResolution = retrieveRenderSystemWindowSize (videoModeWidth, videoModeHeight);
 
 	Options::getInstance ()->setUsedResolution (usedResolution);
-	DEBUG ("Stored used resolution into global options [%s]", usedResolution.c_str ());
-	DEBUG ("Size should be %d x %d", videoModeWidth, videoModeHeight);
+	SW_DEBUG ("Stored used resolution into global options [%s]", usedResolution.c_str ());
+	SW_DEBUG ("Size should be %d x %d", videoModeWidth, videoModeHeight);
 
 	//
 	// Platform specific code: 
@@ -603,8 +676,8 @@
 
 		if (desktopWidth == videoModeWidth && desktopHeight == videoModeHeight)
 		{
-			DEBUG ("Windowed (Fullscreen) mode selected; desktop at %d x %d.", desktopWidth, desktopHeight);
-			DEBUG ("Correcting settings.");
+			SW_DEBUG ("Windowed (Fullscreen) mode selected; desktop at %d x %d.", desktopWidth, desktopHeight);
+			SW_DEBUG ("Correcting settings.");
 
 			// Retrieve the window handle
 			HWND hwnd; // handle of window
@@ -701,7 +774,7 @@
 	// Register as a Window listener
 	Ogre::WindowEventUtilities::addWindowEventListener (m_window, this);
 
-    Ogre::LogManager::getSingleton ().createLog (SumwarsHelper::userPath () + "/BenchLog.log");
+	Ogre::LogManager::getSingleton ().createLog (SumwarsHelper::userPath () + "/BenchLog.log");
 	return true;
 }
 
@@ -709,7 +782,7 @@
 
 bool Application::configureOgre()
 {
-	DEBUG("configure ogre");
+	SW_DEBUG("configure ogre");
 
 	// Use the default logging level.
 	// Possible options:
@@ -733,7 +806,7 @@
 
 bool Application::setupResources()
 {
-	DEBUG("initalizing resources");
+	SW_DEBUG("initalizing resources");
 #ifdef NOMIPMAPS
 	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0);
 #endif
@@ -795,17 +868,17 @@
 
 bool Application::initGettext()
 {
-	DEBUG("initializing internationalisation");
+	SW_DEBUG("initializing internationalisation");
 	Ogre::StringVectorPtr path = Ogre::ResourceGroupManager::getSingleton().findResourceLocation("translation", "*");
-	DEBUG("Application initializing Gettext lib with [%s]", path.get ()->at (0).c_str ());
+	SW_DEBUG("Application initializing Gettext lib with [%s]", path.get ()->at (0).c_str ());
 	Gettext::init("", path.get()->at(0));
-	DEBUG("Application initializing Gettext locale is [%s]", Gettext::getLocale ());
+	SW_DEBUG("Application initializing Gettext locale is [%s]", Gettext::getLocale ());
 	return true;
 }
 
 bool Application::initCEGUI()
 {
-	DEBUG("init CEGUI\n");
+	SW_DEBUG("init CEGUI\n");
     
 	// Log level
 	new CEGUI::DefaultLogger();	
@@ -813,42 +886,68 @@
 	CEGUI::DefaultLogger::getSingleton().setLogFilename(SumwarsHelper::getStorageBasePath() + "/" + SumwarsHelper::userPath() + "/CEGUI.log");
 	
 	// Bootstrap the CEGUI System
+	SW_DEBUG ("Bootstrapping the CEGUI system");
 	CEGUI::OgreRenderer::bootstrapSystem();
 
+	SW_DEBUG ("Getting the XML parser");
+
 	CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
+	if (NULL == parser)
+	{
+		WARNING ("No XML parser available to CEGUI!!!");
+		return false;
+	}
 	if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
 		parser->setProperty("SchemaDefaultResourceGroup", "GUI_XML_schemas");
     
+	SW_DEBUG ("Loading (CEGUI) schemes...");
+
 	// Load schemes
-	CEGUI::SchemeManager::getSingleton().create((CEGUI::utf8*)"SWB.scheme", (CEGUI::utf8*)"GUI");
-	CEGUI::SchemeManager::getSingleton().create((CEGUI::utf8*)"TaharezLook.scheme", (CEGUI::utf8*)"GUI");
-	CEGUI::SchemeManager::getSingleton().create((CEGUI::utf8*)"SumWarsExtras.scheme", (CEGUI::utf8*)"GUI");
+	SW_DEBUG ("Loading scheme: SWB.scheme");
+	CEGUIUtility::loadScheme ((CEGUI::utf8*)"SWB.scheme", (CEGUI::utf8*)"GUI");
+	SW_DEBUG ("Loading scheme: TaharezLook.scheme");
+	CEGUIUtility::loadScheme ((CEGUI::utf8*)"TaharezLook.scheme", (CEGUI::utf8*)"GUI");
+	SW_DEBUG ("Loading scheme: SumWarsExtras.scheme");
+	CEGUIUtility::loadScheme ((CEGUI::utf8*)"SumWarsExtras.scheme", (CEGUI::utf8*)"GUI");
 	
-	// Imagesets laden
-	CEGUI::ImagesetManager::getSingleton().create("skills.imageset");
+	// Load imagesets
+	CEGUIUtility::loadImageset("skills.imageset");
 
-	DEBUG ("Creating hardcoded images from file");
+	SW_DEBUG ("Creating hardcoded images from file");
 
 	try
 	{
-		CEGUI::ImagesetManager::getSingleton().createFromImageFile("SumWarsLogo.png", "SumWarsLogo.png");
-		CEGUI::ImagesetManager::getSingleton().createFromImageFile("worldMap.png","worldMap.png",(CEGUI::utf8*)"GUI");
+		CEGUIUtility::addManagedImageFromFile ("SumWarsLogo.png", "SumWarsLogo.png");
+		CEGUIUtility::addManagedImageFromFile ("worldMap.png", "worldMap.png", (CEGUI::utf8*)"GUI");
 	}
 	catch (CEGUI::Exception& e)
 	{
-		DEBUG("CEGUI exception %s",e.getMessage().c_str());
+		SW_DEBUG("CEGUI exception %s",e.getMessage().c_str());
 	}
     m_cegui_system = CEGUI::System::getSingletonPtr();
 	
 	/*CEGUI::LuaScriptModule &scriptm(CEGUI::LuaScriptModule::create());
 	m_cegui_system->setScriptingModule(&scriptm);*/
 
-	DEBUG ("Setting cursor defaults");
+	SW_DEBUG ("Setting cursor defaults");
 
-	// Set the mousr cursor.
+	// Set the mouse cursor.
 	CEGUIUtility::setDefaultMouseCursor (m_cegui_system, Options::getInstance ()->getCeguiCursorSkin (), "MouseArrow");
+
+	// Set the tooltip to use.
 	CEGUIUtility::setDefaultTooltip (m_cegui_system, Options::getInstance ()->getCeguiSkin (), "Tooltip");
 
+	CEGUI::Tooltip* defaultTT = CEGUI::System::getSingletonPtr ()->getDefaultGUIContext ().getDefaultTooltipObject ();
+	if (0 != defaultTT)
+	{
+		SW_DEBUG ("Default tooltip is: %s", defaultTT->getNamePath ().c_str ());
+		defaultTT->setHoverTime (0.5f); // set it to 0.5 seconds.
+	}
+
+	CEGUI::System::getSingletonPtr ()->getDefaultGUIContext ().markAsDirty ();
+
+
+#if 0
 	// Update the fade delay?
 	if (m_cegui_system->getDefaultTooltip ())
 	{
@@ -859,30 +958,28 @@
 		m_cegui_system->getDefaultTooltip ()->setFadeTime (myFadeTime);
 		//DEBUG ("New tooltip fade time set to %f", myFadeTime);
 	}
-    
-	DEBUG ("Creating fonts");
+#endif
 
-	// Load the usable font list.
-	CEGUI::FontManager::getSingleton().create("DejaVuSerif-8.font", (CEGUI::utf8*)"GUI");
-	CEGUI::FontManager::getSingleton().create("DejaVuSerif-10.font", (CEGUI::utf8*)"GUI");
-	CEGUI::FontManager::getSingleton().create("DejaVuSerif-12.font", (CEGUI::utf8*)"GUI");
-	CEGUI::FontManager::getSingleton().create("DejaVuSerif-16.font", (CEGUI::utf8*)"GUI");
-	CEGUI::FontManager::getSingleton().create("DejaVuSans-10.font", (CEGUI::utf8*)"GUI");
-
-	CEGUI::FontManager::getSingleton().create("SWB_S.font", (CEGUI::utf8*)"GUI");
+	// Note: you could also add custom fonts here, by calling CEGUIUtility::addFont.
+	// But all fonts can now be specified in the skin's scheme file. This means, we don't need to specify any fonts here.
+	SW_DEBUG ("Creating fonts");
 
 	// Set the default font to use based on the current display resolution.
 	int configuredWidth, configuredHeight;
 	SumwarsHelper::getSizesFromResolutionString (Options::getInstance ()->getUsedResolution (), configuredWidth, configuredHeight);
 	std::string defaultFontName = SumwarsHelper::getSingletonPtr ()->getRecommendedDefaultFontForWindowSize (configuredWidth, configuredHeight);
-	DEBUG ("For the current display resolution (%d x %d), the system has decreed that the recommended font is: %s", configuredWidth, configuredHeight, defaultFontName.c_str ());
-	m_cegui_system->setDefaultFont((CEGUI::utf8*)defaultFontName.c_str ());
+	SW_DEBUG ("For the current display resolution (%d x %d), the system has decreed that the recommended font is: %s", configuredWidth, configuredHeight, defaultFontName.c_str ());
+	CEGUIUtility::setDefaultFont ((CEGUI::utf8*)defaultFontName.c_str ());
 
-	DEBUG ("Creating own factory for tooltips");
+	SW_DEBUG ("Creating own factory for tooltips");
 	// Insert own factories. // TODO: check if this is really needed. Couldn't the custom tooltip just be added to the scheme?
 	std::stringstream ss;
 	ss << Options::getInstance ()->getCeguiSkin () << "/CustomTooltip";
+#ifdef CEGUI_07
 	CEGUI::WindowFactoryManager::getSingleton().addFalagardWindowMapping ("SumwarsTooltip", "DefaultWindow", ss.str ().c_str (), "Falagard/Default");
+#else
+	CEGUI::WindowFactoryManager::getSingleton().addFalagardWindowMapping ("SumwarsTooltip", "DefaultWindow", ss.str ().c_str (), "Core/Default");
+#endif
 
 #ifdef SUMWARS_BUILD_TOOLS
 	CEGUI::WindowFactoryManager::getSingleton().addFactory< CEGUI::TplWindowFactory<DebugCameraTab> >();
@@ -898,60 +995,49 @@
 	return true;
 }
 
+//TODO: rename function. It doesn't have to point to openAL as a sound lib.
 bool Application::initOpenAL()
 {
-	SoundSystem::init();
-	bool err = SoundSystem::checkErrors();
-	return !err;
+	SW_DEBUG ("initOpenAL");
+	//SoundSystem::init();
+	//bool err = SoundSystem::checkErrors();
+	//return !err;
+	try
+	{
+		// Get the path to use for storing data.
+		// This will be relative to the user directory on the user OS.
+		Ogre::String operationalPath = SumwarsHelper::getStorageBasePath() + "/" + SumwarsHelper::userPath();
+
+		// Set the logging details
+		SoundManagerLogger::setLoggerTarget (operationalPath + "/gussoundlib.log", 4);
+
+		SoundManagerFactory::getPtr ()->Register ("openal", GOpenAl::OpenAlManagerUtil::createSoundManager);
+		SoundManager::setPtr (SoundManagerFactory::getPtr ()->CreateObject ("openal"));
+
+		// this is a temporary hack. Should be integrated into the class.
+		((GOpenAl::OpenAlManagerUtil*)SoundManager::getPtr ())->setListenerPosition (0, 0, 0);
+
+		SoundManager::getPtr ()->getMusicPlayer ()->setFadeDuration (3200);		// in milliseconds
+		SoundManager::getPtr ()->getMusicPlayer ()->setRepeat (true);			// only affects initial behavior. Playlists can override this.
+
+		// make sure the first call to elapse time won't return many seconds. 
+		SoundHelper::signalSoundManager ();
+	}
+	catch (std::exception &e)
+	{
+		SW_DEBUG ("Application::initOpenAL caught exception: %s", e.what ());
+		return false;
+	}
+
+	return true;
 }
 
+
+
 bool Application::createDocument()
 {
-	DEBUG("create document\n");
+	SW_DEBUG("create document\n");
 	m_document = new Document();
-
-	/*
-	m_document->installShortkey(OIS::KC_ESCAPE,CLOSE_ALL);
-	m_document->installShortkey(OIS::KC_I,SHOW_INVENTORY);
-	m_document->installShortkey(OIS::KC_C,SHOW_CHARINFO);
-	m_document->installShortkey(OIS::KC_T,SHOW_SKILLTREE);
-	m_document->installShortkey(OIS::KC_P,SHOW_PARTYMENU);
-	m_document->installShortkey(OIS::KC_M,SHOW_CHATBOX);
-	m_document->installShortkey(OIS::KC_Q,SHOW_QUESTINFO);
-	m_document->installShortkey(OIS::KC_TAB,SHOW_MINIMAP);
-	m_document->installShortkey(OIS::KC_F10,SHOW_OPTIONS);
-	m_document->installShortkey(OIS::KC_W,SWAP_EQUIP);
-	m_document->installShortkey(OIS::KC_LMENU,SHOW_ITEMLABELS);
-
-	m_document->installShortkey(OIS::KC_RETURN,SHOW_CHATBOX_NO_TOGGLE,false);
-	m_document->installShortkey(OIS::KC_1,USE_POTION,false);
-	m_document->installShortkey(OIS::KC_2,(ShortkeyDestination) (USE_POTION+1),false);
-	m_document->installShortkey(OIS::KC_3,(ShortkeyDestination) (USE_POTION+2),false);
-	m_document->installShortkey(OIS::KC_4,(ShortkeyDestination) (USE_POTION+3),false);
-	m_document->installShortkey(OIS::KC_5,(ShortkeyDestination) (USE_POTION+4),false);
-	m_document->installShortkey(OIS::KC_6,(ShortkeyDestination) (USE_POTION+5),false);
-	m_document->installShortkey(OIS::KC_7,(ShortkeyDestination) (USE_POTION+6),false);
-	m_document->installShortkey(OIS::KC_8,(ShortkeyDestination) (USE_POTION+7),false);
-	m_document->installShortkey(OIS::KC_9,(ShortkeyDestination) (USE_POTION+8),false);
-	m_document->installShortkey(OIS::KC_0,(ShortkeyDestination) (USE_POTION+9),false);
-
-	m_document->installSpecialKey(OIS::KC_ESCAPE);
-	m_document->installSpecialKey(OIS::KC_LSHIFT);
-//	m_document->installSpecialKey(OIS::KC_LCONTROL);
-//	m_document->installSpecialKey(OIS::KC_RCONTROL);
-//	m_document->installSpecialKey(OIS::KC_RMENU);
-//	m_document->installSpecialKey(OIS::KC_LMENU);
-	m_document->installSpecialKey(OIS::KC_TAB);
-	m_document->installSpecialKey(OIS::KC_RETURN);
-	m_document->installSpecialKey(OIS::KC_BACK);
-	m_document->installSpecialKey(OIS::KC_UP);
-	m_document->installSpecialKey(OIS::KC_DOWN);
-	m_document->installSpecialKey(OIS::KC_LEFT);
-	m_document->installSpecialKey(OIS::KC_RIGHT);
-	m_document->installSpecialKey(OIS::KC_CAPITAL);
-	// CHEATS
-	m_document->installShortkey(OIS::KC_L,(ShortkeyDestination) (CHEAT+0));
-*/
 	m_document->loadSettings();
 
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
@@ -966,9 +1052,11 @@
 	return true;
 }
 
+
+
 bool Application::createView()
 {
-	DEBUG("create view\n");
+	SW_DEBUG("create view\n");
 	m_main_window = new MainWindow(m_ogre_root, m_cegui_system,m_window,m_document);
 
 #ifdef SUMWARS_BUILD_TOOLS
@@ -983,12 +1071,17 @@
 	mgr->setFadeOutTime(200.0f);
 	mgr->setVisibleTime(0.0f);
 
+	// TODO: Augustin Preda (2013.06.22): investigate whether the clipboard should not be moved from the createView function.
+	// It doesn't seem to make sense to have it here.
+
 	// Create the clipboard singleton
 	new SWUtil::Clipboard ();
 
 	return true;
 }
 
+
+
 bool Application::loadResources(int datagroups)
 {
 	TiXmlBase::SetCondenseWhiteSpace(false);
@@ -997,16 +1090,19 @@
 	Ogre::FileInfoList::iterator it;
 	std::string file;
 
+	//SWOgreResListener myListener;
+	//Ogre::ResourceGroupManager::getSingleton().addResourceGroupListener (&myListener);
+
 	if (datagroups & World::DATA_IMAGES)
 	{
-		DEBUG("Loading images.");
+		SW_DEBUG("Loading images.");
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("itempictures","*.png");
 		for (it = files->begin(); it != files->end(); ++it)
 		{
 
 			file = it->filename;
 
-			CEGUI::ImagesetManager::getSingleton().createFromImageFile(file,file,(CEGUI::utf8*)"itempictures");
+			CEGUIUtility::addManagedImageFromFile (file, file, (CEGUI::utf8*)"itempictures");
 
 			updateStartScreen(0.1);
 		}
@@ -1018,19 +1114,18 @@
 
 			file = it->filename;
 
-			CEGUI::ImagesetManager::getSingleton().create(file);
+			CEGUIUtility::loadImageset (file);
 
 			updateStartScreen(0.2);
 		}
 	
-
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("emotionsets","*.imageset");
 		for (it = files->begin(); it != files->end(); ++it)
 		{
 
 			file = it->filename;
 
-			CEGUI::ImagesetManager::getSingleton().create(file);
+			CEGUIUtility::loadImageset (file);
 
 			updateStartScreen(0.3);
 		}
@@ -1039,12 +1134,14 @@
 
 	if (datagroups & World::DATA_MODELS)
 	{
-		DEBUG("Loading models.");
+		SW_DEBUG("Loading models.");
 		Ogre::ResourceGroupManager::getSingleton().loadResourceGroup("General");
+		updateStartScreen(0.35);
 	}
 	if (datagroups & World::DATA_PARTICLESYSTEMS)
 	{
-		DEBUG("Loading particlesystems.");
+		SW_DEBUG("Loading particlesystems.");
+		//Ogre::ResourceGroupManager::getSingleton().addResourceGroupListener (&myListener);
 		
 		Ogre::ResourceGroupManager::getSingleton().loadResourceGroup("Particles");
 		if (m_running)
@@ -1059,14 +1156,14 @@
 					Ogre::DataStreamPtr filehandle;
 					filehandle = Ogre::ResourceGroupManager::getSingleton().openResource(file);
 					Ogre::ParticleSystemManager::getSingleton().parseScript(filehandle,"Particles" ); 
+					updateStartScreen(0.36);
 				}
 				catch (Ogre::Exception& e)
 				{
-					DEBUG("failed with exception %s",e.what());
+					SW_DEBUG("failed with exception %s",e.what());
 				}
 			}
 		}
-		
 	}
 	updateStartScreen(0.4);
 	Ogre::ResourceGroupManager::getSingleton().loadResourceGroup("Savegame");
@@ -1084,7 +1181,7 @@
 		if (datagroups & World::DATA_ABILITIES)
 		{
 			EventSystem::init();
-			DEBUG("Loading ability data.");
+			SW_DEBUG("Loading ability data.");
 			Action::init();
 
 			files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("abilities","*.xml");
@@ -1104,7 +1201,7 @@
 	// Spielerklassen initialisieren
 	if (datagroups & World::DATA_PLAYERCLASSES)
 	{
-		DEBUG("Loading playerclasses.");
+		SW_DEBUG("Loading playerclasses.");
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("playerclasses","*.xml");
 		for (it = files->begin(); it != files->end(); ++it)
 		{
@@ -1120,7 +1217,7 @@
 	
 	if (datagroups & World::DATA_ITEMS)
 	{
-		DEBUG("Loading items.");
+		SW_DEBUG("Loading items.");
 		// Items initialisieren
 		ItemFactory::init();
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("items","*.xml");
@@ -1170,7 +1267,7 @@
 
 	if (datagroups & World::DATA_RENDERINFO)
 	{
-		DEBUG("Loading renderinfo.");
+		SW_DEBUG("Loading renderinfo.");
 		
 		// Render Infos
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("renderinfo","*.xml");
@@ -1187,7 +1284,7 @@
 
 	if (datagroups & World::DATA_SOUND)
 	{
-		DEBUG("Loading sound.");
+		SW_DEBUG("Loading sound.");
 		
 		// Sounds
 		files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("sounddata","*.xml");
@@ -1197,7 +1294,9 @@
 			file += "/";
 			file += it->filename;
 
-			SoundSystem::loadSoundData(file.c_str());
+			//SoundSystem::loadSoundData(file.c_str());
+			SW_DEBUG ("Loading sound file [%s]", file.c_str ());
+			SoundHelper::loadSoundGroupsFromFile (file);
 
 			updateStartScreen(0.9);
 		}
@@ -1215,9 +1314,52 @@
 		m_main_window->setReadyToStart(true);
 	}
 
+	//Ogre::ResourceGroupManager::getSingleton().removeResourceGroupListener (&myListener);
+
 	return true;
 }
 
+
+
+/**
+ * \brief Loads the menu music and commences playing it.
+ * Typically, this would be placed in the menu class, but that would not allow playing the music while the loading is performed
+ * (as the menu is not yet created).
+ */
+void Application::loadAndPlayMenuMusic ()
+{
+	// Let's use shuffle and repeat by default.
+	SoundManager::getPtr ()->getMusicPlayer ()->setRepeat (true);
+	SoundManager::getPtr ()->getMusicPlayer ()->setShuffle (true);
+
+	Ogre::FileInfoListPtr files;
+	Ogre::FileInfoList::iterator it;
+	std::string xmlFileName;
+
+	files = Ogre::ResourceGroupManager::getSingleton ().findResourceFileInfo ("main_menu", "main_menu_playlist.xml");
+	for (it = files->begin (); it != files->end (); ++it)
+	{
+		xmlFileName = it->archive->getName ();
+		xmlFileName.append ("/");
+		xmlFileName.append (it->filename);
+
+		SW_DEBUG ("Located resource file for menu music: %s", xmlFileName.c_str ());
+		if (! SoundHelper::loadPlaylistFromXMLFile (xmlFileName))
+		{
+			ERRORMSG ("Could not successfully load playlist from given file: %s", xmlFileName.c_str ());
+		}
+	}
+
+	// Make the sound manager elapse time, so that it starts from 0 at the next operations.
+	// This avoids skipping sounds when the manager is not called for a long time due to other time consuming operations.
+	SoundHelper::signalSoundManager ();
+
+	// Commence the play.
+	SoundManager::getPtr ()->getMusicPlayer ()->play ();
+}
+
+
+
 void Application::cleanup(int datagroups)
 {
 	if (datagroups & World::DATA_IMAGES)
@@ -1273,13 +1415,16 @@
 	
 	if (datagroups & World::DATA_SOUND)
 	{
-		SoundSystem::cleanupBuffers();
+		//SoundSystem::cleanupBuffers();
+		//TODO: investigate if needed with new system.
 	}
 	
 	if (datagroups & World::DATA_MUSIC)
 	{
 		// just stop the music to release the buffers
-		MusicManager::instance().stop();
+		//MusicManager::instance().stop();
+
+		SoundManager::getPtr ()->getMusicPlayer ()->stop ();
 	}
 }
 
@@ -1290,7 +1435,7 @@
 		World* world = World::getWorld();
 		if (world->getDataReloadRequests() != World::DATA_NONE)
 		{
-			DEBUG("reload request %x",world->getDataReloadRequests());
+			SW_DEBUG("reload request %x",world->getDataReloadRequests());
 			
 			int datagroups = world->getDataReloadRequests();
 			
@@ -1306,23 +1451,29 @@
 {
 	// this occurs when ressources are loaded while running
 	if (m_running)
+	{
+		SW_DEBUG ("Update start screen while running...");
 		return;
-	
+	}
+
 	if (m_timer.getTime() < 20)
 	{
 		return;
 	}
+	SoundHelper::signalSoundManager ();
 
 	DEBUGX("update time %f  perc: %f",m_timer.getTime(), percent);
 	m_main_window->update(m_timer.getTime()/1000);
 	m_main_window->setRessourceLoadingBar(percent);
-	m_cegui_system->injectTimePulse(m_timer.getTime()/1000);
+	CEGUIUtility::injectTimePulse (m_timer.getTime()/1000.0);
 
 	Ogre::WindowEventUtilities::messagePump();
 
 	m_ogre_root->renderOneFrame();
 	//MusicManager::instance().update();
 	m_timer.start();
+
+
 }
 
 
@@ -1344,7 +1495,7 @@
 
 	if (rw && rw == m_window)
 	{
-		DEBUG ("Application got a window closing event.");
+		SW_DEBUG ("Application got a window closing event.");
 
 		if (m_document != 0)
 		{
@@ -1352,7 +1503,7 @@
 		}
 	}
 
-	// The state was set internally, so the game will know it needs to shutdown. But it needs time to do this.
+	// The state was set internally, so the game will know it needs to But it needs time to do this.
 	// Return false so that we don't allow the closing to take place yet!
 	return false;
 }
@@ -1382,7 +1533,6 @@
             // DeviceCreated is called when Device is dragged from one Display to another
             // DeviceRestored is called when RenderWindow is minimized with Alt+Tab or the Windows key
             m_ogre_root->clearEventTimes();
-
             #if (OGRE_VERSION < ((1 << 16) | (9 << 8) | 0))
                 Ogre::TexturePtr tex = Ogre::TextureManager::getSingletonPtr()->getByName("minimap_tex", "General");
             #else
--- a/src/gui/application.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/application.h	Thu Mar 20 19:04:28 2014 +0100
@@ -21,10 +21,12 @@
 #include "OgreLogManager.h"
 #include "OgreMeshManager.h"
 
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
 // needed to be able to create the CEGUI renderer interface
+#ifdef CEGUI_07
 #include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
-
-// CEGUI includes
 #include "CEGUI/CEGUISystem.h"
 #include "CEGUI/CEGUIInputEvent.h"
 #include "CEGUI/CEGUIWindow.h"
@@ -32,6 +34,19 @@
 #include "CEGUI/CEGUISchemeManager.h"
 #include "CEGUI/CEGUIFontManager.h"
 #include "CEGUI/elements/CEGUIFrameWindow.h"
+#else
+#include "CEGUI/RendererModules/Ogre/Renderer.h"
+#include "CEGUI/System.h"
+#include "CEGUI/InputEvent.h"
+#include "CEGUI/Window.h"
+#include "CEGUI/WindowManager.h"
+#include "CEGUI/SchemeManager.h"
+#include "CEGUI/FontManager.h"
+#include "CEGUI/widgets/FrameWindow.h"
+#endif
+
+
+// CEGUI includes
 
 #include <stdio.h>
 
@@ -164,6 +179,13 @@
 		bool loadResources(int datagroups=0xfffffff);
 		
 		/**
+		 * \brief Loads the menu music and commences playing it.
+		 * Typically, this would be placed in the menu class, but that would not allow playing the music while the loading is performed
+		 * (as the menu is not yet created).
+		 */
+		void loadAndPlayMenuMusic ();
+
+		/**
 		 * \brief clears the Ressources specified by \a datagroups
 		 * \param datagroups bitmask consisting of members of \ref World::DataGroups
 		 */
--- a/src/gui/ceguiutility.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/ceguiutility.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,243 +1,441 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ceguiutility.h"
-#include "CEGUI/CEGUI.h"
-#include <iostream>
-#include <algorithm>
-#include "debug.h"
-
-std::string CEGUIUtility::stripColours(const std::string &input)
-{
-    std::string output = input;
-
-    std::string::size_type pos = output.find("[");
-    while (pos != std::string::npos)
-    {
-        output.erase(pos,pos+19);
-        pos = output.find("[");
-    }
-
-    return output;
-}
-
-std::list< std::string > CEGUIUtility::getTextAsList(const std::string &text)
-{
-    std::list<std::string> l;
-    std::string temp = text;
-	
-    std::string::size_type pos = text.find_first_of(LINE_ENDING);
-    while (pos != std::string::npos)
-    {
-        // ignore new line directly at the beginning of the string
-        if (pos != 0)
-        {
-            l.push_back(temp.substr(0, pos));
-            temp.erase(0, pos+ERASE_CNT);
-            pos = temp.find(LINE_ENDING);
-        }
-        else
-		{
-			temp.erase(0, ERASE_CNT);
-			//l.push_back(" ");
-			pos = temp.find(LINE_ENDING);
-		}
-    }
-    
-    if (temp != "")
-	{
-		l.push_back(temp);
-	}
-	
-    return l;
-}
-
-CEGUI::UVector2 CEGUIUtility::getWindowSizeForText(std::list<std::string> list, CEGUI::Font *font, std::string &added)
-{
-    using namespace CEGUI;
-
-    float textWidth = 0.0f;
-    float textHeight = 0.0f;
-    CEGUI::Size screenSize = CEGUI::System::getSingleton().getRenderer()->getDisplaySize();
-
-    added.clear();
-	size_t count = 0;
-	
-    for (std::list<std::string>::iterator iter = list.begin();
-		iter != list.end();
-		++iter)
-    {
-		std::string & s = *iter;
-		
-		if (!s.empty())
-		{
-			std::string::size_type word_pos = 0;
-			while ( word_pos!=std::string::npos )
-			{
-				word_pos = s.find ( LINE_ENDING, word_pos );
-				if ( word_pos != std::string::npos )
-				{
-					++count;
-
-					// start next search after this word
-					word_pos += 2;
-				}
-			}
-			
-			added += s + '\n';
-
-			float tempwidth = font->getTextExtent(stripColours(s).c_str()) ;
-			if (tempwidth > textWidth)
-				textWidth = tempwidth;
-		}
-    }
-
-	// increase the counter intil we have at least one line break more than we have text
-	if (count <= list.size())  
-		count = list.size() + 1;
-
-	textHeight = count * (font->getLineSpacing());
-
-    return UVector2(UDim((textWidth/screenSize.d_width) + 0.05f, 0), UDim(textHeight / screenSize.d_height, 0) );
-}
-
-CEGUI::UVector2 CEGUIUtility::getWindowSizeForText(std::string text, CEGUI::Font* font)
-{
-    std::list<std::string> l = getTextAsList(text);
-    std::string s;
-    return getWindowSizeForText(l, font, s);
-}
-
-std::string CEGUIUtility::getStdColourAsString(int col)
-{
-	switch(col)
-	{
-		case Red:
-			return "[colour='FFFF0000']";
-		case Green:
-			return "[colour='FF00FF00']";
-		case Blue:
-			return "[colour='FF0000FF']";
-		case White:
-			return "[colour='FFFFFFFF']";
-		case Black:
-			return "[colour='FF000000']";
-		default:
-			return "";
-	}		
-}
-
-std::string CEGUIUtility::getColourizedString(int colour, std::string text, int afterColour)
-{
-	if(!afterColour > 0)
-		return getStdColourAsString(colour) + text;
-	else
-		return getStdColourAsString(colour) + text + getStdColourAsString(afterColour);
-}
-
-const size_t CEGUIUtility::getNextWord(const CEGUI::String& in_string, size_t start_idx, CEGUI::String& out_string) 
-{
-	out_string = CEGUI::TextUtils::getNextWord(in_string, start_idx, CEGUI::TextUtils::DefaultWrapDelimiters);
-	
-	return out_string.length();
-}
-
-FormatedText CEGUIUtility::fitTextToWindow(const CEGUI::String& text, float maxWidth, TextFormatting fmt, CEGUI::Font *font, float x_scale)
-{
-/*	if ((fmt == LeftAligned) || (fmt == Centred) || (fmt == RightAligned) || (fmt == Justified))
-	{
-		return std::count(text.begin(), text.end(), static_cast<CEGUI::utf8>('\n')) + 1;
-	}
-	*/
-
-	CEGUI::String newText((CEGUI::utf8*)text.c_str());
-	
-	// handle wraping cases
-	size_t lineStart = 0, lineEnd = 0;
-	CEGUI::String	sourceLine;
-
-	CEGUI::String  whitespace = CEGUI::TextUtils::DefaultWhitespace;
-	CEGUI::String	thisLine, thisWord;
-	size_t	line_count = 0, currpos = 0;
-	
-	size_t fullPosCtr = 0;
-	
-	while (lineEnd < text.length())
-	{
-		if ((lineEnd = text.find_first_of(LINE_ENDING, lineStart)) == CEGUI::String::npos)
-		{
-			lineEnd = text.length();
-		}
-		
-		sourceLine = text.substr(lineStart, lineEnd - lineStart);
-		lineStart = lineEnd + 1;
-		
-		// get first word.
-		currpos = getNextWord(sourceLine, 0, thisLine);
-		
-		// while there are words left in the string...
-		while (CEGUI::String::npos != sourceLine.find_first_not_of(whitespace, currpos))
-		{
-			// get next word of the string...
-			currpos += getNextWord(sourceLine, currpos, thisWord);
-			
-			//float davor = (font->getTextExtent(thisLine, x_scale));
-			//float danach = (font->getTextExtent(thisLine, x_scale) + font->getTextExtent(thisWord, x_scale));
-			
-			// if the new word would make the string too long
-			if ((font->getTextExtent(thisLine, x_scale) + font->getTextExtent(thisWord, x_scale)) > maxWidth)
-			{
-				// too long, so that's another line of text
-				fullPosCtr += thisLine.size();
-				line_count++;
-				
-				// remove whitespace from next word - it will form start of next line
-				thisWord = thisWord.substr(thisWord.find_first_not_of(whitespace));
-				
-				newText.insert(fullPosCtr+1, LINE_ENDING);
-				fullPosCtr += 2;
-				
-				// reset for a new line.
-				thisLine.clear();
-			}
-			
-			// add the next word to the line
-			thisLine += thisWord;
-		}
-		
-		fullPosCtr += thisLine.size();
-		// plus one for final line
-		line_count++;
-	}
-	FormatedText formt;
-	formt.text = newText;
-	formt.lines = line_count;
-	return formt;
-}
-
-
-//
-//	Other utility static functions
-//
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ceguiutility.h"
+#include "CEGUI/CEGUI.h"
+#include <iostream>
+#include <algorithm>
+#include "debug.h"
+
+
+const CEGUI::String CEGUIUtility::EventMouseEntersWindowArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Window::EventMouseEnters;
+#else
+	return CEGUI::Window::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersPushButtonArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::PushButton::EventMouseEnters;
+#else
+	return CEGUI::PushButton::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersListBoxArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Listbox::EventMouseEnters;
+#else
+	return CEGUI::Listbox::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersScrollbarArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Scrollbar::EventMouseEnters;
+#else
+	return CEGUI::Scrollbar::EventMouseEntersArea;
+#endif
+}
+
+
+const CEGUI::String CEGUIUtility::EventMouseEntersComboboxArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Combobox::EventMouseEnters;
+#else
+	return CEGUI::Combobox::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersComboDroplistArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::ComboDropList::EventMouseEnters;
+#else
+	return CEGUI::ComboDropList::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersEditboxArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Editbox::EventMouseEnters;
+#else
+	return CEGUI::Editbox::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseEntersToggleButtonArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Checkbox::EventMouseEnters;
+#else
+	return CEGUI::ToggleButton::EventMouseEntersArea;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventToggleButtonStateChanged ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Checkbox::EventCheckStateChanged;
+#else
+	return CEGUIUtility::ToggleButton::EventSelectStateChanged;
+#endif
+}
+
+const CEGUI::String CEGUIUtility::EventMouseLeavesWindowArea ()
+{
+#ifdef CEGUI_07
+	return CEGUI::Window::EventMouseLeaves;
+#else
+	return CEGUI::Window::EventMouseLeavesArea;
+#endif
+}
+
+
+std::string CEGUIUtility::stripColours(const std::string &input)
+{
+    std::string output = input;
+
+    std::string::size_type pos = output.find("[");
+    while (pos != std::string::npos)
+    {
+        output.erase(pos,pos+19);
+        pos = output.find("[");
+    }
+
+    return output;
+}
+
+std::list< std::string > CEGUIUtility::getTextAsList(const std::string &text)
+{
+    std::list<std::string> l;
+    std::string temp = text;
+	
+    std::string::size_type pos = text.find_first_of(LINE_ENDING);
+    while (pos != std::string::npos)
+    {
+        // ignore new line directly at the beginning of the string
+        if (pos != 0)
+        {
+            l.push_back(temp.substr(0, pos));
+            temp.erase(0, pos+ERASE_CNT);
+            pos = temp.find(LINE_ENDING);
+        }
+        else
+		{
+			temp.erase(0, ERASE_CNT);
+			//l.push_back(" ");
+			pos = temp.find(LINE_ENDING);
+		}
+    }
+    
+    if (temp != "")
+	{
+		l.push_back(temp);
+	}
+	
+    return l;
+}
+
+CEGUI::UVector2 CEGUIUtility::getWindowSizeForText(std::list<std::string> textlist, const CEGUI::Font *font, std::string &added)
+{
+    using namespace CEGUI;
+
+    float textWidth = 0.0f;
+    float textHeight = 0.0f;
+
+#ifdef CEGUI_07
+	CEGUI::Size screenSize = CEGUI::System::getSingleton().getRenderer()->getDisplaySize();
+#else
+    CEGUI::Sizef screenSize (CEGUI::System::getSingleton().getRenderer()->getDisplaySize ());
+#endif
+
+    added.clear();
+	size_t count = 0;
+	
+    for (std::list<std::string>::iterator iter = textlist.begin();
+		iter != textlist.end();
+		++iter)
+    {
+		std::string & s = *iter;
+		
+		if (!s.empty())
+		{
+			std::string::size_type word_pos = 0;
+			while ( word_pos!=std::string::npos )
+			{
+				word_pos = s.find ( LINE_ENDING, word_pos );
+				if ( word_pos != std::string::npos )
+				{
+					++count;
+
+					// start next search after this word
+					word_pos += 2;
+				}
+			}
+			
+			added.append (s.c_str ());
+			added.append ("\n");
+
+			float tempwidth = font->getTextExtent(stripColours(s).c_str()) ;
+			if (tempwidth > textWidth)
+				textWidth = tempwidth;
+		}
+    }
+
+	// increase the counter intil we have at least one line break more than we have text
+	if (count <= textlist.size())  
+		count = textlist.size() + 1;
+
+	textHeight = count * (font->getLineSpacing());
+
+    return UVector2(UDim((textWidth/screenSize.d_width) + 0.05f, 0), UDim(textHeight / screenSize.d_height, 0) );
+}
+
+CEGUI::UVector2 CEGUIUtility::getWindowSizeForText (std::string text, const CEGUI::Font* font)
+{
+    std::list<std::string> l = getTextAsList(text);
+    std::string s;
+    return getWindowSizeForText(l, font, s);
+}
+
+std::string CEGUIUtility::getStdColourAsString(int col)
+{
+	switch(col)
+	{
+		case Red:
+			return "[colour='FFFF0000']";
+		case Green:
+			return "[colour='FF00FF00']";
+		case Blue:
+			return "[colour='FF0000FF']";
+		case White:
+			return "[colour='FFFFFFFF']";
+		case Black:
+			return "[colour='FF000000']";
+		default:
+			return "";
+	}		
+}
+
+std::string CEGUIUtility::getColourizedString(int colour, std::string text, int afterColour)
+{
+	if(afterColour == 0)
+		return getStdColourAsString(colour) + text;
+	else
+		return getStdColourAsString(colour) + text + getStdColourAsString(afterColour);
+}
+
+const size_t CEGUIUtility::getNextWord(const CEGUI::String& in_string, size_t start_idx, CEGUI::String& out_string) 
+{
+	out_string = CEGUI::TextUtils::getNextWord(in_string, start_idx, CEGUI::TextUtils::DefaultWrapDelimiters);
+	
+	return out_string.length();
+}
+
+FormatedText CEGUIUtility::fitTextToWindow(const CEGUI::String& text, float maxWidth, TextFormatting fmt, const CEGUI::Font *font, float x_scale)
+{
+/*	if ((fmt == LeftAligned) || (fmt == Centred) || (fmt == RightAligned) || (fmt == Justified))
+	{
+		return std::count(text.begin(), text.end(), static_cast<CEGUI::utf8>('\n')) + 1;
+	}
+	*/
+
+	CEGUI::String newText((CEGUI::utf8*)text.c_str());
+	
+	// handle wraping cases
+	size_t lineStart = 0, lineEnd = 0;
+	CEGUI::String	sourceLine;
+
+	CEGUI::String  whitespace = CEGUI::TextUtils::DefaultWhitespace;
+	CEGUI::String	thisLine, thisWord;
+	size_t	line_count = 0, currpos = 0;
+	
+	size_t fullPosCtr = 0;
+	
+	while (lineEnd < text.length())
+	{
+		if ((lineEnd = text.find_first_of(LINE_ENDING, lineStart)) == CEGUI::String::npos)
+		{
+			lineEnd = text.length();
+		}
+		
+		sourceLine = text.substr(lineStart, lineEnd - lineStart);
+		lineStart = lineEnd + 1;
+		
+		// get first word.
+		currpos = getNextWord(sourceLine, 0, thisLine);
+		
+		// while there are words left in the string...
+		while (CEGUI::String::npos != sourceLine.find_first_not_of(whitespace, currpos))
+		{
+			// get next word of the string...
+			currpos += getNextWord(sourceLine, currpos, thisWord);
+			
+			//float davor = (font->getTextExtent(thisLine, x_scale));
+			//float danach = (font->getTextExtent(thisLine, x_scale) + font->getTextExtent(thisWord, x_scale));
+			
+			// if the new word would make the string too long
+			if ((font->getTextExtent(thisLine, x_scale) + font->getTextExtent(thisWord, x_scale)) > maxWidth)
+			{
+				// too long, so that's another line of text
+				fullPosCtr += thisLine.size();
+				line_count++;
+				
+				// remove whitespace from next word - it will form start of next line
+				thisWord = thisWord.substr(thisWord.find_first_not_of(whitespace));
+				
+				newText.insert(fullPosCtr+1, LINE_ENDING);
+				fullPosCtr += 2;
+				
+				// reset for a new line.
+				thisLine.clear();
+			}
+			
+			// add the next word to the line
+			thisLine += thisWord;
+		}
+		
+		fullPosCtr += thisLine.size();
+		// plus one for final line
+		line_count++;
+	}
+	FormatedText formt;
+	formt.text = newText;
+	formt.lines = line_count;
+	return formt;
+}
+
+
+//
+//	Other utility static functions
+//
+
+
+		/**
+			Add a child widget to a CEGUI widget
+			@param parentPtr The parent pointer to the CEGUI Window
+			@param childPtr The child pointer to the CEGUI Window.
+		*/
+		void CEGUIUtility::addChildWidget (CEGUI::Window* parentPtr, CEGUI::Window* childPtr)
+		{
+			if (0 == parentPtr)
+			{
+				throw CEGUIUtilityNullPointerException ("addChildWidget received a null parent pointer");
+			}
+			if (0 == childPtr)
+			{
+				throw CEGUIUtilityNullPointerException ("addChildWidget received a null child pointer");
+			}
+
+#ifdef CEGUI_07
+			parentPtr->addChildWindow (childPtr);
+#else
+			parentPtr->addChild (childPtr);
+			SW_DEBUG ("[ceguiutil] Added item: [%s] to [%s]", childPtr->getNamePath ().c_str (), parentPtr->getNamePath ().c_str ());
+#endif
+		}
+
+
+		/**
+			Remove a child widget from a CEGUI widget
+			@param parentPtr The parent pointer to the CEGUI Window
+			@param childPtr The child pointer to the CEGUI Window.
+		*/
+		void CEGUIUtility::removeChildWidget (CEGUI::Window* parentPtr, CEGUI::Window* childPtr)
+		{
+#ifdef CEGUI_07
+			parentPtr->removeChildWindow (childPtr);
+#else
+			parentPtr->removeChild (childPtr);
+#endif
+		}
+
+
+#ifdef CEGUI_07
+	CEGUI::ImagesetManager& CEGUIUtility::getImageManager ()
+	{
+		return CEGUI::ImagesetManager::getSingleton();
+	}
+#else
+	CEGUI::ImageManager& CEGUIUtility::getImageManager ()
+	{
+		return CEGUI::ImageManager::getSingleton();
+	}
+#endif
+
+	void CEGUIUtility::loadImageset (const CEGUI::String& name)
+	{
+		SW_DEBUG ("Loading imageset file [%s]", name.c_str ());
+#ifdef CEGUI_07
+		CEGUI::ImagesetManager::getSingleton().create(name);
+#else
+		CEGUI::ImageManager::getSingleton().loadImageset(name);
+#endif
+	}
+
+	void CEGUIUtility::addManagedImageFromFile (const CEGUI::String& name, const CEGUI::String& fileName, const CEGUI::String& resourceGroup)
+	{
+#ifdef CEGUI_07
+		CEGUI::ImagesetManager::getSingleton().createFromImageFile (name, fileName, resourceGroup);
+#else
+		CEGUI::ImageManager::getSingleton().addFromImageFile (name, fileName, resourceGroup);
+#endif
+	}
+
+
+
 CEGUI::Window* CEGUIUtility::getWindow (const CEGUI::String& name)
 {
 	CEGUI::System* ceguiSysPtr_ = CEGUI::System::getSingletonPtr ();
 	return getWindowForSystem (ceguiSysPtr_, name);
 }
 
+void CEGUIUtility::dumpFullWindowToLog (CEGUI::Window* startingWindow, int level)
+{
+	if (0 == startingWindow)
+	{
+		return;
+	}
+
+	// Write the current element.
+	std::stringstream ss;
+	ss << level << ":";
+	for (int i = 0; i < level ; ++ i)
+	{
+		ss << "    ";
+	}
+	
+	int numChildren = startingWindow->getChildCount ();
+	SW_DEBUG ("%s%s (%d children)", ss.str ().c_str (), startingWindow->getName().c_str (), numChildren);
+	for (int i = 0; i < numChildren; ++ i)
+	{
+		CEGUI::Window* childPtr = startingWindow->getChildAtIdx (i);
+		dumpFullWindowToLog (childPtr, level + 1);
+	}
+}
+
+
 // static
 CEGUI::Window* CEGUIUtility::getWindowForSystem (CEGUI::System* sys, const CEGUI::String& name)
 {
@@ -249,147 +447,479 @@
 	}
 #else
 	CEGUI::Window* root = sys->getDefaultGUIContext().getRootWindow();
-	if (root->isChild (name))
+	if (0 == root)
+	{
+		SW_DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window");
+		return 0;
+	}
+
+	try
 	{
-		return root->getChild (name);
+		if (name.length () <= 0)
+		{
+			SW_DEBUG ("Warning! Attempting to get an unnamed widget from the root window");
+		}
+
+		if (root->isChild (name))
+		{
+			return root->getChild (name);
+		}
+		else
+		{
+			if (root->getName () == name)
+			{
+				return root;
+			}
+			else
+			{
+				int numChildren = root->getChildCount ();
+				SW_DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ());
+				for (int i = 0; i < numChildren; ++ i)
+				{
+					CEGUI::Window* childPtr = root->getChildAtIdx (i);
+					if (0 == childPtr)
+					{
+						continue;
+					}
+
+					SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ());
+				}
+
+				// Show how much of the path was matched.
+				SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ());
+			}
+		}
 	}
-	else
+	catch (std::exception &ex)
 	{
+		// Just display the list of child nodes. Then repackage the exception and throw it further along.
+		int numChildren = root->getChildCount ();
+		SW_DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ());
+		for (int i = 0; i < numChildren; ++ i)
+		{
+			CEGUI::Window* childPtr = root->getChildAtIdx (i);
+			if (0 == childPtr)
+			{
+				continue;
+			}
+
+			SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ());
+		}
+
+		// Show how much of the path was matched.
+		SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ());
+		throw ex;
 	}
 #endif
 	return 0;
 }
 
-
-void CEGUIUtility::injectKeyDown (OIS::KeyCode myKey)
+//static
+CEGUI::Window* CEGUIUtility::getWindowForSystemNoEx (CEGUI::System* sys, const CEGUI::String& name)
 {
-	injectKeyDown (CEGUI::System::getSingletonPtr(), myKey);
-}
+	CEGUI::Window* root = sys->getDefaultGUIContext().getRootWindow();
+	if (0 == root)
+	{
+		SW_DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window");
+		return 0;
+	}
 
-void CEGUIUtility::injectKeyDown (CEGUI::System* sys, OIS::KeyCode myKey)
-{
-	if (!sys)
+	try
 	{
-		return;
+		if (name.length () <= 0)
+		{
+			SW_DEBUG ("Warning! Attempting to get an unnamed widget from the root window");
+		}
+
+		if (root->isChild (name))
+		{
+			return root->getChild (name);
+		}
 	}
-#ifdef CEGUI_07
-sys->injectKeyDown (myKey);
-#else
-sys->getDefaultGUIContext ().injectKeyDown (static_cast<CEGUI::Key::Scan> (myKey));
-#endif
-}
+	catch (std::exception)
+	{
+		return 0;
+	}
 
-void CEGUIUtility::injectKeyUp (OIS::KeyCode myKey)
-{
-	injectKeyUp (CEGUI::System::getSingletonPtr(), myKey);
+	return 0;
 }
 
 
-void CEGUIUtility::injectKeyUp (CEGUI::System* sys, OIS::KeyCode myKey)
+	std::vector <std::string> CEGUIUtility::SplitByChar (const std::string& source, const char delimiter)
+	{
+		std::vector <std::string> result;
+		std::stringstream splitter (source);
+		std::string tempItem ("");
+
+		// split the items and add them to the vector.
+		while (std::getline (splitter, tempItem, delimiter))
+		{
+			result.push_back (tempItem);
+		}
+
+		// If we have an empty string, just return the existing content.
+		if (source.length () <= 0)
+		{
+			return result;
+		}
+
+		// If the last char is the separator... add an empty entry.
+		// An elegant way: dereference the reverse iterator. C++11 has support for back().
+
+		const char lastChar = *source.rbegin ();
+		if (lastChar == delimiter)
+		{
+			result.push_back (std::string (""));
+		}
+
+		return result;
+	}
+
+
+	CEGUI::String CEGUIUtility::getMatchingPath (CEGUI::Window* parentWnd, const CEGUI::String& fullWidgetPath)
+	{
+		CEGUI::String result;
+		if (0 == parentWnd)
+		{
+			return result;
+		}
+
+		// Split the string into tokens separated by the slash char.
+		std::vector<std::string> stringList (CEGUIUtility::SplitByChar (fullWidgetPath.c_str(), '/'));
+		std::vector<std::string>::iterator currentToken = stringList.begin ();
+		CEGUI::Window* currentWidget = parentWnd;
+
+		bool foundChild = true;
+		while (foundChild && currentToken != stringList.end ())
+		{
+			// Check to see whether the current token is a child of the current window.
+			int numChildren = currentWidget->getChildCount ();
+			foundChild = false;
+			std::string defToken = *currentToken;
+			CEGUI::String castedName = CEGUI::String (defToken.c_str ());
+
+			for (int i = 0; i < numChildren && !foundChild; ++ i)
+			{
+				CEGUI::Window* childPtr = currentWidget->getChildAtIdx (i);
+				if (0 == childPtr)
+				{
+					continue;
+				}
+				
+
+				// It seems we found this one.
+				if (childPtr->getName () == castedName)
+				{
+					foundChild = true;
+					currentWidget = childPtr;
+					result.append ("/");
+					result.append (currentWidget->getName ());
+					SW_DEBUG ("Child [%d]: [%s]", i, currentWidget->getName ().c_str ());
+
+					// Move to the next token (child name) in the string.
+					++ currentToken;
+				}
+			}
+
+			if (!foundChild)
+			{
+				SW_DEBUG ("Could not find child [%s] within %d children of [%s]", castedName.c_str (), numChildren, currentWidget->getName ().c_str ());
+				for (int i = 0; i < numChildren; ++ i)
+				{
+					CEGUI::Window* childPtr = currentWidget->getChildAtIdx (i);
+					if (0 == childPtr)
+					{
+						continue;
+					}
+
+					SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ());
+				}
+			}
+		}
+
+		return result;
+	}
+
+	CEGUI::Window* CEGUIUtility::getWindowForLoadedLayout (CEGUI::Window* parentWnd, const CEGUI::String& name)
+	{
+#ifdef CEGUI_07
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
+		if (win_mgr.isWindowPresent (name))
+		{
+			return win_mgr.getWindow (name);
+		}
+#else
+		if (0 == parentWnd)
+		{
+			SW_DEBUG ("Null parent received.");
+			return 0;
+		}
+
+		if (parentWnd->isChild (name))
+		{
+			return parentWnd->getChild (name);
+		}
+		else
+		{
+			if (parentWnd->getName () == name)
+			{
+				return parentWnd;
+			}
+			else
+			{
+				int numChildren = parentWnd->getChildCount ();
+				SW_DEBUG ("Could not find child [%s] within %d children of [%s]", name.c_str (), numChildren, parentWnd->getName ().c_str ());
+				for (int i = 0; i < numChildren; ++ i)
+				{
+					CEGUI::Window* childPtr = parentWnd->getChildAtIdx (i);
+					if (0 == childPtr)
+					{
+						continue;
+					}
+
+					SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ());
+				}
+
+				// Show how much of the path was matched.
+				SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath(parentWnd, name).c_str());
+			}
+		}
+#endif
+		return 0;
+	}
+
+
+	CEGUI::Window* CEGUIUtility::getWindowForLoadedLayoutEx (CEGUI::Window* parentWnd, const CEGUI::String& name)
+	{
+		CEGUI::Window* result = CEGUIUtility::getWindowForLoadedLayout(parentWnd, name);
+		if (0 == result)
+		{
+			std::string errorText ("Could not find widget/window named [");
+			errorText.append (name.c_str ());
+			errorText.append ("] starting from parent window [");
+			if (0 != parentWnd)
+			{
+				errorText.append (parentWnd->getName ().c_str ());
+			}
+			else
+			{
+				errorText.append ("NULL");
+			}
+			errorText.append ("]");
+
+			throw CEGUIUtilityNoWidgetException (errorText.c_str ());
+		}
+
+		return result;
+	}
+
+
+	CEGUI::Window* CEGUIUtility::getWindowContainingMouse (CEGUI::System* sys)
+	{
+#ifdef CEGUI_07
+		return sys->getWindowContainingMouse ();
+#else
+		return sys->getDefaultGUIContext ().getWindowContainingMouse ();
+#endif
+	}
+
+	bool CEGUIUtility::isWindowPresent (const CEGUI::String& name)
+	{
+#ifdef CEGUI_07
+		return (0 != getWindow (name));
+#else
+		return (0 != getWindowForSystemNoEx (CEGUI::System::getSingletonPtr (), name));
+#endif
+	}
+
+	bool CEGUIUtility::isWindowPresentForSystem (CEGUI::System* sys, const CEGUI::String& name)
+	{
+		return (0 != getWindowForSystem (sys, name));
+	}
+
+	CEGUI::Window* CEGUIUtility::loadLayoutFromFile (const CEGUI::String& name, const CEGUI::String& resGroup)
+	{
+#ifdef CEGUI_07
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
+		return win_mgr.loadWindowLayout (name, resGroup);
+#else
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
+		return win_mgr.loadLayoutFromFile (name, resGroup);
+#endif
+	}
+		
+
+
+bool CEGUIUtility::injectKeyDown (OIS::KeyCode myKey)
+{
+	return injectKeyDown (CEGUI::System::getSingletonPtr(), myKey);
+}
+
+bool CEGUIUtility::injectKeyDown (CEGUI::System* sys, OIS::KeyCode myKey)
 {
 	if (!sys)
 	{
-		return;
+		return false;
 	}
 #ifdef CEGUI_07
-sys->injectKeyUp (myKey);
+	return sys->injectKeyDown (myKey);
 #else
-sys->getDefaultGUIContext ().injectKeyUp (static_cast<CEGUI::Key::Scan> (myKey));
+	return sys->getDefaultGUIContext ().injectKeyDown (static_cast<CEGUI::Key::Scan> (myKey));
 #endif
 }
 
+bool CEGUIUtility::injectKeyUp (OIS::KeyCode myKey)
+{
+	return injectKeyUp (CEGUI::System::getSingletonPtr(), myKey);
+}
+
 
-void CEGUIUtility::injectChar (int myKey)
-{
-	injectChar (CEGUI::System::getSingletonPtr(), myKey);
-}
-
-
-void CEGUIUtility::injectChar (CEGUI::System* sys, int myKey)
+bool CEGUIUtility::injectKeyUp (CEGUI::System* sys, OIS::KeyCode myKey)
 {
 	if (!sys)
 	{
-		return;
+		return false;
 	}
 #ifdef CEGUI_07
-sys->injectChar (myKey);
+	return sys->injectKeyUp (myKey);
 #else
-sys->getDefaultGUIContext ().injectChar (static_cast<CEGUI::Key::Scan> (myKey));
+	return sys->getDefaultGUIContext ().injectKeyUp (static_cast<CEGUI::Key::Scan> (myKey));
 #endif
 }
 
 
-void CEGUIUtility::injectMousePosition (float x, float y)
+bool CEGUIUtility::injectChar (int myKey)
 {
-	injectMousePosition (CEGUI::System::getSingletonPtr(), x, y);
+	return injectChar (CEGUI::System::getSingletonPtr(), myKey);
 }
 
-void CEGUIUtility::injectMousePosition (CEGUI::System* sys, float x, float y)
+
+bool CEGUIUtility::injectChar (CEGUI::System* sys, int myKey)
 {
 	if (!sys)
 	{
-		return;
+		return false;
 	}
 #ifdef CEGUI_07
-sys->injectMousePosition (x, y);
+	return sys->injectChar (myKey);
 #else
-sys->getDefaultGUIContext ().injectMousePosition (x, y);
+	return sys->getDefaultGUIContext ().injectChar (static_cast<CEGUI::Key::Scan> (myKey));
 #endif
 }
 
-void CEGUIUtility::injectMouseWheelChange (float pos)
+
+bool CEGUIUtility::injectMousePosition (float x, float y)
 {
-	injectMouseWheelChange (CEGUI::System::getSingletonPtr(), pos);
+	return injectMousePosition (CEGUI::System::getSingletonPtr(), x, y);
 }
 
-void CEGUIUtility::injectMouseWheelChange (CEGUI::System* sys, float pos)
+bool CEGUIUtility::injectMousePosition (CEGUI::System* sys, float x, float y)
 {
 	if (!sys)
 	{
-		return;
+		return false;
 	}
 #ifdef CEGUI_07
-sys->injectMouseWheelChange (pos);
+	return sys->injectMousePosition (x, y);
 #else
-sys->getDefaultGUIContext ().injectMouseWheelChange (pos);
+	return sys->getDefaultGUIContext ().injectMousePosition (x, y);
+#endif
+}
+
+bool CEGUIUtility::injectMouseWheelChange (float pos)
+{
+	return injectMouseWheelChange (CEGUI::System::getSingletonPtr(), pos);
+}
+
+bool CEGUIUtility::injectMouseWheelChange (CEGUI::System* sys, float pos)
+{
+	if (!sys)
+	{
+		return false;
+	}
+#ifdef CEGUI_07
+	return sys->injectMouseWheelChange (pos);
+#else
+	return sys->getDefaultGUIContext ().injectMouseWheelChange (pos);
 #endif
 }
 
-void CEGUIUtility::injectMouseButtonDown (OIS::MouseButtonID btn)
+bool CEGUIUtility::injectMouseButtonDown (OIS::MouseButtonID btn)
 {
-	injectMouseButtonDown (CEGUI::System::getSingletonPtr(), btn);
+	return injectMouseButtonDown (CEGUI::System::getSingletonPtr(), btn);
 }
 
-void CEGUIUtility::injectMouseButtonDown (CEGUI::System* sys, OIS::MouseButtonID btn)
+bool CEGUIUtility::injectMouseButtonDown (CEGUI::System* sys, OIS::MouseButtonID btn)
 {
 	if (!sys)
 	{
-		return;
+		return false;
 	}
 #ifdef CEGUI_07
-sys->injectMouseButtonDown (convertOISButtonToCegui (btn));
+	return sys->injectMouseButtonDown (convertOISButtonToCegui (btn));
 #else
-sys->getDefaultGUIContext ().injectMouseButtonDown (convertOISButtonToCegui (btn));
+	return sys->getDefaultGUIContext ().injectMouseButtonDown (convertOISButtonToCegui (btn));
+#endif
+}
+
+bool CEGUIUtility::injectMouseButtonUp (OIS::MouseButtonID btn)
+{
+	return injectMouseButtonUp (CEGUI::System::getSingletonPtr(), btn);
+}
+
+bool CEGUIUtility::injectMouseButtonUp (CEGUI::System* sys, OIS::MouseButtonID btn)
+{
+	if (!sys)
+	{
+		return false;
+	}
+#ifdef CEGUI_07
+	return sys->injectMouseButtonUp (convertOISButtonToCegui (btn));
+#else
+	return sys->getDefaultGUIContext ().injectMouseButtonUp (convertOISButtonToCegui (btn));
 #endif
 }
 
-void CEGUIUtility::injectMouseButtonUp (OIS::MouseButtonID btn)
-{
-	injectMouseButtonUp (CEGUI::System::getSingletonPtr(), btn);
-}
+	void CEGUIUtility::injectTimePulse (float timeElapsed)
+	{
+		injectTimePulse (CEGUI::System::getSingletonPtr(), timeElapsed);
+	}
 
-void CEGUIUtility::injectMouseButtonUp (CEGUI::System* sys, OIS::MouseButtonID btn)
-{
-	if (!sys)
+
+	void CEGUIUtility::injectTimePulse (CEGUI::System* sys, float timeElapsed)
 	{
-		return;
+		if (!sys)
+		{
+			return;
+		}
+#ifdef CEGUI_07
+		sys->injectTimePulse (timeElapsed);
+#else
+		sys->injectTimePulse (timeElapsed);
+		sys->getDefaultGUIContext ().injectTimePulse (timeElapsed);
+#endif
+
 	}
+
+	void CEGUIUtility::loadScheme (const CEGUI::String& schemeName, const CEGUI::String& resGroup)
+	{
 #ifdef CEGUI_07
-sys->injectMouseButtonUp (convertOISButtonToCegui (btn));
+		CEGUI::SchemeManager::getSingleton().create ((CEGUI::utf8*)schemeName.c_str (), (CEGUI::utf8*)resGroup.c_str ());
 #else
-sys->getDefaultGUIContext ().injectMouseButtonUp (convertOISButtonToCegui (btn));
+		CEGUI::SchemeManager::getSingleton().createFromFile ((CEGUI::utf8*)schemeName.c_str (), (CEGUI::utf8*)resGroup.c_str ());
 #endif
-}
+	}
+
+	void CEGUIUtility::addFont (const CEGUI::String& fontName, const CEGUI::String& resGroup)
+	{
+#ifdef CEGUI_07
+		CEGUI::FontManager::getSingleton ().create ((CEGUI::utf8*)fontName.c_str (), (CEGUI::utf8*)resGroup.c_str ());
+#else
+		CEGUI::FontManager::getSingleton ().createFromFile ((CEGUI::utf8*)fontName.c_str (), (CEGUI::utf8*)resGroup.c_str ());
+#endif
+	}
+
+
 
 CEGUI::MouseButton CEGUIUtility::convertOISButtonToCegui (int buttonID)
 {
@@ -429,6 +959,18 @@
 }
 
 
+std::string CEGUIUtility::getImageNameWithSkin (const std::string& skinName, const std::string& imageName)
+{
+	std::stringstream ss;
+#ifdef CEGUI_07
+	ss << "set:" << skinName << " image:" << imageName;
+#else
+	ss << skinName << "/" << imageName;
+#endif
+	return ss.str ();
+}
+
+
 void CEGUIUtility::setScrollPositionForWidget (const CEGUI::String& widgetName, float newScrollPosition)
 {
 	CEGUI::Scrollbar* scroller;
@@ -457,15 +999,132 @@
 	}
 }
 
+CEGUI::Font* CEGUIUtility::getDefaultFont ()
+{
+#ifdef CEGUI_07
+	return CEGUI::System::getSingleton().getDefaultFont ();
+#else
+	return CEGUI::System::getSingletonPtr ()->getDefaultGUIContext ().getDefaultFont ();
+#endif
+}
+
 
 void CEGUIUtility::setDefaultMouseCursor (CEGUI::System* sys, const std::string& skinName, const std::string& cursorName)
 {
+#ifdef CEGUI_07
 	sys->setDefaultMouseCursor ((CEGUI::utf8*)skinName.c_str (), (CEGUI::utf8*)cursorName.c_str ());
+#else
+	std::stringstream ss;
+	ss << skinName << "/" << cursorName;
+	sys->getDefaultGUIContext ().getMouseCursor ().setDefaultImage (ss.str ());
+	sys->getDefaultGUIContext ().getMouseCursor ().setImage (ss.str ());
+#endif
+}
+
+
+void CEGUIUtility::setDefaultTooltip (CEGUI::System* sys, const std::string& skinName, const std::string& tooltipName)
+{
+#ifdef CEGUI_07
+	std::stringstream ss;
+	ss << skinName << "/" << tooltipName;
+	sys->setDefaultTooltip(ss.str ().c_str ());
+#else
+	std::stringstream ss;
+	ss << skinName << "/" << tooltipName;
+	sys->getDefaultGUIContext ().setDefaultTooltipType (ss.str ().c_str ());
+	sys->getDefaultGUIContext ().markAsDirty ();
+#endif
+}
+
+
+CEGUIUtility::Vector2f CEGUIUtility::getMouseCursorPosition (CEGUI::System* sys)
+{
+#ifdef CEGUI_07
+	return CEGUI::MouseCursor::getSingleton().getPosition();
+#else
+	return sys->getDefaultGUIContext ().getMouseCursor ().getPosition ();
+#endif
+}
+
+void CEGUIUtility::setWidgetSizeRel (CEGUI::Window* widget, float width, float height)
+{
+#ifdef CEGUI_07
+	widget->setSize (CEGUI::UVector2 (cegui_reldim (width), cegui_reldim (height)));
+	
+#else
+	CEGUI::UDim horz (width, 0);
+	CEGUI::UDim vert (height, 0);
+	CEGUI::USize mySize (horz, vert);
+	widget->setSize (mySize);
+#endif
 }
 
-void CEGUIUtility::setDefaultTooltip (CEGUI::System* sys, const std::string& skinName, const std::string& cursorName)
+CEGUI::UVector2 CEGUIUtility::getWidgetSize (CEGUI::Window* widget)
+{
+#ifdef CEGUI_07
+	return widget->getSize ();
+#else
+	CEGUI::UVector2 result;
+	result.d_x = widget->getSize ().d_width;
+	result.d_y = widget->getSize ().d_height;
+	return result;
+#endif
+}
+
+
+void CEGUIUtility::setWidgetSizeAbs (CEGUI::Window* widget, float width, float height)
+{
+#ifdef CEGUI_07
+	widget->setSize (CEGUI::UVector2 (cegui_reldim (width), cegui_reldim (height)));
+	
+#else
+	CEGUI::UDim horz (0, width);
+	CEGUI::UDim vert (0, height);
+	CEGUI::USize mySize (horz, vert);
+	widget->setSize (mySize);
+#endif
+}
+
+
+void CEGUIUtility::setWidgetSize (CEGUI::Window* widget, CEGUI::UVector2 size)
 {
-	std::stringstream ss;
-	ss << skinName << "/" << cursorName;
-	sys->setDefaultTooltip (ss.str ().c_str ());
-}
\ No newline at end of file
+#ifdef CEGUI_07
+	widget->setSize (size);
+#else
+	CEGUI::UDim horz (size.d_x);
+	CEGUI::UDim vert (size.d_y);
+	CEGUI::USize mySize (horz, vert);
+	widget->setSize (mySize);
+#endif
+}
+
+void CEGUIUtility::setWidgetMaxSize (CEGUI::Window* widget, CEGUI::UVector2 size)
+{
+#ifdef CEGUI_07
+	widget->setSize (size);
+#else
+	CEGUI::UDim horz (size.d_x);
+	CEGUI::UDim vert (size.d_y);
+	CEGUI::USize mySize (horz, vert);
+	widget->setMaxSize (mySize);
+#endif
+}
+
+
+void CEGUIUtility::setRootSheet (CEGUI::System* sys, CEGUI::Window* widget)
+{
+#ifdef CEGUI_07
+	sys->setGUISheet (widget);
+#else
+	sys->getDefaultGUIContext ().setRootWindow (widget);
+#endif
+}
+
+CEGUI::Window* CEGUIUtility::getRootSheet (CEGUI::System* sys)
+{
+#ifdef CEGUI_07
+	return 	sys->getGUISheet ();
+#else
+	return 	sys->getDefaultGUIContext ().getRootWindow ();
+#endif
+}
--- a/src/gui/ceguiutility.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/ceguiutility.h	Thu Mar 20 19:04:28 2014 +0100
@@ -17,19 +17,19 @@
 #define __SUMWARS_GUI_CEGUIUTILITY_H__
 
 // Define the CEGUI version. TODO: move to a global definition.
-#define CEGUI_07
+//#define CEGUI_07
 
 #ifdef CEGUI_07
 #include "CEGUI.h"
+#include "CEGUI/CEGUIUDim.h"
+#include "CEGUI/CEGUIFont.h"
 #else
-#include "cegui/CEGUI.h"
+#include "CEGUI/CEGUI.h"
 #endif
 
-#include "CEGUI/CEGUIUDim.h"
-#include "CEGUI/CEGUIFont.h"
 #include <list>
 #include <string>
-#include <OIS/OIS.h>
+#include <OIS.h>
 
 struct FormatedText
 {
@@ -41,6 +41,45 @@
 #define LINE_ENDING "\n"
 #define ERASE_CNT 1
 
+
+/**
+	A class to hold a custom exception.
+	This is a copy of a CEGUI exception.
+*/
+class CEGUIUtilityNoWidgetException
+	: public std::exception
+{
+public:
+	CEGUIUtilityNoWidgetException (const char* exceptionText)
+        : std::exception()
+	{
+	};
+
+	CEGUIUtilityNoWidgetException (const std::string& exceptionText)
+        : std::exception()
+	{
+	};
+};
+
+/**
+	A class to hold a custom exception.
+*/
+class CEGUIUtilityNullPointerException
+	: public std::exception
+{
+public:
+	CEGUIUtilityNullPointerException (const char* exceptionText)
+        : std::exception()
+	{
+	};
+
+	CEGUIUtilityNullPointerException (const std::string& exceptionText)
+        : std::exception()
+	{
+	};
+};
+
+
 /**
 	A class to be used as a namespace placeholder for most CEGUI functionality.
 	This is to alleviate some of the issues caused by a change in the API syntax between various versions of CEGUI.
@@ -75,6 +114,49 @@
 			WordWrapJustified
 		};
 
+		static const CEGUI::String EventMouseEntersWindowArea ();
+		static const CEGUI::String EventMouseEntersPushButtonArea ();
+		static const CEGUI::String EventMouseEntersListBoxArea ();
+		static const CEGUI::String EventMouseEntersScrollbarArea ();
+		static const CEGUI::String EventMouseEntersComboboxArea ();
+		static const CEGUI::String EventMouseEntersComboDroplistArea ();
+		static const CEGUI::String EventMouseEntersEditboxArea ();
+		static const CEGUI::String EventMouseEntersToggleButtonArea ();
+		static const CEGUI::String EventToggleButtonStateChanged ();
+		static const CEGUI::String EventMouseLeavesWindowArea ();
+
+#ifdef CEGUI_07
+		typedef CEGUI::Rect Rectf ;
+#else
+		typedef CEGUI::Rectf Rectf;
+#endif
+
+//#ifdef CEGUI_07
+//		typedef CEGUI::Rect CachedRectf ;
+//#else
+//		typedef CEGUI::Element::CachedRectf CachedRectf;
+//#endif
+
+
+#ifdef CEGUI_07
+		typedef CEGUI::Checkbox ToggleButton ;
+#else
+		typedef CEGUI::ToggleButton ToggleButton ;
+#endif
+
+#ifdef CEGUI_07
+		typedef CEGUI::Point Vector2f ;
+#else
+		typedef CEGUI::Vector2f Vector2f;
+#endif
+
+#ifdef CEGUI_07
+		typedef CEGUI::Size Size;
+#else
+		typedef CEGUI::Size<float> Size;
+#endif
+
+
 		enum Colours
 		{
 			Red = 1,
@@ -92,7 +174,7 @@
 		* \param added The complete list joined together as one string is writen into this argument
 		* \returns The size of the text as a CEGUI::UVector2
 		*/
-		static CEGUI::UVector2 getWindowSizeForText(std::list<std::string> list, CEGUI::Font *font, std::string &added);
+		static CEGUI::UVector2 getWindowSizeForText(std::list<std::string> list, const CEGUI::Font *font, std::string &added);
 
 		/**
 		* \fn static CEGUI::UVector2 getWindowSizeForText(std::string text, CEGUI::Font *font)
@@ -101,7 +183,7 @@
 		* \param font the CEGUI::Fonts thats used
 		* \returns The size of the text as a CEGUI::UVector2
 		*/
-		static CEGUI::UVector2 getWindowSizeForText(std::string text, CEGUI::Font *font);
+		static CEGUI::UVector2 getWindowSizeForText(std::string text, const CEGUI::Font *font);
 
 		/**
 		* \fn static std::list<std::string> getTextAsList(std::string text)
@@ -147,32 +229,82 @@
 		* \param x_scale Optional text scale
 		* \returns the formated text and the line count
 		*/
-		static FormatedText fitTextToWindow (const CEGUI::String& text, float maxWidth, TextFormatting fmt, CEGUI::Font *font, float x_scale = 1.0f);
+		static FormatedText fitTextToWindow (const CEGUI::String& text, float maxWidth, TextFormatting fmt, const CEGUI::Font *font, float x_scale = 1.0f);
 		
+		/**
+			Add a child widget to a CEGUI widget
+			@param parentPtr The parent pointer to the CEGUI Window
+			@param childPtr The child pointer to the CEGUI Window.
+		*/
+		static void addChildWidget (CEGUI::Window* parentPtr, CEGUI::Window* childPtr);
+
+		/**
+			Remove a child widget from a CEGUI widget
+			@param parentPtr The parent pointer to the CEGUI Window
+			@param childPtr The child pointer to the CEGUI Window.
+		*/
+		static void removeChildWidget (CEGUI::Window* parentPtr, CEGUI::Window* childPtr);
+
+#ifdef CEGUI_07
+		static CEGUI::ImagesetManager& getImageManager ();
+#else
+		static CEGUI::ImageManager& getImageManager ();
+#endif
+
+		static void loadImageset (const CEGUI::String& name);
+
+		static void addManagedImageFromFile (const CEGUI::String& name, const CEGUI::String& fileName, const CEGUI::String& resourceGroup = "");
 
 		static CEGUI::Window* getWindow (const CEGUI::String& name);
 		static CEGUI::Window* getWindowForSystem (CEGUI::System* sys, const CEGUI::String& name);
+		static CEGUI::Window* getWindowForLoadedLayout (CEGUI::Window* parentWnd, const CEGUI::String& name);
+		static CEGUI::Window* getWindowForSystemNoEx (CEGUI::System* sys, const CEGUI::String& name);
 
-		static void injectKeyDown (OIS::KeyCode myKey);
-		static void injectKeyDown (CEGUI::System* sys, OIS::KeyCode myKey);
+		/// @param startingWindow: the window from where the dump to log shall commence. For 
+		/// a full system dump, use the root window.
+		/// @param level: the amount of indentation levels to use.
+		static void dumpFullWindowToLog (CEGUI::Window* startingWindow, int level = 0);
+
+		/// Same as getWindowForLoadedLayout, but also throws an exception if the window ptr is NULL.
+		static CEGUI::Window* getWindowForLoadedLayoutEx (CEGUI::Window* parentWnd, const CEGUI::String& name);
 
-		static void injectKeyUp (OIS::KeyCode myKey);
-		static void injectKeyUp (CEGUI::System* sys, OIS::KeyCode myKey);
+		/// 
+		static CEGUI::String getMatchingPath (CEGUI::Window* parentWnd, const CEGUI::String& fullWidgetPath);
+		static std::vector <std::string> SplitByChar (const std::string& source, const char delimiter);
+
+		static CEGUI::Window* getWindowContainingMouse (CEGUI::System* sys);
 
-		static void injectChar (int myKey);
-		static void injectChar (CEGUI::System* sys, int myKey);
+		static bool isWindowPresent (const CEGUI::String& name);
+		static bool isWindowPresentForSystem (CEGUI::System* sys, const CEGUI::String& name);
+
+		static CEGUI::Window* loadLayoutFromFile (const CEGUI::String& name, const CEGUI::String& resGroup = "");
+
+		static bool injectKeyDown (OIS::KeyCode myKey);
+		static bool injectKeyDown (CEGUI::System* sys, OIS::KeyCode myKey);
+
+		static bool injectKeyUp (OIS::KeyCode myKey);
+		static bool injectKeyUp (CEGUI::System* sys, OIS::KeyCode myKey);
 		
-		static void injectMousePosition (float x, float y);
-		static void injectMousePosition (CEGUI::System* sys, float x, float y);
+		static bool injectChar (int myKey);
+		static bool injectChar (CEGUI::System* sys, int myKey);
+		
+		static bool injectMousePosition (float x, float y);
+		static bool injectMousePosition (CEGUI::System* sys, float x, float y);
 
-		static void injectMouseWheelChange (float pos);
-		static void injectMouseWheelChange (CEGUI::System* sys, float pos);
+		static bool injectMouseWheelChange (float pos);
+		static bool injectMouseWheelChange (CEGUI::System* sys, float pos);
 
-		static void injectMouseButtonDown (OIS::MouseButtonID btn);
-		static void injectMouseButtonDown (CEGUI::System* sys, OIS::MouseButtonID btn);
+		static bool injectMouseButtonDown (OIS::MouseButtonID btn);
+		static bool injectMouseButtonDown (CEGUI::System* sys, OIS::MouseButtonID btn);
+
+		static bool injectMouseButtonUp (OIS::MouseButtonID btn);
+		static bool injectMouseButtonUp (CEGUI::System* sys, OIS::MouseButtonID btn);
 
-		static void injectMouseButtonUp (OIS::MouseButtonID btn);
-		static void injectMouseButtonUp (CEGUI::System* sys, OIS::MouseButtonID btn);
+		static void injectTimePulse (float timeElapsed);
+		static void injectTimePulse (CEGUI::System* sys, float timeElapsed);
+
+		static void addFont (const CEGUI::String& fontName, const CEGUI::String& resGroup);
+		static void loadScheme (const CEGUI::String& schemeName, const CEGUI::String& resGroup);
 
 		static CEGUI::MouseButton convertOISButtonToCegui (int buttonID);
 
@@ -182,14 +314,31 @@
 		// Retrieve the widget with a given skin.
 		static std::string getWidgetWithSkin (const std::string& skin, const std::string& name);
 
+		static std::string getImageNameWithSkin (const std::string& skinName, const std::string& imageName);
+
 		static void setScrollPositionForWidget (const CEGUI::String& widgetName, float newScrollPosition);
 
 
 		static void setDefaultFont (const CEGUI::String& fontName);
+		static CEGUI::Font* getDefaultFont ();
 
 		static void setDefaultMouseCursor (CEGUI::System* sys, const std::string& skinName, const std::string& cursorName);
 		static void setDefaultTooltip (CEGUI::System* sys, const std::string& skinName, const std::string& cursorName);
 
+		static CEGUIUtility::Vector2f getMouseCursorPosition (CEGUI::System* sys);
+		static CEGUI::UVector2 getWidgetSize (CEGUI::Window* widget);
+
+		static void setWidgetSizeRel (CEGUI::Window* widget, float width, float height);
+		static void setWidgetSizeAbs (CEGUI::Window* widget, float width, float height);
+		static void setWidgetSize (CEGUI::Window* widget, CEGUI::UVector2 size);
+		static void setWidgetMaxSize (CEGUI::Window* widget, CEGUI::UVector2 size);
+
+
+		static void setRootSheet (CEGUI::System* sys, CEGUI::Window* widget);
+		static CEGUI::Window* getRootSheet (CEGUI::System* sys);
+
+		static void createImage (const CEGUI::String& imageName);
+
 private:
 		/**
 		* \fn static const size_t getNextWord(const CEGUI::String& in_string, size_t start_idx, CEGUI::String& out_string)
--- a/src/gui/charcreate.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/charcreate.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,245 +1,308 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "scene.h"
-
-#include "charcreate.h"
-
-#include "listitem.h"
-
-
-CharCreate::CharCreate (Document* doc, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUG ("CharCreate window created with cegui skin [%s]", m_ceguiSkinName.c_str ());
-	// Create GUI Elements
-
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-
-	// Rahmen fuer das Menue Savegame auswaehlen
-	CEGUI::FrameWindow* char_create = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("charcreate.layout");
-	m_window = char_create;
-	m_window->setMousePassThroughEnabled(true);
-	
-	// pin the the window below the StartMenuRoot to allow display along with MainMenu Elements
-	CEGUI::FrameWindow* start_menu = (CEGUI::FrameWindow*) win_mgr.getWindow("StartMenuRoot");
-	start_menu->addChildWindow(char_create);
-	
-	// Bestandteile der Kontrollleiste hinzufuegen
-	CEGUI::PushButton* btn;
-	CEGUI::Editbox* namebox;
-	
-	namebox = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("NameBox"));
-	namebox->setWantsMultiClickEvents(false);
-	namebox->setMaxTextLength(31);
-	
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("ClassList");
-	classlist->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber(&CharCreate::onClassSelected, this));
-
-	CEGUI::Listbox* looklist = (CEGUI::Listbox*) win_mgr.getWindow("LookList");
-	looklist->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber(&CharCreate::onLookSelected, this));
-
-	// Button Savegame akzeptieren
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("AbortButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharCreate::onButtonAbort, this));
-	btn->setWantsMultiClickEvents(false);
-	
-	// Button neu
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CharCreateButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharCreate::onButtonCharCreate, this));
-	btn->setWantsMultiClickEvents(false);
-	
-	updateTranslation();
-}
-
-
-void CharCreate::update()
-{
-	// aktuell gewaehlte Klasse ermitteln
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("ClassList");
-	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
-	
-	if (itm !=0)
-	{
-		StrListItem * sitm = (StrListItem *) itm;
-		
-		// alle moeglichen Looks fuer die Klasse ermitteln und Liste erneuern
-		std::list< PlayerLook > looks;
-		std::list< PlayerLook >::iterator it;
-		ObjectFactory::getPlayerLooks(sitm->m_data,looks);
-		
-		CEGUI::Listbox* looklist = (CEGUI::Listbox*) win_mgr.getWindow("LookList");
-		looklist->resetList();
-		
-		for (it = looks.begin(); it !=	looks.end(); ++it)
-		{
-			looklist->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext(it->m_name.c_str()),it->m_name));
-		}
-	}
-}
-
-void CharCreate::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	CEGUI::Window* label;
-	
-	label = win_mgr.getWindow("CharNameLabel");
-	label->setText((CEGUI::utf8*) gettext("Name"));
-	
-	label = win_mgr.getWindow("CharClassLabel");
-	label->setText((CEGUI::utf8*) gettext("Class"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("AbortButton"));
-	btn->setText((CEGUI::utf8*) gettext("Cancel"));
-
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CharCreateButton"));
-	btn->setText((CEGUI::utf8*) gettext("Create"));
-}
-
-void CharCreate::updateClassList()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("ClassList");
-	classlist->resetList();
-	
-	std::map<GameObject::Subtype, PlayerBasicData*>& pcdata = ObjectFactory::getPlayerData();
-	std::map<GameObject::Subtype, PlayerBasicData*>::iterator it;
-	for (it = pcdata.begin(); it != pcdata.end(); ++it)
-	{
-		classlist->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext(it->second->m_name.c_str()),it->first));
-	}
-	
-	if (classlist->getItemCount() >0)
-	{
-		int idx =0;
-		classlist->clearAllSelections();
-		classlist->setItemSelectState(idx,true);
-	}
-}
-
-bool CharCreate::onClassSelected(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("ClassList");
-	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
-
-
-	if (itm !=0)
-	{
-		DEBUGX("selected class %s", static_cast<StrListItem*>(sitm)->m_data.c_str());
-	}
-	
-	update();
-	
-	CEGUI::Listbox* looklist = (CEGUI::Listbox*) win_mgr.getWindow("LookList");
-	if (looklist->getItemCount() >0)
-	{
-		int idx =0;
-		looklist->clearAllSelections();
-		looklist->setItemSelectState(idx,true);
-	}
-	
-	return true;
-}
-
-bool CharCreate::onLookSelected(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("LookList");
-	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
-
-	if (itm !=0)
-	{
-		StrListItem * sitm = (StrListItem *) itm;
-		DEBUGX("selected look %s", sitm->m_data.c_str());
-		
-		CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("ClassList");
-		CEGUI::ListboxItem * itm2 = classlist->getFirstSelectedItem();
-		StrListItem * sitm2 = (StrListItem *) itm2;
-		
-		if (sitm2 == 0)
-		{
-			CEGUI::Listbox* looklist = (CEGUI::Listbox*) win_mgr.getWindow("LookList");
-			looklist->resetList();
-			return true;
-		}
-		
-		PlayerLook* plook = ObjectFactory::getPlayerLook(sitm2->m_data,sitm->m_data);
-		if (plook != 0)
-		{
-			m_document->setNewCharacter(sitm2->m_data,*plook);
-		}
-	}
-	
-	return true;
-}
-
-bool CharCreate::onButtonAbort(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* namebox;
-	namebox = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("NameBox"));
-	namebox->setText("");
-	
-	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
-	m_document->setModified(Document::WINDOWS_MODIFIED);
-	return true;
-}
-
-bool CharCreate::onButtonCharCreate(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* namebox;
-	namebox = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("NameBox"));
-	std::string name = namebox->getText().c_str();
-	
-	// check if name is empty
-	if (name == "")
-	{
-		namebox ->activate();
-		
-		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("WarningDialogWindow");
-		message->setInheritsAlpha(false);
-		message->setVisible(true);
-		message->setModalState(true);
-		win_mgr.getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("You must enter a hero name!"));
-		
-		return true;
-	}
-	
-	// check if name is valid
-	bool valid = m_document->createNewCharacter(name);
-	
-	if (!valid)
-	{
-		namebox ->activate();
-		
-		CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.getWindow("WarningDialogWindow");
-		message->setInheritsAlpha(false);
-		message->setVisible(true);
-		message->setModalState(true);
-		win_mgr.getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("A character with that name already exists!"));
-		
-		return true;
-	}
-	namebox ->setText("");
-	return true;
-}
-
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "scene.h"
+
+#include "charcreate.h"
+
+#include "listitem.h"
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+
+CharCreate::CharCreate (Document* doc, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	SW_DEBUG ("CharCreate window created with cegui skin [%s]", m_ceguiSkinName.c_str ());
+	// Create GUI Elements
+
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	// Rahmen fuer das Menue Savegame auswaehlen
+	CEGUI::FrameWindow* char_create = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("charcreate.layout");
+	m_window = char_create;
+	m_window->setMousePassThroughEnabled(true);
+	
+	CEGUI::String widgetName;
+
+	// Bestandteile der Kontrollleiste hinzufuegen
+	CEGUI::PushButton* btn;
+	CEGUI::Editbox* namebox;
+	
+	widgetName = CEGUIUtility::getNameForWidget("NameBox");
+	namebox = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	namebox->setWantsMultiClickEvents(false);
+	namebox->setMaxTextLength(31);
+	namebox->subscribeEvent(CEGUI::Editbox::EventMouseClick, CEGUI::Event::Subscriber(&CharCreate::onGUIItemClick, this));
+	
+	widgetName = CEGUIUtility::getNameForWidget("ClassList");
+	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	classlist->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber(&CharCreate::onClassSelected, this));
+	classlist->subscribeEvent(CEGUIUtility::EventMouseEntersListBoxArea (), CEGUI::Event::Subscriber(&CharCreate::onGUIItemHover, this));
+
+	widgetName = CEGUIUtility::getNameForWidget("LookList");
+	CEGUI::Listbox* looklist = static_cast<CEGUI::Listbox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	looklist->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber(&CharCreate::onLookSelected, this));
+	looklist->subscribeEvent(CEGUIUtility::EventMouseEntersListBoxArea (), CEGUI::Event::Subscriber(&CharCreate::onGUIItemHover, this));
+
+	// Button for aborting the creation of a new character
+	widgetName = CEGUIUtility::getNameForWidget("AbortButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharCreate::onButtonAbort, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&CharCreate::onGUIItemHover, this));
+	btn->setWantsMultiClickEvents(false);
+	
+	// Button for accepting the creation of a new character
+	widgetName = CEGUIUtility::getNameForWidget("CharCreateButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharCreate::onButtonCharCreate, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&CharCreate::onGUIItemHover, this));
+	btn->setWantsMultiClickEvents(false);
+	
+	updateTranslation();
+}
+
+
+void CharCreate::update()
+{
+	// aktuell gewaehlte Klasse ermitteln
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
+	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
+	
+	if (itm !=0)
+	{
+		StrListItem * sitm = (StrListItem *) itm;
+		
+		// alle moeglichen Looks fuer die Klasse ermitteln und Liste erneuern
+		std::list< PlayerLook > looks;
+		std::list< PlayerLook >::iterator it;
+		ObjectFactory::getPlayerLooks(sitm->m_data,looks);
+		
+		widgetName = CEGUIUtility::getNameForWidget("LookList");
+		CEGUI::Listbox* looklist = (CEGUI::Listbox*) CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName);
+		looklist->resetList();
+		
+		for (it = looks.begin(); it !=	looks.end(); ++it)
+		{
+			looklist->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext(it->m_name.c_str()),it->m_name));
+		}
+	}
+}
+
+void CharCreate::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	CEGUI::Window* widget;
+	CEGUI::String widgetName;
+	
+	widgetName = CEGUIUtility::getNameForWidget("CharNameLabel");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName);
+	widget->setText((CEGUI::utf8*) gettext("Name"));
+	
+	widgetName = CEGUIUtility::getNameForWidget("CharClassLabel");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName);
+	widget->setText((CEGUI::utf8*) gettext("Class"));
+	
+	widgetName = CEGUIUtility::getNameForWidget("AbortButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName)); // todo: remove static cast, as we only need a basic widget here.
+	btn->setText((CEGUI::utf8*) gettext("Cancel"));
+
+	widgetName = CEGUIUtility::getNameForWidget("CharCreateButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	btn->setText((CEGUI::utf8*) gettext("Create"));
+}
+
+void CharCreate::updateClassList()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
+	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	classlist->resetList();
+	
+	std::map<GameObject::Subtype, PlayerBasicData*>& pcdata = ObjectFactory::getPlayerData();
+	std::map<GameObject::Subtype, PlayerBasicData*>::iterator it;
+	for (it = pcdata.begin(); it != pcdata.end(); ++it)
+	{
+		classlist->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext(it->second->m_name.c_str()),it->first));
+	}
+	
+	if (classlist->getItemCount() >0)
+	{
+		int idx =0;
+		classlist->clearAllSelections();
+		classlist->setItemSelectState(idx,true);
+	}
+}
+
+bool CharCreate::onClassSelected(const CEGUI::EventArgs& evt)
+{
+	SW_DEBUG ("CharCreate::onClassSelected");
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList");
+	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
+
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	if (itm !=0)
+	{
+		DEBUGX("selected class %s", static_cast<StrListItem*>(sitm)->m_data.c_str());
+	}
+	
+	update();
+
+	widgetName = CEGUIUtility::getNameForWidget("LookList");
+	CEGUI::Listbox* looklist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	if (looklist->getItemCount() >0)
+	{
+		int idx =0;
+		looklist->clearAllSelections();
+		looklist->setItemSelectState(idx,true);
+	}
+	
+	return true;
+}
+
+bool CharCreate::onLookSelected(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("LookList");
+	CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
+
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	if (itm !=0)
+	{
+		StrListItem * sitm = (StrListItem *) itm;
+		DEBUGX("selected look %s", sitm->m_data.c_str());
+		
+		widgetName = CEGUIUtility::getNameForWidget("ClassList");
+		CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+		CEGUI::ListboxItem * itm2 = classlist->getFirstSelectedItem();
+		StrListItem * sitm2 = (StrListItem *) itm2;
+		
+		if (sitm2 == 0)
+		{
+			widgetName = CEGUIUtility::getNameForWidget("LookList");
+			CEGUI::Listbox* looklist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+			looklist->resetList();
+			return true;
+		}
+		
+		PlayerLook* plook = ObjectFactory::getPlayerLook(sitm2->m_data,sitm->m_data);
+		if (plook != 0)
+		{
+			m_document->setNewCharacter(sitm2->m_data,*plook);
+		}
+	}
+	
+	return true;
+}
+
+bool CharCreate::onButtonAbort(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* namebox;
+
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("NameBox");
+	namebox = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	namebox->setText("");
+	
+	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
+	m_document->setModified(Document::WINDOWS_MODIFIED);
+	return true;
+}
+
+bool CharCreate::onButtonCharCreate(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* namebox;
+	CEGUI::String widgetName;
+
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	widgetName = CEGUIUtility::getNameForWidget("NameBox");
+
+	namebox = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+	std::string name = namebox->getText().c_str();
+	
+	// check if name is empty
+	if (name == "")
+	{
+		namebox ->activate();
+		
+		widgetName = CEGUIUtility::getNameForWidget("WarningDialogWindow");
+		CEGUI::FrameWindow* message = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+		message->setInheritsAlpha(false);
+		message->setVisible(true);
+		message->setModalState(true);
+		CEGUIUtility::getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("You must enter a hero name!"));
+		
+		return true;
+	}
+	
+	// check if name is valid
+	bool valid = m_document->createNewCharacter(name);
+	
+	if (!valid)
+	{
+		namebox ->activate();
+
+		widgetName = CEGUIUtility::getNameForWidget("WarningDialogWindow");
+		CEGUI::FrameWindow* message = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
+		message->setInheritsAlpha(false);
+		message->setVisible(true);
+		message->setModalState(true);
+		CEGUIUtility::getWindow( "WarningDialogLabel")->setText((CEGUI::utf8*) gettext("A character with that name already exists!"));
+		
+		return true;
+	}
+	namebox ->setText("");
+	return true;
+}
+
+
+
+/**
+ * \fn bool onGUIItemClick(const CEGUI::EventArgs& evt)
+ * \brief Handle the click of gui items.
+ */
+bool CharCreate::onGUIItemClick (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+	return true;
+}
+
+
+
+/**
+ * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+ * \brief Handle the hovering of gui items.
+ */
+bool CharCreate::onGUIItemHover (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
--- a/src/gui/charcreate.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/charcreate.h	Thu Mar 20 19:04:28 2014 +0100
@@ -1,85 +1,96 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __SUMWARS_GUI_CHARCREATE_H__
-#define __SUMWARS_GUI_CHARCREATE_H__
-
-#include "window.h"
-
-
-/**
- * \class CharCreate
- * \brief Fenster Charakter erstellen
- */
-class CharCreate : public Window
-{
-	public:
-		/**
-	 * \fn CharCreate (Document* doc)
-	 * \brief Konstruktor
-		 */
-		CharCreate (Document* doc, const std::string& ceguiSkinName);
-	
-		/**
-		 * \fn virtual void update()
-		 * \brief aktualisiert den Inhalt des Fensters
-		 */
-		virtual void update();
-		
-		/**
-		 * \fn virtual void updateTranslation
-		 * \brief aktualisiert die Uebersetzungen
-		 */
-		virtual void updateTranslation();
-		
-		/**
-		 * \fn void updateClassList()
-		 * \brief aktualisiert die Liste der Spielerklassen
-		 */
-		void updateClassList();
-		
-	private:
-	/**
-	 * \fn bool onClassSelected(const CEGUI::EventArgs& evt)
-	 * \brief Behandelt Auswahl einer Klasse
-	 */
-	bool onClassSelected(const CEGUI::EventArgs& evt);
-	
-	/**
-	 * \fn bool onLookSelected(const CEGUI::EventArgs& evt)
-	 * \brief Behandelt Auswahl eines Aussehens
-	 */
-	bool onLookSelected(const CEGUI::EventArgs& evt);
-	
-	/**
-	 * \fn bool onButtonAbort(const CEGUI::EventArgs& evt)
-	 * \brief Behandelt Druck auf Knopf Abbrechen
-	 */
-	bool onButtonAbort(const CEGUI::EventArgs& evt);
-	
-	/**
-	 * \fn bool onButtonCharCreate(const CEGUI::EventArgs& evt)
-	 * \brief Behandelt Druck auf Knopf Charakter erstellen
-	 */
-	bool onButtonCharCreate(const CEGUI::EventArgs& evt);
-
-	/**
-	 * \brief The name of the CEGUI skin to use.
-	 */
-	std::string m_ceguiSkinName;
-
-};
-
-#endif // __SUMWARS_GUI_CHARCREATE_H__
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SUMWARS_GUI_CHARCREATE_H__
+#define __SUMWARS_GUI_CHARCREATE_H__
+
+#include "window.h"
+
+
+/**
+ * \class CharCreate
+ * \brief Create and control the character window
+ */
+class CharCreate : public Window
+{
+	public:
+		/**
+		 * \fn CharCreate (Document* doc)
+		 * \brief Constructor.
+		 */
+		CharCreate (Document* doc, const std::string& ceguiSkinName);
+	
+		/**
+		 * \fn virtual void update()
+		 * \brief aktualisiert den Inhalt des Fensters
+		 */
+		virtual void update();
+		
+		/**
+		 * \fn virtual void updateTranslation
+		 * \brief aktualisiert die Uebersetzungen
+		 */
+		virtual void updateTranslation();
+		
+		/**
+		 * \fn void updateClassList()
+		 * \brief aktualisiert die Liste der Spielerklassen
+		 */
+		void updateClassList();
+		
+	private:
+		/**
+		 * \fn bool onGUIItemClick (const CEGUI::EventArgs& evt)
+		 * \brief Handle the click of gui items.
+		 */
+		bool onGUIItemClick (const CEGUI::EventArgs& evt);
+
+		/**
+		 * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+		 * \brief Handle the hovering of gui items.
+		 */
+		bool onGUIItemHover (const CEGUI::EventArgs& evt);
+		
+		/**
+		 * \fn bool onClassSelected(const CEGUI::EventArgs& evt)
+		 * \brief Behandelt Auswahl einer Klasse
+		 */
+		bool onClassSelected(const CEGUI::EventArgs& evt);
+	
+		/**
+		 * \fn bool onLookSelected(const CEGUI::EventArgs& evt)
+		 * \brief Behandelt Auswahl eines Aussehens
+		 */
+		bool onLookSelected(const CEGUI::EventArgs& evt);
+	
+		/**
+		 * \fn bool onButtonAbort(const CEGUI::EventArgs& evt)
+		 * \brief Behandelt Druck auf Knopf Abbrechen
+		 */
+		bool onButtonAbort(const CEGUI::EventArgs& evt);
+	
+		/**
+		 * \fn bool onButtonCharCreate(const CEGUI::EventArgs& evt)
+		 * \brief Behandelt Druck auf Knopf Charakter erstellen
+		 */
+		bool onButtonCharCreate(const CEGUI::EventArgs& evt);
+
+		/**
+		 * \brief The name of the CEGUI skin to use.
+		 */
+		std::string m_ceguiSkinName;
+};
+
+#endif // __SUMWARS_GUI_CHARCREATE_H__
--- a/src/gui/charinfo.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/charinfo.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -17,6 +17,7 @@
 #include "player.h"
 #include "damage.h"
 
+#include "ceguiutility.h"
 
 CharInfo::CharInfo (Document* doc)
 	: Window(doc)
@@ -24,28 +25,28 @@
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	
 	// The CharInfo window and holder
-	CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout( "characterscreen.layout" );
+	CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) (CEGUIUtility::loadLayoutFromFile ("characterscreen.layout"));
 	if (!char_info)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "characterscreen.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen.layout");
 	}
 
-	CEGUI::Window* char_info_holder = win_mgr.loadWindowLayout( "characterscreen_holder.layout" );
+	CEGUI::Window* char_info_holder = CEGUIUtility::loadLayoutFromFile ("characterscreen_holder.layout");
 	if (!char_info_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
 	}
 	
-	CEGUI::Window* wndHolder = win_mgr.getWindow("CharInfo_Holder");
-	CEGUI::Window* wndCharInfo = win_mgr.getWindow("CharInfo");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (char_info_holder, "CharInfo_Holder");
+	CEGUI::Window* wndCharInfo = CEGUIUtility::getWindowForLoadedLayoutEx (char_info, "CharInfo");
 	if (wndHolder && wndCharInfo)
 	{
-		wndHolder->addChildWindow (wndCharInfo);
+		CEGUIUtility::addChildWidget (wndHolder, wndCharInfo);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen.");
 	}
 
 	m_window = char_info_holder;
@@ -60,143 +61,131 @@
 
 	
 	// Label Level
-	label = win_mgr.getWindow("LevelValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/LevelValueLabel");
 	label->setText("1");
 
 	// Label Staerke (Wert)
-	label = win_mgr.getWindow("StrengthValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/StrengthValueLabel");
 	label->setText("20");
 
 	// Button Staerke erhoehen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("StrengthAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/StrengthAddButton"));
 	btn->setID(CreatureBaseAttr::STRENGTH);
 	btn->setWantsMultiClickEvents(false);
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharInfo::onIncreaseAttributeButtonClicked, this));
 	
 	// Label Geschick (Wert)
-	label = win_mgr.getWindow("DexterityValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/DexterityValueLabel");
 	label->setText("20");
 
 	// Button Geschick erhoehen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("DexterityAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/DexterityAddButton"));
 	btn->setID(CreatureBaseAttr::DEXTERITY);
 	btn->setWantsMultiClickEvents(false);
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharInfo::onIncreaseAttributeButtonClicked, this));
 	
 	// Label Willenskraft (Wert)
-	label = win_mgr.getWindow("WillpowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/WillpowerValueLabel");
 	label->setText("20");
 
 	// Button Willenskraft erhoehen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("WillpowerAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/WillpowerAddButton"));
 	btn->setID(CreatureBaseAttr::WILLPOWER);
 	btn->setWantsMultiClickEvents(false);
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharInfo::onIncreaseAttributeButtonClicked, this));
 
 	// Label Zauberkraft (Wert)
-	label = win_mgr.getWindow("MagicpowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/MagicpowerValueLabel");
 	label->setText("20");
 
 	// Button Zauberkraft erhoehen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("MagicpowerAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/MagicpowerAddButton"));
 	btn->setID(CreatureBaseAttr::MAGIC_POWER);
 	btn->setWantsMultiClickEvents(false);
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharInfo::onIncreaseAttributeButtonClicked, this));
 	
 	// Label  Attributpunkte (Wert)
-	label = win_mgr.getWindow("AttrPointsValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/AttrPointsValueLabel");
 	label->setText("5");
 
 	// Label Exp (Wert)
-	label = win_mgr.getWindow("ExperienceValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/ExperienceValueLabel");
 	label->setText("0/100");
 
 	// Label HP (Wert)
-	label = win_mgr.getWindow("HitpointsValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/HitpointsValueLabel");
 	label->setText("0/100");
 
 	// Label Attacke (Wert)
-	label = win_mgr.getWindow("AttackValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackValueLabel");
 	label->setText("20");
 
 	// Label Attacke (Wert)
-	label = win_mgr.getWindow("AttackSpeedValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackSpeedValueLabel");
 	label->setText("20");
 
 	// Label Reichweite (Wert)
-	label = win_mgr.getWindow("RangeValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/RangeValueLabel");
 	label->setText("2");
 
 	// Label Durchschlagskraft
-	label = win_mgr.getWindow("PowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/PowerValueLabel");
 	label->setText("30");
 
 	// Label Ruestung
-	label = win_mgr.getWindow("ArmorValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ArmorValueLabel");
 	label->setText("40");
 
 	// Label Block
-	label = win_mgr.getWindow("BlockValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/BlockValueLabel");
 	label->setText("20");
 
 	// Label Basisschaden
-	label = win_mgr.getWindow("BaseDmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/BaseDmgLabel");
 	label->setText((CEGUI::utf8*) gettext("Base damage"));
 
 	// Label Basisschaden (Wert)
-	label = win_mgr.getWindow("BaseDmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/BaseDmgValueLabel");
 	label->setText("5-10");
 
 	// Label Skill1 Schaden
-	label = win_mgr.getWindow("Skill1DmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill1DmgLabel");
 	label->setText("Skill1");
 
 	// Label Skill1 Schaden (Wert)
-	label = win_mgr.getWindow("Skill1DmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill1DmgValueLabel");
 	label->setText("10-20");
 
 	// Label Skill2 Schaden
-	label = win_mgr.getWindow("Skill2DmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill2DmgLabel");
 	label->setText("Skill2");
 
 	// Label Skill2 Schaden (Wert)
-	label = win_mgr.getWindow("Skill2DmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill2DmgValueLabel");
 	label->setText("20-30");
 
 	// Label physische Resistenz (Wert)
-	label = win_mgr.getWindow("ResistPhysValueLabel");
-	label->setText("0");
-
-	// Label Feuerresistenz (Wert)
-	label = win_mgr.getWindow("ResistFireValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistPhysValueLabel");
 	label->setText("0");
 
 	// Label Feuerresistenz (Wert)
-	label = win_mgr.getWindow("ResistAirValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistFireValueLabel");
+	label->setText("0");
+
+	// Label Feuerresistenz (Wert)
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistAirValueLabel");
 	label->setText("0");
 
 	// Label Eisresistenz (Wert)
-	label = win_mgr.getWindow("ResistIceValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistIceValueLabel");
 	label->setText("0");
 	
-	if (win_mgr.isWindowPresent ("CharInfoCloseButton"))
+	// If the panel also has an auto-close button, connect it to the Cancel/Abort event.
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/__auto_closebutton__");
+	if (label)
 	{
-		label = win_mgr.getWindow("CharInfoCloseButton");
 		label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&CharInfo::onCloseButtonClicked, this));
 	}
-	else
-	{
-		// If the panel also has an auto-close button, connect it to the Cancel/Abort event.
-		if (win_mgr.isWindowPresent ("CharInfo__auto_closebutton__"))
-		{
-			label = win_mgr.getWindow ("CharInfo__auto_closebutton__");
-			if (label)
-			{
-				label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&CharInfo::onCloseButtonClicked, this));
-			}
-		}
-	}
-
 
 	updateTranslation();
 }
@@ -222,26 +211,15 @@
 	// Prepare the name
 	out_stream.str("");
 	out_stream.str(player->getName().getRawText());
-	if (win_mgr.isWindowPresent ("NameLabel"))
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo");
+	if (label->isPropertyPresent ("Text"))
 	{
-		label =  win_mgr.getWindow("NameLabel");
-		if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
-		{
-			label->setText((CEGUI::utf8*) out_stream.str().c_str());
-		}
-	}
-	else if (win_mgr.isWindowPresent ("CharInfo"))
-	{
-		label =  win_mgr.getWindow("CharInfo");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) out_stream.str().c_str());
-		}
+		label->setProperty ("Text", (CEGUI::utf8*) out_stream.str().c_str());
 	}
 
 
 	// Label Klasse
-	label =  win_mgr.getWindow("ClassValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/ClassValueLabel");
 	PlayerBasicData* pdata = ObjectFactory::getPlayerData(player->getSubtype());
 	if (pdata != 0)
 	{
@@ -254,12 +232,12 @@
 	
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
 	{
-		DEBUG("set class label");
+		SW_DEBUG("set class label");
 		label->setText((CEGUI::utf8*) out_stream.str().c_str());
 	}
 
 	// Label Level
-	label =  win_mgr.getWindow("LevelValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/LevelValueLabel");
 	out_stream.str("");
 	out_stream << (int) player->getBaseAttr()->m_level;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -268,7 +246,7 @@
 	}
 
 	// Label Staerke
-	label =  win_mgr.getWindow("StrengthValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/StrengthValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_strength;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -277,7 +255,7 @@
 	}
 
 	// Label Zauberkraft
-	label =  win_mgr.getWindow("MagicpowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/MagicpowerValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_magic_power;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -286,7 +264,7 @@
 	}
 
 	// Label Willenskraft
-	label =  win_mgr.getWindow("WillpowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/WillpowerValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_willpower;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -295,7 +273,7 @@
 	}
 
 	// Label Geschick
-	label =  win_mgr.getWindow("DexterityValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/DexterityValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_dexterity;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -311,17 +289,17 @@
 	}
 
 	// Sichtbarkeit der Buttons setzen
-	btn =   static_cast<CEGUI::PushButton*>(win_mgr.getWindow("StrengthAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/StrengthAddButton"));
 	btn->setVisible(add_but_vis);
-	btn =  static_cast<CEGUI::PushButton*>(win_mgr.getWindow("DexterityAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/DexterityAddButton"));
 	btn->setVisible(add_but_vis);
-	btn =  static_cast<CEGUI::PushButton*>(win_mgr.getWindow("WillpowerAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/WillpowerAddButton"));
 	btn->setVisible(add_but_vis);
-	btn =  static_cast<CEGUI::PushButton*>(win_mgr.getWindow("MagicpowerAddButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/MagicpowerAddButton"));
 	btn->setVisible(add_but_vis);
 
 	// Label freie Attributspunkte
-	label =  win_mgr.getWindow("AttrPointsValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/AttrPointsValueLabel");
 	out_stream.str("");
 	out_stream << gettext("You have") << " " << player->getAttributePoints() << " " << gettext("attribute points to spend");
 	//label->setVisible(add_but_vis);
@@ -331,7 +309,7 @@
 	}
 
 	// Label Ruestung
-	label =  win_mgr.getWindow("ArmorValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ArmorValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_armor;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -350,7 +328,7 @@
 	}
 
 	// Label Attacke
-	label =  win_mgr.getWindow("AttackValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseDamage().m_attack;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -369,7 +347,7 @@
 	}
 
 	// Label Block
-	label = win_mgr.getWindow("BlockLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/BlockLabel" );
 	CEGUI::utf8* blocktext;
 	if (player->getShield() != 0)
 	{	
@@ -384,7 +362,7 @@
 		label->setText(blocktext);
 	}
 	
-	label =  win_mgr.getWindow("BlockValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/BlockValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_block;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -403,7 +381,7 @@
 	}
 
 	// Label HP
-	label =  win_mgr.getWindow("HitpointsValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/HitpointsValueLabel");
 	out_stream.str("");
 	out_stream << (int) player->getDynAttr()->m_health <<"/" <<(int) player->getBaseAttrMod()->m_max_health;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -412,7 +390,7 @@
 	}
 
 	// Label Exp
-	label =  win_mgr.getWindow("ExperienceValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/ExperienceValueLabel");
 	out_stream.str("");
 	out_stream << (unsigned int) player->getDynAttr()->m_experience <<"/" <<(unsigned int) player->getBaseAttr()->m_max_experience;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -421,7 +399,7 @@
 	}
 
 	// Label Phys Resistenz
-	label =  win_mgr.getWindow("ResistPhysValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistPhysValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_resistances[Damage::PHYSICAL];
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -430,7 +408,7 @@
 	}
 
 	// Label Feuer Resistenz
-	label =  win_mgr.getWindow("ResistFireValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistFireValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_resistances[Damage::FIRE];
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -439,7 +417,7 @@
 	}
 
 	// Label Eis Resistenz
-	label =  win_mgr.getWindow("ResistIceValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistIceValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_resistances[Damage::ICE];
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -448,7 +426,7 @@
 	}
 
 	// Label Luft Resistenz
-	label =  win_mgr.getWindow("ResistAirValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistAirValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_resistances[Damage::AIR];
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -457,7 +435,7 @@
 	}
 
 	// Label Angriffsgeschwindigkeit
-	label =  win_mgr.getWindow("AttackSpeedValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackSpeedValueLabel");
 	out_stream.str("");
 	out_stream << 0.001*MathHelper::Min((short) 5000, player->getBaseAttrMod()->m_attack_speed);
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -466,7 +444,7 @@
 	}
 
 	// Label Reichweite
-	label =  win_mgr.getWindow("RangeValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/RangeValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseAttrMod()->m_attack_range;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -475,7 +453,7 @@
 	}
 
 	// Label Durchschlagskraft
-	label =  win_mgr.getWindow("PowerValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/PowerValueLabel");
 	out_stream.str("");
 	out_stream << player->getBaseDamage().m_power;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -515,7 +493,7 @@
 
 
 	// Label Schaden Basisattacke
-	label =  win_mgr.getWindow( "BaseDmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window,  "CharInfo/charinfo_aux/Offense/__auto_contentpane__/BaseDmgLabel");
 	out_stream.str("");
 	if (pdata != 0)
 	{
@@ -538,7 +516,7 @@
 	}
 
 	// Label Basisschaden
-	label =  win_mgr.getWindow("BaseDmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/BaseDmgValueLabel");
 	out_stream.str("");
 	out_stream << (int) minb << "-" << (int) maxb;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -552,7 +530,7 @@
 	}
 
 	// Label Attacke links
-	label =  win_mgr.getWindow( "Skill1DmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill1DmgLabel");
 	out_stream.str("");
 	out_stream << Action::getName(player->getLeftAction());
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -571,7 +549,7 @@
 
 	
 	// Label Schaden Attacke links
-	label =  win_mgr.getWindow( "Skill1DmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill1DmgValueLabel");
 	out_stream.str("");
 	out_stream << (int) minl << "-" << (int) maxl;
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -588,7 +566,7 @@
 
 
 	// Label Attacke rechts
-	label =  win_mgr.getWindow( "Skill2DmgLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill2DmgLabel");
 	out_stream.str("");
 	out_stream << Action::getName(player->getRightAction());
 	if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str())
@@ -607,7 +585,7 @@
 
 	// Label Schaden Attacke rechts
 	Action::TargetType dist = Action::getActionInfo(player->getRightAction())->m_target_type;
-	label =  win_mgr.getWindow( "Skill2DmgValueLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/Skill2DmgValueLabel");
 	if (dist == Action::MELEE || dist == Action::RANGED || dist == Action::CIRCLE)
 	{	
 		out_stream.str("");
@@ -630,7 +608,7 @@
 			label->setTooltipText("");
 	}
 	
-	label = win_mgr.getWindow("Portrait");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/Portrait");
 	std::string portraitname = player->getEmotionImage("normal");
 	if (label->getProperty("Image") != portraitname)
 	{
@@ -644,103 +622,95 @@
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
-	if (win_mgr.isWindowPresent ("NameLabel"))
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo");
+	if (label->isPropertyPresent ("Text"))
 	{
-		label =  win_mgr.getWindow("NameLabel");
-		label->setText((CEGUI::utf8*) gettext("Name"));
-	}
-	else if (win_mgr.isWindowPresent ("CharInfo"))
-	{
-		label =  win_mgr.getWindow("CharInfo");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Name"));
-		}
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Name"));
 	}
 	
-	label = win_mgr.getWindow("Playerinfo");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo");
 	label->setText((CEGUI::utf8*) gettext("Player info"));
 	
-	label = win_mgr.getWindow("Attributes");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes");
 	label->setText((CEGUI::utf8*) gettext("Attributes"));
 	
-	label = win_mgr.getWindow("Offense");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense");
 	label->setText((CEGUI::utf8*) gettext("Offense"));
 	
-	label = win_mgr.getWindow("Defense");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense");
 	label->setText((CEGUI::utf8*) gettext("Defense"));
 
-	label = win_mgr.getWindow("LevelLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/LevelLabel");
 	label->setText((CEGUI::utf8*) gettext("Level"));
 
-	label = win_mgr.getWindow("ClassLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/ClassLabel");
 	label->setText((CEGUI::utf8*) gettext("Class"));
 	
 	
-	label = win_mgr.getWindow("StrengthLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/StrengthLabel");
 	label->setText((CEGUI::utf8*) gettext("Strength"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Strength increases hitpoints, melee damage and attack power."));
 	
-	label = win_mgr.getWindow("DexterityLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/DexterityLabel");
 	label->setText((CEGUI::utf8*) gettext("Dexterity"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Dexterity increases ranged damage, attack accuracy and attack speed"));
 	
-	label = win_mgr.getWindow("WillpowerLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/WillpowerLabel");
 	label->setText((CEGUI::utf8*) gettext("Willpower"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Willpower decreases the duration and the impact of status changes \n and increases magical melee damage."));
 	
-	label = win_mgr.getWindow("MagicpowerLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Attributes/__auto_contentpane__/MagicpowerLabel");
 	label->setText((CEGUI::utf8*) gettext("Magic power"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Magic power increases the damage of magical attacks."));
 
-	label = win_mgr.getWindow("ExperienceLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/ExperienceLabel" );
  	label->setText((CEGUI::utf8*) gettext("Experience"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Current experience and experience necessary for next level-up."));
 	
-	label = win_mgr.getWindow("HitpointsLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Playerinfo/__auto_contentpane__/HitpointsLabel");
 	label->setText((CEGUI::utf8*) gettext("Hitpoints"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Current and maximal hitpoints."));
 	
 	
-	label = win_mgr.getWindow("AttackLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackLabel" );
 	label->setText((CEGUI::utf8*) gettext("Attack"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Attack value determines the chance to hit enemies that can block or evade."));
 	
 	
-	label = win_mgr.getWindow("AttackSpeedLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/AttackSpeedLabel" );
 	label->setText((CEGUI::utf8*) gettext("Attacks/s"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Number of attacks per second."));
 	
 	
-	label = win_mgr.getWindow( "RangeLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window,  "CharInfo/charinfo_aux/Offense/__auto_contentpane__/RangeLabel");
 	label->setText((CEGUI::utf8*) gettext("Range"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Weapon Range in meters."));
 	
 	
-	label = win_mgr.getWindow("PowerLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Offense/__auto_contentpane__/PowerLabel" );
 	label->setText((CEGUI::utf8*) gettext("Power"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Attack power influences the damage dealt to armored enemies."));
 	
 	
-	label = win_mgr.getWindow( "ArmorLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window,  "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ArmorLabel");
 	label->setText((CEGUI::utf8*) gettext("Armor"));
 	label->setTooltipText((CEGUI::utf8*) gettext("Armor reduces the damage of physical attacks."));
 	
 	
-	label = win_mgr.getWindow("BlockLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/BlockLabel" );
 	label->setTooltipText((CEGUI::utf8*) gettext("Block value determines the chance to avoid damage from physical attacks."));
 	
 	
-	label = win_mgr.getWindow( "ResistPhysLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window,  "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistPhysLabel");
 	label->setText((CEGUI::utf8*) gettext("Physical"));
 	
-	label = win_mgr.getWindow("ResistAirLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistAirLabel" );
 	label->setText((CEGUI::utf8*) gettext("Air"));
 	
-	label = win_mgr.getWindow("ResistIceLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistIceLabel" );
 	label->setText((CEGUI::utf8*) gettext("Ice"));
 	
-	label = win_mgr.getWindow("ResistFireLabel" );
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CharInfo/charinfo_aux/Defense/__auto_contentpane__/ResistFireLabel" );
 	label->setText((CEGUI::utf8*) gettext("Fire"));
 	
 	
--- a/src/gui/chatline.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/chatline.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -30,13 +30,19 @@
 	
 	chatline = static_cast<CEGUI::Editbox*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Editbox"), "Chatline"));
  	chatline->setPosition(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.83f)));
-	chatline->setSize(CEGUI::UVector2(cegui_reldim(.43f), cegui_reldim( 0.05f)));
+	CEGUIUtility::setWidgetSizeRel (chatline, 0.43f, 0.05f);
+
 	chatline->setWantsMultiClickEvents(false);
 	chatline->subscribeEvent(CEGUI::Editbox::EventTextAccepted, CEGUI::Event::Subscriber(&ChatLine::onSendMessage,  this));
 	chatline->subscribeEvent(CEGUI::Window::EventKeyDown, CEGUI::Event::Subscriber(&ChatLine::onKeyPress,  this));
 	
 	chatline->setText("");
 	chatline->setAlwaysOnTop(true);
+	if (chatline->isPropertyPresent ("BackgroundColour"))
+	{
+		chatline->setProperty("BackgroundColour", "B2000000"); 
+	}
+
 	m_window = chatline;
 	
 	updateTranslation();
@@ -72,7 +78,8 @@
 void ChatLine::setHistoryLine()
 {
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* line = static_cast<CEGUI::Editbox*>(win_mgr.getWindow( "Chatline"));
+	//CEGUI::Editbox* line = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindow ("Chatline"));
+	CEGUI::Editbox* line = static_cast<CEGUI::Editbox*>(m_window);
 	
 	if (m_history_line == 0)
 	{
--- a/src/gui/clipboard.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/clipboard.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -7,6 +7,9 @@
 #include "tchar.h"
 #endif
 
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
 template<> SWUtil::Clipboard* Ogre::Singleton<SWUtil::Clipboard>::SUMWARS_OGRE_SINGLETON = 0;
 
 namespace SWUtil
@@ -14,14 +17,14 @@
 
 	Clipboard::Clipboard ()
 	{
-		DEBUG ("Clipboard costructor!");
+		SW_DEBUG ("Clipboard costructor!");
 	}
 
 
 	bool Clipboard::copy (bool cutInsteadOfCopy) 
 	{
-		DEBUG ("Reached Clipboard copy; cut? %d", cutInsteadOfCopy);
-		CEGUI::Window* sheet = CEGUI::System::getSingleton().getGUISheet();
+		SW_DEBUG ("Reached Clipboard copy; cut? %d", cutInsteadOfCopy);
+		CEGUI::Window* sheet = CEGUIUtility::getRootSheet (CEGUI::System::getSingletonPtr ());
 		if (!sheet) return false;
 
 		CEGUI::Window* active = sheet->getActiveChild();
@@ -86,12 +89,12 @@
 
 	bool Clipboard::paste ()
 	{
-		DEBUG ("Reached clipboard paste...");
+		SW_DEBUG ("Reached clipboard paste...");
 		
 		std::string clipboardContents = _readFromClipboard ();
-		DEBUG ("Got clipboard text to be: %s", clipboardContents.c_str ());
+		SW_DEBUG ("Got clipboard text to be: %s", clipboardContents.c_str ());
 
-		CEGUI::Window* sheet = CEGUI::System::getSingleton().getGUISheet();
+		CEGUI::Window* sheet = CEGUIUtility::getRootSheet (CEGUI::System::getSingletonPtr ());
 		if (!sheet) return false;
 
 		CEGUI::Window* active = sheet->getActiveChild();
@@ -141,7 +144,7 @@
 				edit->setText( newtext.erase( beg, len ) );
 			}
 			
-			DEBUG ("Selection start idx: %d", beg);
+			SW_DEBUG ("Selection start idx: %d", beg);
 
 			// Now paste the new text.
 			CEGUI::String newtext = edit->getText();
@@ -149,9 +152,14 @@
 			edit->setText (newtext);
 
 			// Also update the caret location, so that it is behind the pasted text.
+#ifdef CEGUI_07
 			edit->setCaratIndex (beg + clipboardContents.length ());
+#else
+			// Ok, I won't create a function just for the caret name.
+			edit->setCaretIndex (beg + clipboardContents.length ());
+#endif
 
-			DEBUG ("updated edit box contents");
+			SW_DEBUG ("updated edit box contents");
 		}
 		else 
 		{
--- a/src/gui/controlpanel.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/controlpanel.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,531 +1,545 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "controlpanel.h"
-#include "player.h"
-
-ControlPanel::ControlPanel (Document* doc)
-	: ItemWindow(doc)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	std::string name;
-
-	// Rahmen fuer die untere Kontrollleiste
-	CEGUI::FrameWindow* ctrl_panel = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("controlpanel.layout");
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "controlpanel.h"
+#include "player.h"
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+ControlPanel::ControlPanel (Document* doc)
+	: ItemWindow(doc)
+{
+	std::string name;
+
+	// Load the layout for the panel that the be used to control various actions
+	CEGUI::Window* ctrl_panel = CEGUIUtility::loadLayoutFromFile ("controlpanel.layout");
 	if (!ctrl_panel)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "controlpanel.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "controlpanel.layout");
 	}
-
-	CEGUI::Window* ctrl_panel_holder = win_mgr.loadWindowLayout( "controlpanel_holder.layout" );
+
+	CEGUI::Window* ctrl_panel_holder = CEGUIUtility::loadLayoutFromFile ("controlpanel_holder.layout");
 	if (!ctrl_panel_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
+	}
+	
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (ctrl_panel_holder, "ControlPanel_Holder");
+	CEGUI::Window* wndCharInfo = CEGUIUtility::getWindowForLoadedLayoutEx (ctrl_panel, "ControlPanel");
+	if (wndHolder && wndCharInfo)
+	{
+		CEGUIUtility::addChildWidget (wndHolder, wndCharInfo);
+	}
+	else
+	{
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for control panel.");
+		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for control panel.");
+	}
+
+	m_window = ctrl_panel_holder;
+	
+	ctrl_panel->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
+	ctrl_panel->setWantsMultiClickEvents(false);
+
+
+	// Bestandteile der Kontrollleiste hinzufuegen
+	CEGUI::PushButton* btn;
+	CEGUI::Window* label;
+
+	// Balken fuer HP
+	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/HealthProgressBar"));
+	bar->setWantsMultiClickEvents(false);
+	bar->setProgress(0.0);
+	
+	// Balken fuer Experience
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/ExperienceProgressBar"));
+	bar->setWantsMultiClickEvents(false);
+	bar->setProgress(0.0);
+
+
+	// Button Inventar
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/InventoryButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonInventoryClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+	btn->setWantsMultiClickEvents(false);
+
+	// Button Charakterinfo
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/CharInfoButton"));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonCharInfoClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+	
+
+	// Button Chat oeffnen
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/ChatOpenButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonOpenChatClicked, this));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// Button SkillTree
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/SkillTreeButton"));
+	btn->setID(0);
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+	
+
+	// Button Party
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/PartyButton"));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonPartyClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+	
+	// Quest Information Button
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/QuestInfoButton"));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonQuestInfoClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+	
+	// Button Speichern und Beenden
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/SaveExitButton"));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSaveExitClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// Button Optionen
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/OptionsButton"));
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonOptionsClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// Anzeige linke Maustaste Faehigkeit
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/LeftClickAbilityImage");
+	label->setID(1);
+	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// Balken fuer linke Maustaste Faehigkeit
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/LeftClickAbilityProgressBar"));
+	bar->setWantsMultiClickEvents(false);
+	bar->setProgress(0.0);
+	bar->setAlpha(0.5);
+	bar->setAlwaysOnTop(true);
+
+	// Anzeige rechte Maustaste Faehigkeit
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/RightClickAbilityImage");
+	label->setID(2);
+	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// Balken fuer rechte Maustaste Faehigkeit
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/RightClickAbilityProgressBar"));
+	bar->setWantsMultiClickEvents(false);
+	bar->setProgress(0.0);
+	bar->setAlpha(0.5);
+	bar->setAlwaysOnTop(true);
+
+	// alternate right mouse skill
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/AlternateRightClickAbilityImage");
+	label->setID(3);
+	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&ControlPanel::onGUIItemHover, this));
+
+	// progress bar for alternate right mouse skill
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/AlternateRightClickAbilityProgressBar"));
+	bar->setWantsMultiClickEvents(false);
+	bar->setProgress(0.0);
+	bar->setAlpha(0.5);
+	bar->setAlwaysOnTop(true);
+	
+	// Inventar Guertel
+	int i;
+	std::ostringstream outStream;
+	for (i=0;i<Equipement::getMaxBeltItemNumber();i++)
+	{
+		outStream.str("");
+		outStream << "ControlPanel/CPContainer/CP_Btns/PotionHolder/";
+		outStream << "InventoryItem" << i;
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
+		label->setID(Equipement::BELT_ITEMS+i);
+		label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&ControlPanel::onItemMouseButtonPressed, (ItemWindow*) this));
+		label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&ControlPanel::onItemMouseButtonReleased, (ItemWindow*) this));
+		label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&ControlPanel::onItemHover, (ItemWindow*) this));
+		label->setWantsMultiClickEvents(false);
+		
+		outStream.str("");
+		outStream << "ControlPanel/CPContainer/CP_Btns/PotionHolder/";
+		outStream << "InventoryShortcutLabel" << i;
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
+		std::stringstream stream;
+		stream << (i+1)%10;
+		label->setText(stream.str());
+		label->setAlwaysOnTop(true);
+		label->setMousePassThroughEnabled(true);
+		
+		outStream.str("");
+		outStream << "ControlPanel/CPContainer/CP_Btns/PotionHolder/";
+		outStream << "BeltPotionCounter" << i;
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
+		label->setAlwaysOnTop(true);
+		label->setMousePassThroughEnabled(true);
+	}
+
+	createAnimations ();
+	
+	updateTranslation();
+}
+
+void ControlPanel::update()
+{
+	CEGUI::Window* label, *img;
+	std::ostringstream out_stream;
+	int timernr;
+	float perc=0;
+	std::string name;
+
+	Player* player = m_document->getLocalPlayer();
+	m_silent_current_update = m_silent;
+
+	// Balken fuer HP
+	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/HealthProgressBar"));
+	float hperc = player->getDynAttr()->m_health / player->getBaseAttrMod()->m_max_health;
+	if (bar->getProgress() != hperc)
+	{
+		bar->setProgress(hperc);
+	}
+	out_stream.str("");
+	out_stream << gettext("Hitpoints");
+	out_stream << ": ";
+	out_stream << (int) player->getDynAttr()->m_health<<"/"<< (int) player->getBaseAttrMod()->m_max_health;
+	if (bar->getTooltipText() != (CEGUI::utf8*) out_stream.str().c_str())
+	{
+		bar->setTooltipText((CEGUI::utf8*) out_stream.str().c_str());
+	}
+	
+	// Balken fuer Experience
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/ExperienceProgressBar"));
+	float eperc = player->getDynAttr()->m_experience / player->getBaseAttr()->m_max_experience;
+	if (bar->getProgress() != eperc)
+	{
+		bar->setProgress(eperc);
+	}
+	out_stream.str("");
+	out_stream << gettext("Experience");
+	out_stream << ": ";
+	out_stream << (int) player->getDynAttr()->m_experience<<"/"<<(int) player->getBaseAttr()->m_max_experience;
+	if (bar->getTooltipText() != (CEGUI::utf8*) out_stream.str().c_str())
+	{
+		bar->setTooltipText((CEGUI::utf8*) out_stream.str().c_str());
+	}
+	
+	std::map<int,LearnableAbility>::iterator iter;
+	std::map<int,LearnableAbility>& ablt = player->getLearnableAbilities();
+	
+	// Image Schaden Attacke links
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/LeftClickAbilityImage");
+	name = player->getLeftAction();
+	
+	std::string imagename = "";
+	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
+	{
+		if (iter->second.m_type == name)
+		{
+			imagename = iter->second.m_image;
+		}
+	}
+	
+	std::string tooltip;
+	tooltip= m_document->getAbilityDescription(name);
+	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
+	{
+		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
+	}
+	
+	if (imagename == "")
+	{
+		imagename = CEGUIUtility::getImageNameWithSkin ("skills", name);
+	}
+	if (imagename != label->getProperty("Image"))
+	{
+		label->setProperty("Image",imagename);
 	}
-	
-	CEGUI::Window* wndHolder = win_mgr.getWindow("ControlPanel_Holder");
-	CEGUI::Window* wndCharInfo = win_mgr.getWindow("ControlPanel");
-	if (wndHolder && wndCharInfo)
-	{
-		wndHolder->addChildWindow (wndCharInfo);
-	}
-	else
-	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for control panel.");
-		if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for control panel.");
-	}
-
-	m_window = ctrl_panel_holder;
-	
-	ctrl_panel->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
-	ctrl_panel->setWantsMultiClickEvents(false);
-
-
-	// Bestandteile der Kontrollleiste hinzufuegen
-	CEGUI::PushButton* btn;
-	CEGUI::Window* label;
-
-	// Balken fuer HP
-	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow("HealthProgressBar"));
-	bar->setWantsMultiClickEvents(false);
-	bar->setProgress(0.0);
-	
-	// Balken fuer Experience
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow("ExperienceProgressBar"));
-	bar->setWantsMultiClickEvents(false);
-	bar->setProgress(0.0);
-
-
-	// Button Inventar
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("InventoryButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonInventoryClicked, this));
-	btn->setWantsMultiClickEvents(false);
-
-	// Button Charakterinfo
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CharInfoButton"));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonCharInfoClicked, this));
-	
-
-	// Button Chat oeffnen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ChatOpenButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonOpenChatClicked, this));
-	btn->setWantsMultiClickEvents(false);
-
-	// Button SkillTree
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SkillTreeButton"));
-	btn->setID(0);
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
-	
-
-	// Button Party
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("PartyButton"));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonPartyClicked, this));
-	
-	// Button Party
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("QuestInfoButton"));
-	//btn->setText("Q");
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonQuestInfoClicked, this));
-	
-	// Button Speichern und Beenden
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SaveExitButton"));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSaveExitClicked, this));
-
-	// Button Optionen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("OptionsButton"));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonOptionsClicked, this));
-	
-	// Anzeige linke Maustaste Faehigkeit
-	label = win_mgr.getWindow("LeftClickAbilityImage");
-	label->setID(1);
-	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
-
-	// Balken fuer linke Maustaste Faehigkeit
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow("LeftClickAbilityProgressBar"));
-	bar->setWantsMultiClickEvents(false);
-	bar->setProgress(0.0);
-	bar->setAlpha(0.5);
-	bar->setAlwaysOnTop(true);
-
-	// Anzeige rechte Maustaste Faehigkeit
-	label = win_mgr.getWindow("RightClickAbilityImage");
-	label->setID(2);
-	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
-
-	// Balken fuer rechte Maustaste Faehigkeit
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow("RightClickAbilityProgressBar"));
-	bar->setWantsMultiClickEvents(false);
-	bar->setProgress(0.0);
-	bar->setAlpha(0.5);
-	bar->setAlwaysOnTop(true);
-
-	// alternate right mouse skill
-	label = win_mgr.getWindow("AlternateRightClickAbilityImage");
-	label->setID(3);
-	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, this));
-
-	// progress bar for alternate right mouse skill
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow("AlternateRightClickAbilityProgressBar"));
-	bar->setWantsMultiClickEvents(false);
-	bar->setProgress(0.0);
-	bar->setAlpha(0.5);
-	bar->setAlwaysOnTop(true);
-	
-	// Inventar Guertel
-	int i;
-	std::ostringstream outStream;
-	for (i=0;i<Equipement::getMaxBeltItemNumber();i++)
-	{
-		outStream.str("");
-		outStream << "InventoryItem" << i;
-		label = win_mgr.getWindow(outStream.str());
-		label->setID(Equipement::BELT_ITEMS+i);
-		label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&ControlPanel::onItemMouseButtonPressed, (ItemWindow*) this));
-		label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&ControlPanel::onItemMouseButtonReleased, (ItemWindow*) this));
-		label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&ControlPanel::onItemHover, (ItemWindow*) this));
-		label->setWantsMultiClickEvents(false);
-		
-		outStream.str("");
-		outStream << "InventoryShortcutLabel" << i;
-		label = win_mgr.getWindow(outStream.str());
-		std::stringstream stream;
-		stream << (i+1)%10;
-		label->setText(stream.str());
-		label->setAlwaysOnTop(true);
-		label->setMousePassThroughEnabled(true);
-		
-		outStream.str("");
-		outStream << "BeltPotionCounter" << i;
-		label = win_mgr.getWindow(outStream.str());
-		label->setAlwaysOnTop(true);
-		label->setMousePassThroughEnabled(true);
-	}
-
-	createAnimations ();
-	
-	updateTranslation();
-}
-
-void ControlPanel::update()
-{
-		// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label, *img;
-	std::ostringstream out_stream;
-	int timernr;
-	float perc=0;
-	std::string name;
-
-	Player* player = m_document->getLocalPlayer();
-	m_silent_current_update = m_silent;
-
-	// Balken fuer HP
-	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "HealthProgressBar"));
-	float hperc = player->getDynAttr()->m_health / player->getBaseAttrMod()->m_max_health;
-	if (bar->getProgress() != hperc)
-	{
-		bar->setProgress(hperc);
-	}
-	out_stream.str("");
-	out_stream << gettext("Hitpoints");
-	out_stream << ": ";
-	out_stream << (int) player->getDynAttr()->m_health<<"/"<< (int) player->getBaseAttrMod()->m_max_health;
-	if (bar->getTooltipText() != (CEGUI::utf8*) out_stream.str().c_str())
-	{
-		bar->setTooltipText((CEGUI::utf8*) out_stream.str().c_str());
-	}
-	
-	// Balken fuer Experience
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "ExperienceProgressBar"));
-	float eperc = player->getDynAttr()->m_experience / player->getBaseAttr()->m_max_experience;
-	if (bar->getProgress() != eperc)
-	{
-		bar->setProgress(eperc);
-	}
-	out_stream.str("");
-	out_stream << gettext("Experience");
-	out_stream << ": ";
-	out_stream << (int) player->getDynAttr()->m_experience<<"/"<<(int) player->getBaseAttr()->m_max_experience;
-	if (bar->getTooltipText() != (CEGUI::utf8*) out_stream.str().c_str())
-	{
-		bar->setTooltipText((CEGUI::utf8*) out_stream.str().c_str());
-	}
-	
-	std::map<int,LearnableAbility>::iterator iter;
-	std::map<int,LearnableAbility>& ablt = player->getLearnableAbilities();
-	
-	// Image Schaden Attacke links
-	label =  win_mgr.getWindow( "LeftClickAbilityImage");
-	name = player->getLeftAction();
-	
-	std::string imagename = "";
-	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
-	{
-		if (iter->second.m_type == name)
-		{
-			imagename = iter->second.m_image;
-		}
-	}
-	
-	std::string tooltip;
-	tooltip= m_document->getAbilityDescription(name);
-	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
-	{
-		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
-	}
-	
-	if (imagename == "")
-	{
-		imagename = "set:skills image:";
-		imagename += name;
-	}
-	if (imagename != label->getProperty("Image"))
-	{
-		label->setProperty("Image",imagename);
-	}
-
-	double alpha;
-
-	// Balken fuer Schaden Attacke links
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "LeftClickAbilityProgressBar"));
-	timernr =  Action::getActionInfo(player->getLeftAction())->m_timer_nr;
-	perc = player->getTimerPercent(timernr);
-
-	if (bar->getProgress() != perc)
-	{
-		bar->setProgress(perc);
-	}
-	
-	alpha = 1;
-	if (perc > 0)
-	{
-		alpha = 0.5;
-	}
-	if (label->getAlpha() != alpha)
-	{
-		label->setAlpha(alpha);
-	}
-
-	perc =0;
-
-	// Image Attacke rechts
-	label =  win_mgr.getWindow( "RightClickAbilityImage");
-	name = player->getRightAction();
-	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
-	{
-		if (iter->second.m_type == name)
-		{
-			imagename = iter->second.m_image;
-		}
-	}
-	
-	tooltip= m_document->getAbilityDescription(name);
-	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
-	{
-		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
-	}
-	
-	if (imagename == "")
-	{
-		imagename = "set:skills image:";
-		imagename += name;
-	}
-	if (imagename != label->getProperty("Image"))
-	{
-		label->setProperty("Image",imagename);
-	}
-
-	// Balken fuer Schaden Attacke rechts
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "RightClickAbilityProgressBar"));
-	timernr =  Action::getActionInfo(player->getRightAction())->m_timer_nr;
-	perc = player->getTimerPercent(timernr);
-
-	if (bar->getProgress() != perc)
-	{
-		bar->setProgress(perc);
-	}
-	
-	alpha = 1;
-	if (perc > 0)
-	{
-		alpha = 0.5;
-	}
-	if (label->getAlpha() != alpha)
-	{
-		label->setAlpha(alpha);
-	}
-	
-	// image for alternate right skill
-	label =  win_mgr.getWindow( "AlternateRightClickAbilityImage");
-	name = player->getRightAlternateAction();
-	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
-	{
-		if (iter->second.m_type == name)
-		{
-			imagename = iter->second.m_image;
-		}
-	}
-	
-	tooltip= m_document->getAbilityDescription(name);
-	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
-	{
-		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
-	}
-	
-	if (imagename == "")
-	{
-		imagename = "set:skills image:";
-		imagename += name;
-	}
-	if (imagename != label->getProperty("Image"))
-	{
-		label->setProperty("Image",imagename);
-	}
-
-	// Balken fuer Schaden Attacke rechts
-	bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "AlternateRightClickAbilityProgressBar"));
-	timernr =  Action::getActionInfo(player->getRightAlternateAction())->m_timer_nr;
-	perc = player->getTimerPercent(timernr);
-
-	if (bar->getProgress() != perc)
-	{
-		bar->setProgress(perc);
-	}
-
-	alpha = 1;
-	if (perc > 0)
-	{
-		alpha = 0.5;
-	}
-	if (label->getAlpha() != alpha)
-	{
-		label->setAlpha(alpha);
-	}
-
-	Item* it;
-	Equipement* equ = player->getEquipement();
-
-	// Guertel
-	for (int i=0;i<equ->getMaxBeltItemNumber();i++)
-	{
-		out_stream.str("");
-		out_stream << "InventoryItem" << i;
-		img =  win_mgr.getWindow(out_stream.str().c_str());
-		it = equ->getItem(Equipement::BELT_ITEMS+i);
-
-		updateItemWindow(img, it, player);
-		
-		out_stream.str("");
-		out_stream << "BeltPotionCounter" << i;
-		label = win_mgr.getWindow(out_stream.str());
-		if (it == 0)
-		{
-			if (label->isVisible())
-				label->setVisible(false);
-			continue;
-		}
-		
-		int count = equ->getNumSmallItemsOfType(it->m_subtype);
-		if (count == 1)
-		{
-			if (label->isVisible())
-				label->setVisible(false);
-			continue;
-		}
-		
-		out_stream.str("");
-		out_stream << "("<<count << ")";
-		if (! label->isVisible())
-			label->setVisible(true);
-		if (label->getText() != out_stream.str().c_str())
-		{
-			label->setText(out_stream.str().c_str());
-		}
-		
-		label->setAlwaysOnTop(true);
-		label->setMousePassThroughEnabled(true);
-	}
-}
-
-void ControlPanel::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("OptionsButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Options"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SaveExitButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Save & Exit"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ChatOpenButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Chat"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("InventoryButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Inventory"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CharInfoButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Character"));
-
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SkillTreeButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Skilltree"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "PartyButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Party"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "QuestInfoButton"));
-	btn->setTooltipText((CEGUI::utf8*) gettext("Quests"));
-
-	
-}
-
-bool ControlPanel::onButtonSaveExitClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonSaveExitClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonInventoryClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonInventoryClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonCharInfoClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonCharInfoClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonSkilltreeClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	//ID 2 is right mouse button skill, ID 3 is right mouse button alternate skill
-	bool right = (id ==2 || id == 3);
-	bool alternate = (id == 3);
-	
-	m_document->onButtonSkilltreeClicked(right, alternate);
-	return true;
-}
-
-bool ControlPanel::onButtonPartyClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonPartyInfoClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonOpenChatClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonOpenChatClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonQuestInfoClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonQuestInfoClicked();
-	return true;
-}
-
-bool ControlPanel::onButtonOptionsClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonOptionsClicked();
-	return true;
-}
-
-
+
+	double alpha;
+
+	// Balken fuer Schaden Attacke links
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/LeftClickAbilityProgressBar"));
+	timernr =  Action::getActionInfo(player->getLeftAction())->m_timer_nr;
+	perc = player->getTimerPercent(timernr);
+
+	if (bar->getProgress() != perc)
+	{
+		bar->setProgress(perc);
+	}
+	
+	alpha = 1;
+	if (perc > 0)
+	{
+		alpha = 0.5;
+	}
+	if (label->getAlpha() != alpha)
+	{
+		label->setAlpha(alpha);
+	}
+
+	perc =0;
+
+	// Image Attacke rechts
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/RightClickAbilityImage");
+	name = player->getRightAction();
+	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
+	{
+		if (iter->second.m_type == name)
+		{
+			imagename = iter->second.m_image;
+		}
+	}
+	
+	tooltip= m_document->getAbilityDescription(name);
+	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
+	{
+		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
+	}
+	
+	if (imagename == "")
+	{
+		imagename = CEGUIUtility::getImageNameWithSkin ("skills", name);
+	}
+	if (imagename != label->getProperty("Image"))
+	{
+		label->setProperty("Image",imagename);
+	}
+
+	// Balken fuer Schaden Attacke rechts
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/RightClickAbilityProgressBar"));
+	timernr =  Action::getActionInfo(player->getRightAction())->m_timer_nr;
+	perc = player->getTimerPercent(timernr);
+
+	if (bar->getProgress() != perc)
+	{
+		bar->setProgress(perc);
+	}
+	
+	alpha = 1;
+	if (perc > 0)
+	{
+		alpha = 0.5;
+	}
+	if (label->getAlpha() != alpha)
+	{
+		label->setAlpha(alpha);
+	}
+	
+	// image for alternate right skill
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/AlternateRightClickAbilityImage");
+	name = player->getRightAlternateAction();
+	for (iter = ablt.begin(); iter != ablt.end(); ++iter)
+	{
+		if (iter->second.m_type == name)
+		{
+			imagename = iter->second.m_image;
+		}
+	}
+	
+	tooltip= m_document->getAbilityDescription(name);
+	if (label->getTooltipText() != (CEGUI::utf8*) tooltip.c_str())
+	{
+		label->setTooltipText((CEGUI::utf8*) tooltip.c_str());
+	}
+	
+	if (imagename == "")
+	{
+		imagename = CEGUIUtility::getImageNameWithSkin ("skills", name);
+	}
+	if (imagename != label->getProperty("Image"))
+	{
+		label->setProperty("Image",imagename);
+	}
+
+	// Balken fuer Schaden Attacke rechts
+	bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SkillBtns/AlternateRightClickAbilityProgressBar"));
+	timernr =  Action::getActionInfo(player->getRightAlternateAction())->m_timer_nr;
+	perc = player->getTimerPercent(timernr);
+
+	if (bar->getProgress() != perc)
+	{
+		bar->setProgress(perc);
+	}
+
+	alpha = 1;
+	if (perc > 0)
+	{
+		alpha = 0.5;
+	}
+	if (label->getAlpha() != alpha)
+	{
+		label->setAlpha(alpha);
+	}
+
+	Item* it;
+	Equipement* equ = player->getEquipement();
+
+	// Guertel
+	for (int i=0;i<equ->getMaxBeltItemNumber();i++)
+	{
+		out_stream.str("");
+		out_stream << "ControlPanel/CPContainer/CP_Btns/PotionHolder/";
+		out_stream << "InventoryItem" << i;
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
+		it = equ->getItem(Equipement::BELT_ITEMS+i);
+
+		updateItemWindow(img, it, player);
+		
+		out_stream.str("");
+		out_stream << "ControlPanel/CPContainer/CP_Btns/PotionHolder/";
+		out_stream << "BeltPotionCounter" << i;
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str());
+		if (it == 0)
+		{
+			if (label->isVisible())
+				label->setVisible(false);
+			continue;
+		}
+		
+		int count = equ->getNumSmallItemsOfType(it->m_subtype);
+		if (count == 1)
+		{
+			if (label->isVisible())
+				label->setVisible(false);
+			continue;
+		}
+		
+		out_stream.str("");
+		out_stream << "("<<count << ")";
+		if (! label->isVisible())
+			label->setVisible(true);
+		if (label->getText() != out_stream.str().c_str())
+		{
+			label->setText(out_stream.str().c_str());
+		}
+		
+		label->setAlwaysOnTop(true);
+		label->setMousePassThroughEnabled(true);
+	}
+}
+
+void ControlPanel::updateTranslation()
+{
+	CEGUI::PushButton* btn;
+
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/OptionsButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Options"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/SaveExitButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Save & Exit"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/ChatOpenButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Chat"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/InventoryButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Inventory"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/CharInfoButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Character"));
+
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/SkillTreeButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Skilltree"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/PartyButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Party"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/CP_Btns/CP_SysBtns/QuestInfoButton"));
+	btn->setTooltipText((CEGUI::utf8*) gettext("Quests"));
+
+	
+}
+
+
+
+bool ControlPanel::onButtonSaveExitClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonSaveExitClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonInventoryClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonInventoryClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonCharInfoClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonCharInfoClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonSkilltreeClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	//ID 2 is right mouse button skill, ID 3 is right mouse button alternate skill
+	bool right = (id ==2 || id == 3);
+	bool alternate = (id == 3);
+	
+	m_document->onButtonSkilltreeClicked(right, alternate);
+	return true;
+}
+
+bool ControlPanel::onButtonPartyClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonPartyInfoClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonOpenChatClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonOpenChatClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonQuestInfoClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonQuestInfoClicked();
+	return true;
+}
+
+bool ControlPanel::onButtonOptionsClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonOptionsClicked();
+	return true;
+}
+
+
 void ControlPanel::createAnimations ()
 {
 #if ((CEGUI_VERSION_MAJOR << 16) + (CEGUI_VERSION_MINOR << 8) + CEGUI_VERSION_PATCH >= (0 << 16)+(7 << 8)+5)
 
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
-
-	CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("ControlPanelAnimations.xml");
+    CEGUI::AnimationManager& animMgr = CEGUI::AnimationManager::getSingleton();
+    animMgr.loadAnimationsFromXML("ControlPanelAnimations.xml");
 	
 	// Small tab animations
-	label = win_mgr.getWindow("HealthProgressBar");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ControlPanel/CPContainer/GlobeAndSysBtnsHolder/HealthProgressBar");
 	CEGUI::AnimationInstance* instance = CEGUI::AnimationManager::getSingleton().instantiateAnimation("HealthbarAnimation");
 	instance->setTargetWindow(label);
     instance->start();
@@ -533,3 +547,15 @@
 
 #endif
 }
+
+
+
+/**
+ * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+ * \brief Handle the hovering of gui items.
+ */
+bool ControlPanel::onGUIItemHover (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
--- a/src/gui/controlpanel.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/controlpanel.h	Thu Mar 20 19:04:28 2014 +0100
@@ -57,6 +57,18 @@
 		bool onButtonSkilltreeClicked(const CEGUI::EventArgs& evt);
 		
 	private:
+		/**
+		 * \fn bool onGUIItemClick (const CEGUI::EventArgs& evt)
+		 * \brief Handle the click of gui items.
+		 */
+		bool onGUIItemClick (const CEGUI::EventArgs& evt);
+
+		/**
+		 * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+		 * \brief Handle the hovering of gui items.
+		 */
+		bool onGUIItemHover (const CEGUI::EventArgs& evt);
+
 		/**
 		* \fn bool onButtonSaveExitClicked(const CEGUI::EventArgs& evt)
 		* \brief Behandelt Klick auf Speichern/Beenden
--- a/src/gui/creditswindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/creditswindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,166 +1,121 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "creditswindow.h"
-#include "ceguiutility.h"
-#include "OgreConfigFile.h"
-#include "OgreDataStream.h"
-#include "sumwarshelper.h"
-
-#include "config.h"
-
-#include "creditswindow_content.inc"
-
-CreditsWindow::CreditsWindow(Document* doc, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUG ("Creating CreditsWindow using the cegui skin: [%s]", ceguiSkinName.c_str ());
-
-	std::stringstream ss;
-	ss << ceguiSkinName << "/FrameWindow";
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::FrameWindow* creditsframe = (CEGUI::FrameWindow*) win_mgr.createWindow(ss.str ().c_str (), "CreditsWindow");
-	
-	creditsframe->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.1f))); //0.0/0.8
-	creditsframe->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.8f))); //1.0/0.2
-	creditsframe->setProperty("FrameEnabled","false");
-	creditsframe->setProperty("TitlebarEnabled","false");
-	creditsframe->setProperty("CloseButtonEnabled","false");
-	creditsframe->setAlpha(0.4);
-	
-	m_window = creditsframe;
-	
-	ss.str ("");
-	ss << ceguiSkinName << "/ScrollablePaneNoBar";
-	CEGUI::ScrollablePane* pane = static_cast<CEGUI::ScrollablePane*> (win_mgr.createWindow(ss.str ().c_str (), "CreditsPane"));
-	creditsframe->addChildWindow(pane);
-	pane->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
-	pane->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
-	pane->setInheritsAlpha(false);
-	pane->setContentPaneAutoSized(true);
-	
-	ss.str ("");
-	ss << ceguiSkinName << "/StaticText";
-
-	CEGUI::Window* credits;
-	credits = win_mgr.createWindow(ss.str ().c_str (), "CreditWindow");
-	pane->addChildWindow(credits);
-	credits->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
-	credits->setSize(CEGUI::UVector2(cegui_reldim(1.00f), cegui_reldim( 1.0f)));
-	credits->setProperty("FrameEnabled", "false");
-	credits->setProperty("BackgroundEnabled", "true");
-	credits->setProperty("HorzFormatting", "HorzCentred");
-
-	Ogre::DataStreamPtr mem_stream(OGRE_NEW Ogre::MemoryDataStream((void*)authors_content.c_str(), authors_content.length(), false, true));
-	mem_stream->seek(0);
-
-	Ogre::ConfigFile cf;
-	cf.load(mem_stream, "=", false);
-
-	// Go through all sections & settings in the file
-	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
-	std::list<std::string> content;
-
-	std::string secName, typeName, archName;
-	while (seci.hasMoreElements())
-	{
-		secName = seci.peekNextKey();
-		secName = secName.erase(0,2) + LINE_ENDING;
-		content.push_back(CEGUIUtility::getColourizedString(CEGUIUtility::Red, secName, CEGUIUtility::White).c_str());
-		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
-		Ogre::ConfigFile::SettingsMultiMap::iterator i;
-		for (i = settings->begin(); i != settings->end(); ++i)
-		{
-			typeName = i->first;
-			archName = i->second;
-			content.push_back(archName + LINE_ENDING);
-		}
-		content.push_back(std::string(" ") + LINE_ENDING);
-	}
-	
-	credits->setFont("DejaVuSerif-12");
-	
-	std::string added;
-	CEGUI::UVector2 sz = credits->getSize();
-	sz.d_y = CEGUIUtility::getWindowSizeForText(content, credits->getFont(), added).d_y;
-	credits->setSize(sz);
-	credits->setMaxSize(CEGUI::UVector2(CEGUI::UDim(5.0,5.0), CEGUI::UDim(5.0,5.0)));
-	credits->setText(added);
-	if (credits->isPropertyPresent ("BackgroundColours"))
-	{
-		credits->setProperty("BackgroundColours", "tl:99000000 tr:99000000 bl:99000000 br:99000000");
-	}
-	else if (credits->isPropertyPresent ("BackgroundColour"))
-	{
-		credits->setProperty("BackgroundColour", "99000000");
-	}
-	credits->setAlpha(0.9);
-	
-	
-	updateTranslation();
-	
-	m_shown_timer.start();
-}
-
-void CreditsWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* wtext = win_mgr.getWindow("CreditWindow");
-	
-	
-	CEGUI::Font* fnt = wtext->getFont();
-	
-	// Set Size of the Window automatically
-	CEGUI::UVector2 size = wtext->getSize();
-	CEGUI::Rect isize = wtext->getUnclippedInnerRect ();
-	//float height = PixelAligned(CEGUIUtility::fitTextToWindow(wtext->getText(), isize.getWidth(), CEGUIUtility::WordWrapCentred, fnt).lines * fnt->getLineSpacing());
-	size.d_y = CEGUIUtility::getWindowSizeForText(wtext->getText().c_str(), fnt).d_y; //CEGUI::UDim(0.0, height);
-	
-	// FIXME: this factor is a hack to achieve the right window size. Size computation is not correct yet
-	size.d_y.d_scale *= 1.2;
-	wtext->setSize(size);
-}
-
-void CreditsWindow::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	if (!m_window->isVisible())
-	{
-		m_shown_timer.start();
-	}
-	else
-	{
-		float starttime = 2000;	// time before scrolling starts
-		float alltime = 40000;	// time for scrolling
-		float pos = (m_shown_timer.getTime()-starttime)/alltime;
-		
-		if (pos > 1.0)
-			pos = 1.0;
-		
-		if (pos < 0.0)
-			pos = 0.0;
-		
-		// credits scrolling
-		//CEGUI::Window* wtext = win_mgr.getWindow("CreditWindow");
-		CEGUI::ScrollablePane* pane  = static_cast<CEGUI::ScrollablePane*>(win_mgr.getWindow("CreditsPane"));
-
-		pane->setVerticalScrollPosition(pos);
-	}
-}
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "creditswindow.h"
+#include "ceguiutility.h"
+#include "OgreConfigFile.h"
+#include "OgreDataStream.h"
+#include "sumwarshelper.h"
+
+#include "config.h"
+
+#include "creditswindow_content.inc"
+
+CreditsWindow::CreditsWindow(Document* doc, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	CEGUI::FrameWindow* creditsframe = static_cast <CEGUI::FrameWindow*> (CEGUIUtility::loadLayoutFromFile ("creditsscreen.layout"));
+	if (!creditsframe)
+	{
+		WARNING ("WARNING: Failed to load [%s]", "creditsscreen.layout");
+	}
+	CEGUI::Window* credits_frame_holder = CEGUIUtility::loadLayoutFromFile ("creditsscreen_holder.layout");
+	if (!credits_frame_holder)
+	{
+		WARNING ("WARNING: Failed to load [%s]", "creditsscreen_holder.layout");
+	}
+	
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (credits_frame_holder, "CreditsWindow_Holder");
+	CEGUI::Window* wndCharInfo = CEGUIUtility::getWindowForLoadedLayoutEx (creditsframe, "CreditsWindow");
+	CEGUIUtility::addChildWidget (wndHolder, wndCharInfo);
+	m_window = credits_frame_holder;
+
+	CEGUI::Window* credits = CEGUIUtility::getWindowForLoadedLayoutEx (creditsframe, "CreditsPane/CreditsText");
+
+	Ogre::DataStreamPtr mem_stream(OGRE_NEW Ogre::MemoryDataStream((void*)authors_content.c_str(), authors_content.length(), false, true));
+	mem_stream->seek(0);
+
+	Ogre::ConfigFile cf;
+	cf.load(mem_stream, "=", false);
+
+	// Go through all sections & settings in the file
+	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+	std::list<std::string> content;
+	CEGUI::String outputText;
+
+	std::string secName, typeName, archName;
+	while (seci.hasMoreElements())
+	{
+		secName = seci.peekNextKey();
+		secName = secName.erase(0,2) + LINE_ENDING;
+		content.push_back(CEGUIUtility::getColourizedString(CEGUIUtility::Red, secName, CEGUIUtility::White).c_str());
+		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
+		Ogre::ConfigFile::SettingsMultiMap::iterator i;
+		for (i = settings->begin(); i != settings->end(); ++i)
+		{
+			typeName = i->first;
+			archName = i->second;
+			content.push_back(archName + LINE_ENDING);
+		}
+		content.push_back(std::string(" ") + LINE_ENDING);
+
+	}
+
+	for (std::list<std::string>::iterator it = content.begin (); it != content.end (); ++it)
+	{
+		outputText.append ((CEGUI::utf8*)it->c_str ());
+		outputText.append ((CEGUI::utf8*)LINE_ENDING);
+	}
+	credits->setText (outputText);
+	credits->setFont("DejaVuSerif-12");
+	
+	updateTranslation();
+	
+	m_shown_timer.start();
+}
+
+void CreditsWindow::updateTranslation()
+{
+	// no translation for credits (at least not yet).
+}
+
+void CreditsWindow::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	if (!m_window->isVisible())
+	{
+		m_shown_timer.start();
+	}
+	else
+	{
+		float starttime = 2000;	// time before scrolling starts
+		float alltime = 40000;	// time for scrolling
+		float pos = (m_shown_timer.getTime()-starttime)/alltime;
+		
+		if (pos > 1.0)
+			pos = 1.0;
+		
+		if (pos < 0.0)
+			pos = 0.0;
+		
+		// credits scrolling
+		CEGUI::ScrollablePane* pane  = static_cast<CEGUI::ScrollablePane*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "CreditsWindow/CreditsPane/CreditsText"));
+		pane->setVerticalScrollPosition(pos);
+	}
+}
+
--- a/src/gui/default_resources.cfg.inc.in	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/default_resources.cfg.inc.in	Thu Mar 20 19:04:28 2014 +0100
@@ -67,20 +67,21 @@
 "FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/particle/ogre_1_6\n"
 "\n"
 "[GUI]\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/configs\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/fonts\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/fonts/${ASPECT_RATIO}\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/imagesets\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/layouts\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/layouts/common\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/layouts/${ASPECT_RATIO}\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui_common/imagesets\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/configs\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/fonts\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/fonts/${ASPECT_RATIO}\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/imagesets\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/layouts\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/layouts/common\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/layouts/${ASPECT_RATIO}\n"
 
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/looknfeel\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/schemes\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/animations\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/looknfeel\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/schemes\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/animations\n"
 "\n"
 "[GUI_XML_schemas]\n"
-"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/gui/xml_schemas\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/@CEGUI_VERSION_RESOURCES@/xml_schemas\n"
 "\n"
 "[emotionsets]\n"
 "FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/resources/emotionsets\n"
@@ -97,6 +98,9 @@
 "[world]\n"
 "FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/data/world\n"
 "\n"
+"[main_menu]\n"
+"FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/data/main_menu\n"
+"\n"
 "[npc]\n"
 "FileSystem=@SUMWARS_PREFIX@/@SUMWARS_SHARE_DIR@/data/npc\n"
 "\n"
--- a/src/gui/dialoguewindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/dialoguewindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,785 +1,774 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "dialoguewindow.h"
-#include "ceguiutility.h"
-
-DialogueWindow::DialogueWindow(Document* doc, Scene* scene, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	m_scene = scene;
-	CEGUI::Window* label;
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* game_screen =  win_mgr.getWindow("GameScreen");
-	CEGUI::ScrollablePane* pane;
-	
-	// Oberer und Unterer Balken
-	CEGUI::FrameWindow* lower_bar = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "DialogueLowerBar");
-	lower_bar->setProperty("FrameEnabled","false");
-	lower_bar->setProperty("TitlebarEnabled","false");
-	lower_bar->setProperty("CloseButtonEnabled","false");
-	lower_bar->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.85f)));
-	lower_bar->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 0.15f)));
-	lower_bar->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	lower_bar->setAlwaysOnTop(true);
-	lower_bar->setVisible(false);
-	lower_bar->setWantsMultiClickEvents(false);
-	
-	game_screen->addChildWindow(lower_bar);
-	
-	CEGUI::FrameWindow* upper_bar = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "DialogueUpperBar");
-	upper_bar->setProperty("FrameEnabled","false");
-	upper_bar->setProperty("SizingEnabled","false");
-	upper_bar->setProperty("TitlebarEnabled","false");
-	upper_bar->setProperty("CloseButtonEnabled","false");
-	upper_bar->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
-	upper_bar->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 0.15f)));
-	upper_bar->setAlwaysOnTop(true);
-	upper_bar->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	upper_bar->setVisible(false);
-	upper_bar->setWantsMultiClickEvents(false);
-	
-	game_screen->addChildWindow(upper_bar);
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "UpperBarBackground");
-	upper_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setProperty("MousePassThroughEnabled", "true");
-	label->moveToBack ();
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.00f), cegui_reldim( 0.00f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 0.95f)));
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "LowerBarBackground");
-	lower_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setProperty("MousePassThroughEnabled", "true");
-	label->moveToBack ();
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.00f), cegui_reldim( 0.05f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 0.95f)));
-	
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "SpeakerEmotionImage0");
-	lower_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "true");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.05f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.10f), cegui_reldim( 0.9f)));
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "SpeakerEmotionImage1");
-	lower_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "true");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.89f), cegui_reldim( 0.05f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.10f), cegui_reldim( 0.9f)));
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "SpeakerNameLabel0");
-	lower_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim(0.05f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.3f), cegui_reldim( 0.22f)));
-	
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "SpeakerNameLabel1");
-	lower_bar->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.58f), cegui_reldim(0.05f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.3f), cegui_reldim( 0.22f)));
-	
-	
-	pane = static_cast<CEGUI::ScrollablePane*> (win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ScrollablePaneNoBar"), "SpeakerTextPane0"));
-	lower_bar->addChildWindow(pane);
-	pane->setPosition(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim(0.27f)));
-	pane->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	pane->setSize(CEGUI::UVector2(cegui_reldim(0.38f), cegui_reldim( 0.66f)));
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "SpeakerTextLabel0");
-	pane->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	//label->setFont("DejaVuSerif-10");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
-	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.99f), cegui_reldim( 0.99f)));
-	label->setWantsMultiClickEvents(false);
-	
-	pane = static_cast<CEGUI::ScrollablePane*> (win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ScrollablePaneNoBar"), "SpeakerTextPane1"));
-	lower_bar->addChildWindow(pane);
-	pane->setPosition(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim(0.27f)));
-	pane->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	pane->setSize(CEGUI::UVector2(cegui_reldim(0.38f), cegui_reldim( 0.66f)));
-	
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "SpeakerTextLabel1");
-	pane->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	//label->setFont("DejaVuSerif-10");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
-	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.99f), cegui_reldim( 0.99f)));
-	label->setWantsMultiClickEvents(false);
-	
-	CEGUI::PushButton* btn;
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"),"DialogueSkipAllButton"));
-	lower_bar->addChildWindow(btn);
-	btn->setProperty("InheritsAlpha", "false");
-	btn->setAlwaysOnTop(true);
-	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.82), cegui_reldim( 0.82)));
-	btn->setSize(CEGUI::UVector2(cegui_reldim(0.06f), cegui_reldim( 0.18f)));
-	btn->setText("Skip");
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&DialogueWindow ::onTextClicked, this));
-	
-}
-
-void DialogueWindow::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	Player* player = m_document->getLocalPlayer();
-	Region* reg = player->getRegion();
-	Dialogue* dia =  reg->getDialogue( player->getDialogueId() );
-	
-	bool bar_vis = false;
-	if (reg->getCutsceneMode () == true || player->getDialogueId() != 0)
-	{
-		bar_vis = true;
-	}
-	
-	if (m_document->getGUIState()->m_shown_windows & Document::TRADE)
-	{
-		bar_vis = false;
-	}
-	
-	CEGUI::FrameWindow* upper_bar = static_cast<CEGUI::FrameWindow*>( win_mgr.getWindow("DialogueUpperBar"));
-	CEGUI::FrameWindow* lower_bar = static_cast<CEGUI::FrameWindow*>( win_mgr.getWindow("DialogueLowerBar"));
-	if (upper_bar->isVisible() != bar_vis)
-	{
-		upper_bar->setVisible(bar_vis);
-		lower_bar->setVisible(bar_vis);
-	}
-	
-	if (bar_vis)
-	{
-		CEGUI::Window* skipButton = win_mgr.getWindow("DialogueSkipAllButton");
-		
-		CEGUI::Window* wimage;
-		CEGUI::Window* wname;
-		CEGUI::Window* wtext;
-		CEGUI::ScrollablePane* wpane;
-		
-		if (dia != 0)
-		{
-			skipButton->setVisible(true);
-			// Schleife fuer die moeglichen Sprecher eines Dialogs
-			std::string image, name, text;
-			
-			WorldObject* wo;
-			Creature* cr;
-			
-			std::stringstream stream;
-			
-			Dialogue::SpeakerState* spstate;
-			for (int i=0; i<Dialogue::NR_POSITIONS; i++)
-			{
-				stream.str("");
-				stream << "SpeakerEmotionImage";
-				stream << i;
-				wimage = win_mgr.getWindow(stream.str());
-						
-				stream.str("");
-				stream << "SpeakerNameLabel";
-				stream << i;
-				wname = win_mgr.getWindow(stream.str());
-				
-				stream.str("");
-				stream << "SpeakerTextLabel";
-				stream << i;
-				wtext = win_mgr.getWindow(stream.str());
-				
-				
-				stream.str("");
-				stream << "SpeakerTextPane";
-				stream << i;
-				wpane = static_cast<CEGUI::ScrollablePane*> (win_mgr.getWindow(stream.str()));
-				
-				
-				spstate = dia->getSpeakerState((Dialogue::Position) i);
-				if (spstate != 0)
-				{
-					// Sprecher ist aktiv
-					wo = reg->getObject(spstate->m_id);
-					cr = dynamic_cast<Creature*>(wo);
-					if (cr == 0)
-						continue;
-					
-					
-					name = cr->getName().getTranslation().c_str();
-					
-					
-					if (wname->getText() != (CEGUI::utf8*) name.c_str())
-					{
-						wname->setText((CEGUI::utf8*) name.c_str());
-					}
-					
-					if (!wname->isVisible())
-					{
-						wname->setVisible(true);
-					}
-					
-					text = cr->getSpeakText().m_text.getTranslation();
-					
-					if (text == "" || cr->getSpeakText().m_in_dialogue == false)
-					{
-						wtext->setVisible(false);
-					}
-					else
-					{
-						// remove everything after ##
-						size_t pos = text.find("##");
-						if (pos != std::string::npos)
-						{
-							text.erase(pos);
-						}
-						CEGUI::Font* fnt = wtext->getFont();
-						
-						if (wtext->getText() != (CEGUI::utf8*) text.c_str())
-						{
-							CEGUI::UVector2 size = wtext->getSize();
-							CEGUI::Rect isize = wtext->getUnclippedInnerRect ();
-							FormatedText txt = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)text.c_str(), isize.getWidth(), CEGUIUtility::WordWrapCentred, fnt);
-							float height = PixelAligned(txt.lines * fnt->getLineSpacing());
-							size.d_y = CEGUI::UDim(0.0, height);
-							wtext->setSize(size);
-							wtext->setText((CEGUI::utf8*)txt.text.c_str());
-						}
-						wtext->setVisible(true);
-						
-						// Scrolling des Texts
-						float height = wtext->getSize().d_y.d_offset;
-						if (height > 4*fnt->getLineSpacing())
-						{
-							int initiallines = 2;
-							int lines = (int) (height / fnt->getLineSpacing() + 0.5);
-							float timesplit = initiallines+lines;
-							float frac = cr->getSpeakText().m_displayed_time / cr->getSpeakText().m_time;
-							
-							float scrollpos = 0.0;
-							if (frac > (timesplit - initiallines)/timesplit)
-							{
-								scrollpos = 1.0;
-							}
-							else if (frac > initiallines/timesplit)
-							{
-								scrollpos =(frac * timesplit - initiallines) / (timesplit - initiallines*2);
-							}
-							
-							if (wpane->getVerticalScrollPosition() != scrollpos)
-							{
-								wpane->setVerticalScrollPosition(scrollpos);
-							}
-							
-						}
-					}
-					
-					std::string image = cr->getEmotionImage(cr->getSpeakText().m_emotion);
-					if (wimage->getProperty("Image") != image)
-					{
-						wimage->setProperty("Image",image);
-					}
-					if (!wimage->isVisible())
-					{
-						wimage->setVisible(true);
-					}
-					
-				}
-				else
-				{
-					wimage->setVisible(false);
-					wname->setVisible(false);
-					wtext->setVisible(false);
-				}
-			}
-		}
-		else
-		{
-			for (int i=0; i<Dialogue::NR_POSITIONS; i++)
-			{
-				std::stringstream stream;
-				stream.str("");
-				stream << "SpeakerEmotionImage";
-				stream << i;
-				wimage = win_mgr.getWindow(stream.str());
-						
-				stream.str("");
-				stream << "SpeakerNameLabel";
-				stream << i;
-				wname = win_mgr.getWindow(stream.str());
-				
-				stream.str("");
-				stream << "SpeakerTextLabel";
-				stream << i;
-				wtext = win_mgr.getWindow(stream.str());
-				
-				stream.str("");
-				stream << "SpeakerTextPane";
-				stream << i;
-				
-				wimage->setVisible(false);
-				wname->setVisible(false);
-				wtext->setVisible(false);
-			}
-			skipButton->setVisible(false);
-		}
-	}
-
-	updateSpeechBubbles();
-}
-
-void DialogueWindow::updateTranslation()
-{
-	
-}
-
-void DialogueWindow::updateSpeechBubbles()
-{
-
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* game_screen =  win_mgr.getWindow("GameScreen");
-	
-	int picsize = 50;
-	
-	// Zaehler wie viele Labels existieren
-	static int lcount =0;
-	
-	// Zaehler, wie viele Antwortmoeglichkeiten existieren
-	static int acount =0;
-	
-	Player* player = m_document->getLocalPlayer();
-	Region* reg = player->getRegion();
-	
-	if (player ==0 || player->getRegion() ==0)
-		return;
-	
-	Dialogue* dia =  reg->getDialogue( player->getDialogueId() );
-	
-	CEGUI::Window* label;
-	CEGUI::Window* image;
-	CEGUI::FrameWindow* ques;
-	CEGUI::FrameWindow* speakframe;
-	
-	// Objekte im Umkreis von 20 Meter holen
-	std::list<WorldObject*> objs;
-	std::list<WorldObject*>::iterator it;
-	
-	float r = 20;
-	bool alldia;
-	alldia = (player->getRegion()->getCutsceneMode () == true) || (player->getDialogueId() != 0);
-	if (alldia)
-		r = 1000;
-	
-	Shape s;
-	s.m_center = player->getShape()->m_center;
-	s.m_type = Shape::RECT;
-	s.m_extent = Vector(r,r);
-	player->getRegion()->getObjectsInShape(&s,&objs,WorldObject::LAYER_ALL,WorldObject::CREATURE);
-	
-	std::pair<float,float> pos;
-	
-	Creature* cr;
-	
-	int nr =0;
-	std::string text;
-	
-	std::stringstream stream;
-	bool bar_vis = false;
-	if (alldia)
-	{
-		bar_vis = true;
-	}
-	
-	for (it = objs.begin(); it != objs.end(); ++it)
-	{
-		// nur Kreaturen behandeln
-		if (!(*it)->isCreature())
-			continue;
-		
-		cr = static_cast<Creature*>(*it);
-		pos = m_scene->getProjection(cr->getShape()->m_center,2.5f);
-		
-		
-		// nur Kreaturen behandeln, die wirklich zu sehen sind
-		if (!alldia && ( pos.first <0 || pos.first >1 || pos.second <0 || pos.second >1))
-			continue;
-				
-		text = cr->getSpeakText().m_text.getTranslation();
-		
-		if (text == "")
-			continue;
-
-		
-		// Wenn der Spieler sich in einem Gespraech befindet, die dazugehoerigen Texte darstellen nicht hier darstellen
-		// diese werden in den Balken dargestellt
-		if (cr->getDialogueId() !=0 && cr->getDialogueId() == player->getDialogueId() && cr->getSpeakText().m_in_dialogue)
-			continue;
-		
-		if (nr >= lcount)
-		{
-			lcount ++;
-			
-			stream.str("");
-			stream << "SpeechFrame";
-			stream << nr;
-			
-			
-			speakframe = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), stream.str());
-			speakframe->setProperty("FrameEnabled","false");
-			speakframe->setProperty("TitlebarEnabled","false");
-			speakframe->setProperty("CloseButtonEnabled","false");
-			game_screen->addChildWindow(speakframe);
-			speakframe->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
-			speakframe->setVisible(false);
-			speakframe->setSize(CEGUI::UVector2(CEGUI::UDim(0,200), CEGUI::UDim(0,picsize+10)));
-			
-			stream.str("");
-			stream << "SpeechLabel";
-			stream << nr;
-			
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-			speakframe->addChildWindow(label);
-			label->setProperty("FrameEnabled", "true");
-			label->setProperty("BackgroundEnabled", "true");
-			label->setSize(CEGUI::UVector2(CEGUI::UDim(0,80), CEGUI::UDim(0,picsize)));
-			label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,picsize+10), CEGUI::UDim(0,5)));
-			
-			label->setText("");
-			label->setAlpha(0.9);
-			
-			stream.str("");
-			stream << "SpeechIamge";
-			stream << nr;
-			
-			image = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-			speakframe->addChildWindow(image);
-			image->setProperty("BackgroundEnabled", "true");
-			image->setSize(CEGUI::UVector2(CEGUI::UDim(0,picsize), CEGUI::UDim(0,picsize)));
-			image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
-		}
-		else
-		{
-			stream.str("");
-			stream << "SpeechFrame";
-			stream << nr;
-			
-			speakframe = static_cast<CEGUI::FrameWindow*>( win_mgr.getWindow(stream.str()) );
-			
-			stream.str("");
-			stream << "SpeechLabel";
-			stream << nr;
-			label = win_mgr.getWindow(stream.str());
-			
-			stream.str("");
-			stream << "SpeechIamge";
-			stream << nr;
-			image = win_mgr.getWindow(stream.str());
-			
-		}
-		
-			
-			
-		if (label->getText() != (CEGUI::utf8*) text.c_str())
-		{
-
-			CEGUI::Font* font = label->getFont();
-
-			
-			
-			float width = font->getTextExtent((CEGUI::utf8*) text.c_str())+15;
-			float height = font->getFontHeight() +15;
-			CEGUI::Rect rect = game_screen->getInnerRectClipper();
-
-			float maxwidth = rect.getWidth()/4;
-                        //CEGUI::Rect maxWidthRect;
-                        //maxWidthRect.setWidth(maxwidth);
-			
-                        FormatedText txt = CEGUIUtility::fitTextToWindow((CEGUI::utf8*) text.c_str(), maxwidth, CEGUIUtility::WordWrapLeftAligned, font);
-			size_t lines = txt.lines;
-			label->setText((CEGUI::utf8*) txt.text.c_str());
-			
-			// Test to see whether the text can fit a single line
-			if (txt.lines <= 1)
-			{
-				// Single line
-				label->setSize(CEGUI::UVector2(CEGUI::UDim(0,width),  CEGUI::UDim(0,picsize)));
-				speakframe->setSize(CEGUI::UVector2(CEGUI::UDim(0,picsize+15+width), CEGUI::UDim(0,picsize+10)));
-				image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
-			}
-			else
-			{
-				// Multi-line
-				rect.setWidth(maxwidth-15);
-				
-				height = lines * font->getFontHeight() +15;
-				
-				if (height < picsize)
-				{
-					label->setSize(CEGUI::UVector2(CEGUI::UDim(0,maxwidth),  CEGUI::UDim(0,picsize)));
-					speakframe->setSize(CEGUI::UVector2(CEGUI::UDim(0,picsize+15+maxwidth), CEGUI::UDim(0,picsize+10)));
-					image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
-				}
-				else
-				{
-					label->setSize(CEGUI::UVector2(CEGUI::UDim(0,maxwidth),  CEGUI::UDim(0,height)));
-					speakframe->setSize(CEGUI::UVector2(CEGUI::UDim(0,picsize+15+maxwidth), CEGUI::UDim(0,height+10)));
-					image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,(height-picsize)/2 + 5)));
-				}
-			}
-		}
-		
-		float width = speakframe->getPixelSize().d_width;
-		float height = speakframe->getPixelSize().d_height;
-		speakframe->setPosition(CEGUI::UVector2(CEGUI::UDim(pos.first,-width/2), CEGUI::UDim(pos.second,-height)));
-		
-		speakframe->setVisible(true);
-		
-		// Emotionimage setzen
-		std::string imagestr = cr->getEmotionImage(cr->getSpeakText().m_emotion);
-		if (image->getProperty("Image") != imagestr)
-		{
-			image->setProperty("Image",imagestr);
-		}
-		
-		nr++;
-		
-	}
-
-	// restliche Label verstecken
-	for (; nr<lcount; nr++)
-	{
-		stream.str("");
-		stream << "SpeechFrame";
-		stream << nr;
-		speakframe = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow(stream.str()));
-			
-		speakframe->setVisible(false);
-	}
-	
-	// Fenster fuer eine Frage
-	Dialogue::Question* question = 0;
-	if (dia != 0)
-	{
-		question = dia->getQuestion();
-	}
-	if (question !=0 && question->m_active)
-	{
-		bool can_answer = dia->playerCanAnswer(player->getId());
-
-		int wflags = m_document->getGUIState()->m_shown_windows;
-		if (wflags != (Document::QUESTIONBOX | Document::CHAT ) || (wflags & Document::QUESTIONBOX) == 0)
-		{
-			m_document->getGUIState()->m_shown_windows |= Document::QUESTIONBOX;
-			m_document->getGUIState()->m_shown_windows &= (Document::QUESTIONBOX | Document::CHAT );
-			wflags = m_document->getGUIState()->m_shown_windows;
-			m_document->setModified(m_document->getModified() | Document::WINDOWS_MODIFIED);
-		}
-		
-		if (acount ==0)
-		{
-			ques = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "QuestionWindow");
-			ques->setProperty("FrameEnabled","false");
-			ques->setProperty("TitlebarEnabled","false");
-			ques->setProperty("CloseButtonEnabled","false");
-			game_screen->addChildWindow(ques);
-			ques->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
-			ques->setVisible(false);
-			
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "QuestionLabel");
-			ques->addChildWindow(label);
-			label->setProperty("FrameEnabled", "false");
-			label->setProperty("BackgroundEnabled", "false");
-		}
-		else
-		{
-			ques = (CEGUI::FrameWindow*)win_mgr.getWindow("QuestionWindow");
-			label = (CEGUI::Window*) win_mgr.getWindow("QuestionLabel");
-			label->setProperty("HorzFormatting", "WordWrapLeftAligned");
-		}
-		
-		nr =0;
-		
-		// Groesse des Fensters ermitteln
-		float height=5,width=0;
-		float elemheight, elemwidth;
-		int lines;
-		float horzoffset = 10;
-		
-		CEGUI::Rect rect = game_screen->getInnerRectClipper();
-		float maxwidth = rect.getWidth()/4;
-		rect.setWidth(maxwidth-15);
-		
-		CEGUI::Font* font = label->getFont();
-		float lineheight = font->getFontHeight();
-		
-		CEGUI::utf8* ctext;
-		ctext = (CEGUI::utf8*) question->m_text.getTranslation().c_str();
-		elemwidth =font->getTextExtent(ctext);
-		elemheight = lineheight;
-		
-		if (elemwidth > maxwidth)
-		{
-			elemwidth = maxwidth;
-						lines = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)ctext,rect.getWidth(), CEGUIUtility::WordWrapLeftAligned, font).lines;
-			elemheight = lines * lineheight;
-		}
-		width = MathHelper::Max(width,elemwidth);
-		
-		if (label->getText() != ctext)
-		{
-			label->setText((CEGUI::utf8*)ctext);
-		}
-		
-		label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,horzoffset), CEGUI::UDim(0,height)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(1.0f), CEGUI::UDim(0,elemheight)));
-		
-		height += elemheight + 20;
-		
-		// Antworten einfuegen
-		std::list < std::pair<TranslatableString, std::string> >::iterator it;
-		for (it = question->m_answers.begin(); it != question->m_answers.end(); ++it)
-		{
-			stream.str("");
-			stream << "AnswerLabel";
-			stream << nr;
-			
-			if (nr >= acount)
-			{
-				acount ++;
-				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-				ques->addChildWindow(label);
-				label->setProperty("FrameEnabled", "false");
-				label->setProperty("BackgroundEnabled", "false");
-				//label->setProperty("HorzFormatting", "WordWrapLeftAligned");
-				label->setID(nr);
-				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onAnswerClicked, this));
-			}
-			else
-			{
-				label = win_mgr.getWindow(stream.str());
-			}
-			
-			CEGUI::String cstring = (CEGUI::utf8*) it->first.getTranslation().c_str();
-			
-			// Anzahl Antworten bei Voting eintragen
-			if (question->m_weighted_answers.count(nr) > 0)
-			{
-				stream.str("");
-				stream << " (" << (int) question->m_weighted_answers[nr] <<")";
-				cstring += (CEGUI::utf8*) stream.str().c_str();
-			}
-			
-			elemwidth =font->getTextExtent(cstring);
-			elemheight = lineheight+5;
-
-			if (elemwidth > maxwidth)
-			{
-				elemwidth = maxwidth;
-				lines = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)cstring.c_str(),maxwidth, CEGUIUtility::WordWrapLeftAligned, font).lines;
-				elemheight = lines * lineheight;
-			}
-			width = MathHelper::Max(width,elemwidth);
-
-
-			if (label->getText() != cstring)
-			{
-				label->setText((CEGUI::utf8*)cstring.c_str());
-			}
-			
-			label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,horzoffset), CEGUI::UDim(0,height)));
-			label->setSize(CEGUI::UVector2(cegui_reldim(1.0f), CEGUI::UDim(0,elemheight)));
-
-			label->setVisible(true);
-
-			float alpha = 1.0;
-			if (!can_answer)
-			{
-				alpha = 0.5;
-			}
-			if (label->getAlpha() != alpha)
-			{
-				label->setAlpha(alpha);
-			}
-
-			height += elemheight + 5;
-			nr++;
-		}
-		
-		width += 2* horzoffset;
-		
-		ques->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f,-width/2), cegui_reldim(0.2)));
-		ques->setSize(CEGUI::UVector2(CEGUI::UDim(0,width), CEGUI::UDim(0,height)));
-		
-		ques->setVisible(true);
-
-		// restliche Antwortlabels ausblenden
-		for (; nr<acount; nr++)
-		{
-			stream.str("");
-			stream << "AnswerLabel";
-			stream << nr;
-			
-			label = win_mgr.getWindow(stream.str());
-			label->setVisible(false);
-		}
-	}
-	else if (acount !=0)
-	{
-		m_document->getGUIState()->m_shown_windows &= ~Document::QUESTIONBOX;
-		ques = (CEGUI::FrameWindow*) win_mgr.getWindow("QuestionWindow");
-		ques->setVisible(false);
-		
-	}
-}
-
-bool DialogueWindow::onAnswerClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	m_document->onAnswerClick(id);
-	return true;
-}
-
-
-bool DialogueWindow::onTextClicked(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	CEGUI::Window* btn = win_mgr.getWindow("DialogueSkipAllButton");
-	bool skipAll = false;
-	if (we.window == btn)
-	{
-		skipAll = true;
-	}
-	
-	m_document->onSkipDialogueTextClicked(skipAll);
-	return true;
-}
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "dialoguewindow.h"
+#include "ceguiutility.h"
+#include "debug.h"
+
+DialogueWindow::DialogueWindow(Document* doc, Scene* scene, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	m_scene = scene;
+	CEGUI::Window* label;
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	// The CharInfo window and holder
+	CEGUI::FrameWindow* dialog_wnd = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::loadLayoutFromFile ("dialogwindow.layout"));
+	if (!dialog_wnd)
+	{
+		SW_DEBUG ("WARNING: Failed to load [%s]", "dialogwindow.layout");
+	}
+
+	CEGUI::Window* dialog_wnd_holder = CEGUIUtility::loadLayoutFromFile ("dialogwindow_holder.layout");
+	if (!dialog_wnd_holder)
+	{
+		SW_DEBUG ("WARNING: Failed to load [%s]", "dialogwindow_holder.layout");
+	}
+	
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (dialog_wnd_holder, "DialogWindow_Holder");
+	CEGUI::Window* wndDialogWindow = CEGUIUtility::getWindowForLoadedLayoutEx (dialog_wnd, "DialogWindow");
+	if (wndHolder && wndDialogWindow)
+	{
+		CEGUIUtility::addChildWidget (wndHolder, wndDialogWindow);
+	}
+	else
+	{
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for dialog screen.");
+		if (!wndDialogWindow) SW_DEBUG ("ERROR: Unable to get the window for dialog screen.");
+	}
+
+	m_window = dialog_wnd_holder;
+
+	CEGUI::FrameWindow* frame_widget = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar"));
+	frame_widget->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	frame_widget = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueUpperBar"));
+	frame_widget->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	CEGUI::ScrollablePane* pane;
+	pane = static_cast<CEGUI::ScrollablePane*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/SpeakerTextPane0"));
+	pane->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	pane = static_cast<CEGUI::ScrollablePane*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/SpeakerTextPane1"));
+	pane->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/SpeakerTextPane0/SpeakerTextLabel0");
+	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/SpeakerTextPane1/SpeakerTextLabel1");
+	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onTextClicked, this));
+
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/DialogueSkipAllButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&DialogueWindow ::onTextClicked, this));
+}
+
+void DialogueWindow::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	Player* player = m_document->getLocalPlayer();
+	Region* reg = player->getRegion();
+	Dialogue* dia =  reg->getDialogue( player->getDialogueId() );
+	
+	bool bar_vis = false;
+	if (reg->getCutsceneMode () == true || player->getDialogueId() != 0)
+	{
+		bar_vis = true;
+	}
+	
+	if (m_document->getGUIState()->m_shown_windows & Document::TRADE)
+	{
+		bar_vis = false;
+	}
+	
+	CEGUI::FrameWindow* upper_bar = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueUpperBar"));
+	CEGUI::FrameWindow* lower_bar = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar"));
+	if (upper_bar->isVisible() != bar_vis)
+	{
+		upper_bar->setVisible(bar_vis);
+		lower_bar->setVisible(bar_vis);
+		m_window->setVisible (bar_vis);
+		SW_DEBUG ("Set both lower and upper bar visibility to %d", bar_vis);
+		
+		// note: remove this (only debug)
+		if (bar_vis)
+		{
+			SW_DEBUG ("object visibility set to true: %s", upper_bar->getNamePath ().c_str ());
+			CEGUI::Window *tmp;
+			tmp = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow");
+			SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ());
+			tmp = CEGUIUtility::getWindow ("GameScreen/DialogWindow_Holder");
+			SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ());
+			if (! tmp->isVisible ())
+			{
+				tmp->setVisible (true);
+			}
+			tmp = CEGUIUtility::getWindow ("GameScreen");
+			SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ());
+		}
+	}
+	
+	if (bar_vis)
+	{
+		CEGUI::Window* skipButton = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/DialogueSkipAllButton");
+		
+		CEGUI::Window* wimage;
+		CEGUI::Window* wname;
+		CEGUI::Window* wtext;
+		CEGUI::ScrollablePane* wpane;
+		
+		if (dia != 0)
+		{
+			skipButton->setVisible(true);
+			// Schleife fuer die moeglichen Sprecher eines Dialogs
+			std::string image, name, text;
+			
+			WorldObject* wo;
+			Creature* cr;
+			
+			std::stringstream stream;
+			
+			Dialogue::SpeakerState* spstate;
+			for (int i=0; i<Dialogue::NR_POSITIONS; i++)
+			{
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerEmotionImage" << i;
+				wimage = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+						
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerNameLabel" << i;
+				wname = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+				
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerTextPane" << i << "/SpeakerTextLabel" << i;
+				wtext = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+				
+				
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerTextPane";
+				stream << i;
+				wpane = static_cast<CEGUI::ScrollablePane*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str()));
+				
+				
+				spstate = dia->getSpeakerState((Dialogue::Position) i);
+				if (spstate != 0)
+				{
+					// Sprecher ist aktiv
+					wo = reg->getObject(spstate->m_id);
+					cr = dynamic_cast<Creature*>(wo);
+					if (cr == 0)
+						continue;
+					
+					
+					name = cr->getName().getTranslation().c_str();
+					
+					
+					if (wname->getText() != (CEGUI::utf8*) name.c_str())
+					{
+						wname->setText((CEGUI::utf8*) name.c_str());
+						SW_DEBUG ("Set text of widget (a) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ());
+					}
+					
+					if (!wname->isVisible())
+					{
+						wname->setVisible(true);
+					}
+					
+					text = cr->getSpeakText().m_text.getTranslation();
+					
+					if (text == "" || cr->getSpeakText().m_in_dialogue == false)
+					{
+						wtext->setVisible(false);
+					}
+					else
+					{
+						// remove everything after ##
+						size_t pos = text.find("##");
+						if (pos != std::string::npos)
+						{
+							text.erase(pos);
+						}
+						const CEGUI::Font* fnt = wtext->getFont();
+						
+						if (wtext->getText() != (CEGUI::utf8*) text.c_str())
+						{
+							// TODO: investigate need to adjust size
+#if 0
+							CEGUI::UVector2 size = CEGUIUtility::getWidgetSize (wtext);
+							
+							CEGUIUtility::Rectf isize = wtext->getUnclippedInnerRect ();
+							FormatedText txt = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)text.c_str(), isize.getWidth(), CEGUIUtility::WordWrapCentred, fnt);
+							float height = PixelAligned(txt.lines * fnt->getLineSpacing());
+							size.d_y = CEGUI::UDim(0.0, height);
+							CEGUIUtility::setWidgetSize (wtext, size);
+							wtext->setText((CEGUI::utf8*)txt.text.c_str());
+#else
+							wtext->setText((CEGUI::utf8*)text.c_str());
+							SW_DEBUG ("Set text of widget (b) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ());
+#endif
+						}
+						wtext->setVisible(true);
+						
+						// Scrolling des Texts
+						float height = CEGUIUtility::getWidgetSize (wtext).d_y.d_offset;
+						if (height > 4*fnt->getLineSpacing())
+						{
+							int initiallines = 2;
+							int lines = (int) (height / fnt->getLineSpacing() + 0.5);
+							float timesplit = initiallines+lines;
+							float frac = cr->getSpeakText().m_displayed_time / cr->getSpeakText().m_time;
+							
+							float scrollpos = 0.0;
+							if (frac > (timesplit - initiallines)/timesplit)
+							{
+								scrollpos = 1.0;
+							}
+							else if (frac > initiallines/timesplit)
+							{
+								scrollpos =(frac * timesplit - initiallines) / (timesplit - initiallines*2);
+							}
+							
+							if (wpane->getVerticalScrollPosition() != scrollpos)
+							{
+								wpane->setVerticalScrollPosition(scrollpos);
+							}
+							
+						}
+					}
+					
+					std::string image = cr->getEmotionImage(cr->getSpeakText().m_emotion);
+					if (wimage->getProperty("Image") != image)
+					{
+						wimage->setProperty("Image",image);
+					}
+					if (!wimage->isVisible())
+					{
+						wimage->setVisible(true);
+					}
+					
+				}
+				else
+				{
+					wimage->setVisible(false);
+					wname->setVisible(false);
+					wtext->setVisible(false);
+				}
+			}
+		}
+		else
+		{
+			for (int i=0; i<Dialogue::NR_POSITIONS; i++)
+			{
+				std::stringstream stream;
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerEmotionImage" << i;
+				wimage = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+						
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerNameLabel" << i;
+				wname = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+				
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerTextPane" << i << "/SpeakerTextLabel" << i;
+				wtext = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+				
+				stream.str("");
+				stream << "DialogWindow/DialogueLowerBar/SpeakerTextPane" << i;
+				
+				wimage->setVisible(false);
+				wname->setVisible(false);
+				wtext->setVisible(false);
+			}
+			skipButton->setVisible(false);
+		}
+	}
+
+	updateSpeechBubbles();
+}
+
+void DialogueWindow::updateTranslation()
+{
+	
+}
+
+void DialogueWindow::updateSpeechBubbles()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* game_screen =  CEGUIUtility::getWindow ("GameScreen");
+	
+	int picsize = 50;
+	
+	// Zaehler wie viele Labels existieren
+	static int lcount =0;
+	
+	// Zaehler, wie viele Antwortmoeglichkeiten existieren
+	static int acount =0;
+	
+	Player* player = m_document->getLocalPlayer();
+	Region* reg = player->getRegion();
+	
+	if (player ==0 || player->getRegion() ==0)
+		return;
+	
+	Dialogue* dia =  reg->getDialogue( player->getDialogueId() );
+	
+	CEGUI::Window* label;
+	CEGUI::Window* image;
+	CEGUI::FrameWindow* ques;
+	CEGUI::FrameWindow* speakframe;
+	
+	// Objekte im Umkreis von 20 Meter holen
+	std::list<WorldObject*> objs;
+	std::list<WorldObject*>::iterator it;
+	
+	float r = 20;
+	bool alldia;
+	alldia = (player->getRegion()->getCutsceneMode () == true) || (player->getDialogueId() != 0);
+	if (alldia)
+		r = 1000;
+	
+	Shape s;
+	s.m_center = player->getShape()->m_center;
+	s.m_type = Shape::RECT;
+	s.m_extent = Vector(r,r);
+	player->getRegion()->getObjectsInShape(&s,&objs,WorldObject::LAYER_ALL,WorldObject::CREATURE);
+	
+	std::pair<float,float> pos;
+	
+	Creature* cr;
+	
+	int nr =0;
+	std::string text;
+	
+	std::stringstream stream;
+	bool bar_vis = false;
+	if (alldia)
+	{
+		bar_vis = true;
+	}
+	
+	for (it = objs.begin(); it != objs.end(); ++it)
+	{
+		// nur Kreaturen behandeln
+		if (!(*it)->isCreature())
+			continue;
+		
+		cr = static_cast<Creature*>(*it);
+		pos = m_scene->getProjection(cr->getShape()->m_center,2.5f);
+		
+		
+		// nur Kreaturen behandeln, die wirklich zu sehen sind
+		if (!alldia && ( pos.first <0 || pos.first >1 || pos.second <0 || pos.second >1))
+			continue;
+				
+		text = cr->getSpeakText().m_text.getTranslation();
+		
+		if (text == "")
+			continue;
+
+		
+		// Wenn der Spieler sich in einem Gespraech befindet, die dazugehoerigen Texte darstellen nicht hier darstellen
+		// diese werden in den Balken dargestellt
+		if (cr->getDialogueId() !=0 && cr->getDialogueId() == player->getDialogueId() && cr->getSpeakText().m_in_dialogue)
+			continue;
+		
+		if (nr >= lcount)
+		{
+			lcount ++;
+			
+			stream.str("");
+			stream << "SpeechFrame" << nr;
+			
+			
+			speakframe = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), stream.str());
+			speakframe->setProperty("FrameEnabled","false");
+			speakframe->setProperty("TitlebarEnabled","false");
+			speakframe->setProperty("CloseButtonEnabled","false");
+			CEGUIUtility::addChildWidget (game_screen, speakframe);
+			speakframe->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
+			speakframe->setVisible(false);
+			CEGUIUtility::setWidgetSize (speakframe, CEGUI::UVector2(CEGUI::UDim(0,200), CEGUI::UDim(0,picsize+10)));
+			
+			stream.str("");
+			stream << "SpeechLabel" << nr;
+			
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+			CEGUIUtility::addChildWidget (speakframe, label);
+			label->setProperty("FrameEnabled", "true");
+			label->setProperty("BackgroundEnabled", "true");
+			CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(CEGUI::UDim(0,80), CEGUI::UDim(0,picsize)));
+			label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,picsize+10), CEGUI::UDim(0,5)));
+			
+			label->setText("");
+			SW_DEBUG ("Set text of widget (c) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ());
+			label->setAlpha(0.9);
+			
+			stream.str("");
+			stream << "SpeechIamge" << nr;
+			
+			image = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+			CEGUIUtility::addChildWidget (speakframe, image);
+			image->setProperty("BackgroundEnabled", "true");
+			CEGUIUtility::setWidgetSize (image, CEGUI::UVector2(CEGUI::UDim(0,picsize), CEGUI::UDim(0,picsize)));
+			image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
+		}
+		else
+		{
+			stream.str("");
+			stream << "GameScreen/SpeechFrame" << nr;
+			
+			speakframe = static_cast<CEGUI::FrameWindow*>( CEGUIUtility::getWindow (stream.str()) );
+			
+			stream.str("");
+			stream << "GameScreen/SpeechFrame" << nr << "/SpeechLabel" << nr;
+			label = CEGUIUtility::getWindow (stream.str());
+			
+			stream.str("");
+			stream << "GameScreen/SpeechFrame" << nr << "/SpeechIamge" << nr;
+			image = CEGUIUtility::getWindow (stream.str());
+			
+		}
+		
+			
+			
+		if (label->getText() != (CEGUI::utf8*) text.c_str())
+		{
+			SW_DEBUG ("diff label [%s], [%s]", label->getText ().c_str (), text.c_str ());
+
+			const CEGUI::Font* font = label->getFont();
+			
+			float width = font->getTextExtent((CEGUI::utf8*) text.c_str())+15;
+			float height = font->getFontHeight() +15;
+			CEGUIUtility::Rectf rect = game_screen->getInnerRectClipper();
+
+			float maxwidth = rect.getWidth()/4;
+			FormatedText txt = CEGUIUtility::fitTextToWindow((CEGUI::utf8*) text.c_str(), maxwidth, CEGUIUtility::WordWrapLeftAligned, font);
+			size_t lines = txt.lines;
+			label->setText((CEGUI::utf8*) txt.text.c_str());
+			SW_DEBUG ("Set text of widget (d) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ());
+
+			// Test to see whether the text can fit a single line
+			if (txt.lines <= 1)
+			{
+				// Single line
+				CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(CEGUI::UDim(0,width),  CEGUI::UDim(0,picsize)));
+				CEGUIUtility::setWidgetSize (speakframe, CEGUI::UVector2(CEGUI::UDim(0,picsize+15+width), CEGUI::UDim(0,picsize+10)));
+				image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
+			}
+			else
+			{
+				// Multi-line
+				rect.setWidth(maxwidth-15);
+				
+				height = lines * font->getFontHeight() +15;
+				
+				if (height < picsize)
+				{
+					CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(CEGUI::UDim(0,maxwidth),  CEGUI::UDim(0,picsize)));
+					CEGUIUtility::setWidgetSize (speakframe, CEGUI::UVector2(CEGUI::UDim(0,picsize+15+maxwidth), CEGUI::UDim(0,picsize+10)));
+					image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,5)));
+				}
+				else
+				{
+					CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(CEGUI::UDim(0,maxwidth),  CEGUI::UDim(0,height)));
+					CEGUIUtility::setWidgetSize (speakframe, CEGUI::UVector2(CEGUI::UDim(0,picsize+15+maxwidth), CEGUI::UDim(0,height+10)));
+					image->setPosition(CEGUI::UVector2(CEGUI::UDim(0,5), CEGUI::UDim(0,(height-picsize)/2 + 5)));
+				}
+			}
+		}
+		
+		float width = speakframe->getPixelSize().d_width;
+		float height = speakframe->getPixelSize().d_height;
+		speakframe->setPosition(CEGUI::UVector2(CEGUI::UDim(pos.first,-width/2), CEGUI::UDim(pos.second,-height)));
+		
+		speakframe->setVisible(true);
+		
+		// Emotionimage setzen
+		std::string imagestr = cr->getEmotionImage(cr->getSpeakText().m_emotion);
+		if (image->getProperty("Image") != imagestr)
+		{
+			image->setProperty("Image",imagestr);
+		}
+		
+		nr++;
+		
+	}
+
+	// restliche Label verstecken
+	for (; nr<lcount; nr++)
+	{
+		stream.str("");
+		stream << "GameScreen/SpeechFrame" << nr;
+		speakframe = static_cast<CEGUI::FrameWindow*>(CEGUIUtility::getWindow (stream.str()));
+			
+		speakframe->setVisible(false);
+	}
+	
+	// Fenster fuer eine Frage
+	Dialogue::Question* question = 0;
+	if (dia != 0)
+	{
+		question = dia->getQuestion();
+	}
+	if (question !=0 && question->m_active)
+	{
+		bool can_answer = dia->playerCanAnswer(player->getId());
+
+		int wflags = m_document->getGUIState()->m_shown_windows;
+		if (wflags != (Document::QUESTIONBOX | Document::CHAT ) || (wflags & Document::QUESTIONBOX) == 0)
+		{
+			m_document->getGUIState()->m_shown_windows |= Document::QUESTIONBOX;
+			m_document->getGUIState()->m_shown_windows &= (Document::QUESTIONBOX | Document::CHAT );
+			wflags = m_document->getGUIState()->m_shown_windows;
+			m_document->setModified(m_document->getModified() | Document::WINDOWS_MODIFIED);
+		}
+		
+		if (acount ==0)
+		{
+			ques = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "QuestionWindow");
+			ques->setProperty("FrameEnabled","false");
+			ques->setProperty("TitlebarEnabled","false");
+			ques->setProperty("CloseButtonEnabled","false");
+			CEGUIUtility::addChildWidget (game_screen, ques);
+			ques->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
+			ques->setVisible(false);
+			
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "QuestionLabel");
+			CEGUIUtility::addChildWidget (ques, label);
+			label->setProperty("FrameEnabled", "false");
+			label->setProperty("BackgroundEnabled", "false");
+		}
+		else
+		{
+			ques = (CEGUI::FrameWindow*)CEGUIUtility::getWindow ("GameScreen/QuestionWindow");
+			label = (CEGUI::Window*) CEGUIUtility::getWindow ("GameScreen/QuestionWindow/QuestionLabel");
+			label->setProperty("HorzFormatting", "WordWrapLeftAligned");
+		}
+		
+		nr =0;
+		
+		// Groesse des Fensters ermitteln
+		float height=5,width=0;
+		float elemheight, elemwidth;
+		int lines;
+		float horzoffset = 10;
+		
+		CEGUIUtility::Rectf rect = game_screen->getInnerRectClipper();
+		float maxwidth = rect.getWidth()/4;
+		rect.setWidth(maxwidth-15);
+		
+		const CEGUI::Font* font = label->getFont();
+		float lineheight = font->getFontHeight();
+		
+		CEGUI::utf8* ctext;
+		ctext = (CEGUI::utf8*) question->m_text.getTranslation().c_str();
+		elemwidth =font->getTextExtent(ctext);
+		elemheight = lineheight;
+		
+		if (elemwidth > maxwidth)
+		{
+			elemwidth = maxwidth;
+						lines = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)ctext,rect.getWidth(), CEGUIUtility::WordWrapLeftAligned, font).lines;
+			elemheight = lines * lineheight;
+		}
+		width = MathHelper::Max(width,elemwidth);
+		
+		if (label->getText() != ctext)
+		{
+			label->setText((CEGUI::utf8*)ctext);
+			SW_DEBUG ("Set text of widget (e) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ());
+		}
+		
+		label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,horzoffset), CEGUI::UDim(0,height)));
+		CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(cegui_reldim(1.0f), CEGUI::UDim(0,elemheight)));
+		height += elemheight + 20;
+		
+		// Insert answers
+		std::list < std::pair<TranslatableString, std::string> >::iterator it;
+		for (it = question->m_answers.begin(); it != question->m_answers.end(); ++it)
+		{
+			stream.str("");
+			stream << "AnswerLabel" << nr;
+			
+			if (nr >= acount)
+			{
+				acount ++;
+				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+				CEGUIUtility::addChildWidget (ques, label);
+				label->setProperty("FrameEnabled", "false");
+				label->setProperty("BackgroundEnabled", "false");
+				label->setMousePassThroughEnabled (false);
+				label->setID(nr);
+//				label->setAlwaysOnTop (true);
+				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&DialogueWindow::onAnswerClicked, this));
+				label->subscribeEvent(CEGUI::Window::EventMouseEntersArea, CEGUI::Event::Subscriber(&DialogueWindow::onAnswerEnterArea, this));
+				label->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, CEGUI::Event::Subscriber(&DialogueWindow::onAnswerLeaveArea, this));
+			}
+			else
+			{
+				stream.str ("");
+				stream << "GameScreen/QuestionWindow/AnswerLabel" << nr;
+				//DEBUG ("Inserting (existing) answer label [%s]", stream.str ().c_str ());
+				label = CEGUIUtility::getWindow (stream.str());
+				// Augustin Preda, 2014.01.19: for some reason, there are several always on top windows, and not all can be at the front.
+				// These options however must be :-)
+
+				label->moveToFront ();
+			}
+			
+			CEGUI::String cstring = (CEGUI::utf8*) it->first.getTranslation().c_str();
+			
+			// Anzahl Antworten bei Voting eintragen
+			if (question->m_weighted_answers.count(nr) > 0)
+			{
+				stream.str("");
+				stream << " (" << (int) question->m_weighted_answers[nr] <<")";
+				cstring += (CEGUI::utf8*) stream.str().c_str();
+			}
+			
+			elemwidth =font->getTextExtent(cstring);
+			elemheight = lineheight+5;
+
+			if (elemwidth > maxwidth)
+			{
+				elemwidth = maxwidth;
+				lines = CEGUIUtility::fitTextToWindow((CEGUI::utf8*)cstring.c_str(),maxwidth, CEGUIUtility::WordWrapLeftAligned, font).lines;
+				elemheight = lines * lineheight;
+			}
+			width = MathHelper::Max(width,elemwidth);
+
+			CEGUI::String selectionColour ("");
+			if (label->isUserStringDefined ("selcol"))
+			{
+				selectionColour = label->getUserString ("selcol");
+			}
+			CEGUI::String expectedString;
+			expectedString.append (selectionColour);
+			expectedString.append (cstring);
+
+			if (label->getText() != expectedString)
+			{
+				SW_DEBUG ("Updating text of widget (f) [%s] to [%s] (prev [%s])", label->getNamePath ().c_str (), expectedString.c_str (), label->getText ().c_str ());
+				label->setText((CEGUI::utf8*)expectedString.c_str());
+			}
+			
+			label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,horzoffset), CEGUI::UDim(0,height)));
+			CEGUIUtility::setWidgetSize (label, CEGUI::UVector2(cegui_reldim(1.0f), CEGUI::UDim(0,elemheight)));
+
+			label->setVisible(true);
+
+			float alpha = 1.0;
+			if (!can_answer)
+			{
+				alpha = 0.5;
+			}
+			if (label->getAlpha() != alpha)
+			{
+				label->setAlpha(alpha);
+			}
+
+			height += elemheight + 5;
+			nr++;
+		}
+		
+		width += 2* horzoffset;
+		
+		//DEBUG ("Setting position of question window: (%.2f, %.2f), %.2f", 0.5f, -width/2, 0.2);
+		ques->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f,-width/2), cegui_reldim(0.2)));
+		//DEBUG ("Setting size of question window: (%.2f, %.2f)", width, height);
+		CEGUIUtility::setWidgetSizeAbs (ques, width, height);
+		
+		ques->setVisible(true);
+
+		// restliche Antwortlabels ausblenden
+		for (; nr<acount; nr++)
+		{
+			stream.str("");
+			stream << "GameScreen/QuestionWindow/AnswerLabel" << nr;
+			
+			label = CEGUIUtility::getWindow (stream.str());
+			label->setVisible(false);
+		}
+	}
+	else if (acount !=0)
+	{
+		m_document->getGUIState()->m_shown_windows &= ~Document::QUESTIONBOX;
+		ques = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/QuestionWindow");
+		ques->setVisible(false);
+		
+	}
+}
+
+bool DialogueWindow::onAnswerClicked(const CEGUI::EventArgs& evt)
+{
+	SW_DEBUG ("DialogueWindow::onAnswerClicked");
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	m_document->onAnswerClick(id);
+	return true;
+}
+
+bool DialogueWindow::onAnswerEnterArea(const CEGUI::EventArgs& evt)
+{
+	//DEBUG ("DialogueWindow::onAnswerEnterArea");
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	CEGUI::String lineText = "[colour='FFFFDD66']";
+	SW_DEBUG ("Entered area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ());
+//	we.window->setTextParsingEnabled (true);
+	we.window->setText ("-");
+	we.window->invalidate (true);
+	we.window->setUserString ("selcol", lineText);
+	
+	//CEGUI::System::getSingletonPtr ()->getDefaultGUIContext ().markAsDirty ();
+	//DEBUG ("Entered area for: %s", we.window->getTextVisual ().c_str ());
+	//XXX, TODO
+	return true;
+}
+
+bool DialogueWindow::onAnswerLeaveArea(const CEGUI::EventArgs& evt)
+{
+	//DEBUG ("DialogueWindow::onAnswerLeaveArea");
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	//DEBUG ("Left area for: %s", we.window->getText ().c_str ());
+	SW_DEBUG ("Left area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ());
+	CEGUI::String lineText = "[colour='FFFFFFFF']";
+	we.window->setText ("-");
+	we.window->invalidate (true);
+	we.window->setUserString ("selcol", lineText);
+	return true;
+}
+
+bool DialogueWindow::onTextClicked(const CEGUI::EventArgs& evt)
+{
+	SW_DEBUG ("DialogueWindow::onTextClicked");
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	CEGUI::Window* btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow/DialogueLowerBar/DialogueSkipAllButton");
+	bool skipAll = false;
+	if (we.window == btn)
+	{
+		skipAll = true;
+	}
+	
+	m_document->onSkipDialogueTextClicked(skipAll);
+	return true;
+}
+
--- a/src/gui/dialoguewindow.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/dialoguewindow.h	Thu Mar 20 19:04:28 2014 +0100
@@ -64,12 +64,26 @@
 		
 		/**
 		 * \fn bool onAnswerClicked(const CEGUI::EventArgs& evt);
-		 * \brief Behandelt das Klick auf eine Antwort in einem Gespraech
+		 * \brief Handles the click on one of the answers in a Dialogue
 		 * \param evt CEGUI Event Parameter
 		 */
 		bool onAnswerClicked(const CEGUI::EventArgs& evt);
 		
 		/**
+		 * \fn bool onAnswerEnterArea(const CEGUI::EventArgs& evt);
+		 * \brief Handles the hovering with the mouse on one of the answers in a Dialogue
+		 * \param evt CEGUI Event Parameter
+		 */
+		bool onAnswerEnterArea(const CEGUI::EventArgs& evt);
+		
+		/**
+		 * \fn bool onAnswerLeaveArea(const CEGUI::EventArgs& evt);
+		 * \brief Handles the stopping of hovering with the mouse on one of the answers in a Dialogue
+		 * \param evt CEGUI Event Parameter
+		 */
+		bool onAnswerLeaveArea(const CEGUI::EventArgs& evt);
+		
+		/**
 		 * \fn bool bool onTextClicked(const CEGUI::EventArgs& evt)
 		 * \brief regiert auf einen Click auf einen Dialogtext
 		 */
--- a/src/gui/graphicmanager.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/graphicmanager.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -39,14 +39,24 @@
 		rendersys->clearFrameBuffer(Ogre::FBT_STENCIL); 
 		rendersys->setStencilCheckEnabled(true); 
 
-#if (OGRE_VERSION < ((1 << 16) | (9 << 8) | 0))
-        rendersys->setStencilBufferParams(Ogre::CMPF_NOT_EQUAL,
-                                          STENCIL_VALUE_FOR_OUTLINE_GLOW, STENCIL_FULL_MASK,
-            Ogre::SOP_KEEP,Ogre::SOP_KEEP,Ogre::SOP_REPLACE,false);
+//Assume we're on major version 1.
+#if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR > 8
+		rendersys->setStencilBufferParams(Ogre::CMPF_NOT_EQUAL,				// stencil compare function.
+										  STENCIL_VALUE_FOR_OUTLINE_GLOW,	// reference value used in comparison
+										  STENCIL_FULL_MASK,				// The bitmask applied to both the stencil value and the reference value 
+										  STENCIL_FULL_MASK,				// !Ogre1.9! Write mark : The bitmask the controls which bits from refValue will be written to stencil buffer
+										  Ogre::SOP_KEEP,					// The action to perform when the stencil check fails
+										  Ogre::SOP_KEEP,					// The action to perform when the stencil check passes, but the depth buffer check still fail
+										  Ogre::SOP_REPLACE,				// The action to take when both the stencil and depth check pas
+										  false);							// If set to true, then if you render both back and front faces
 #else
-        rendersys->setStencilBufferParams(Ogre::CMPF_NOT_EQUAL,
-                                          STENCIL_VALUE_FOR_OUTLINE_GLOW, STENCIL_FULL_MASK, STENCIL_FULL_MASK,
-            Ogre::SOP_KEEP,Ogre::SOP_KEEP,Ogre::SOP_REPLACE,false);
+		rendersys->setStencilBufferParams(Ogre::CMPF_NOT_EQUAL,				// stencil compare function.
+										  STENCIL_VALUE_FOR_OUTLINE_GLOW,	// reference value used in comparison
+										  STENCIL_FULL_MASK,				// The bitmask applied to both the stencil value and the reference value 
+										  Ogre::SOP_KEEP,					// The action to perform when the stencil check fails
+										  Ogre::SOP_KEEP,					// The action to perform when the stencil check passes, but the depth buffer check still fail
+										  Ogre::SOP_REPLACE,				// The action to take when both the stencil and depth check pas
+										  false);							// If set to true, then if you render both back and front faces
 #endif
 	} 
 			/*
@@ -153,7 +163,7 @@
 
 void GraphicManager::clearRenderInfos()
 {
-	DEBUG("clearing all renderinfos");
+	SW_DEBUG("clearing all renderinfos");
 	// delete the renderinfo Data
 	std::map<std::string, GraphicRenderInfo*>::iterator it;
 	for (it = m_render_infos.begin(); it != m_render_infos.end(); ++it)
@@ -451,7 +461,7 @@
 		catch (Ogre::Exception& e)
 		{
 			WARNING("can't create mesh %s", info.m_source.c_str());
-			DEBUG ("(Caught exception: %s)", e.what ());
+			SW_DEBUG ("(Caught exception: %s)", e.what ());
 			obj_ent = m_scene_manager->createEntity(name, "dummy_r.mesh");
 		}
 		obj= static_cast<Ogre::MovableObject*>(obj_ent);
@@ -466,7 +476,7 @@
 		catch (Ogre::Exception& e)
 		{	
 			WARNING("can't create particle system %s", info.m_source.c_str());
-			DEBUG ("(Caught exception: %s)", e.what ());
+			SW_DEBUG ("(Caught exception: %s)", e.what ());
 		}
 		obj= static_cast<Ogre::MovableObject*>(part);
 	}
@@ -491,7 +501,7 @@
 	}
 }
 
-SoundName GraphicManager::getDropSound(std::string objecttype)
+std::string GraphicManager::getDropSound(std::string objecttype)
 {
 	 // Get the renderinfo
 	 GraphicObject::Type gtype = getGraphicType(objecttype);
--- a/src/gui/graphicmanager.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/graphicmanager.h	Thu Mar 20 19:04:28 2014 +0100
@@ -190,7 +190,7 @@
 		 * \brief specialized functions for determining the dropsound of an item
 		 * \param objecttype Ingame object type, must be an item type
 		 */
-		static SoundName getDropSound(std::string objecttype);
+		static std::string getDropSound(std::string objecttype);
 		
 		/**
 		 * \brief clears the internal particle pool
--- a/src/gui/graphicobject.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/graphicobject.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -314,16 +314,23 @@
 		std::string name = sname.str();
 		counter++;
 		
+		std::map <std::string, SoundObject>::iterator it = m_soundobjects.find (object.m_objectname.c_str ());
+		if (it != m_soundobjects.end ())
+		{
+			SW_DEBUG ("WARNING:  %s: subobject %s already exists", m_name.c_str(), object.m_objectname.c_str());
+		}
 		if (m_soundobjects.count(object.m_objectname) >0)
 		{
 			WARNING("soundobject %s: subobject %s already exists",m_name.c_str(), object.m_objectname.c_str());
 			return;
 		}
 		
-		SoundObject* obj = SoundSystem::createSoundObject(name);
-		
-		m_soundobjects[object.m_objectname] = obj;
-		DEBUGX("adding soundobject with name %s (%s)",object.m_objectname.c_str(),name.c_str());
+		//SoundObject* obj = SoundSystem::createSoundObject(name);
+		//m_soundobjects[object.m_objectname] = obj;
+
+		m_soundobjects[object.m_objectname] = SoundObject (name);
+		//m_soundobjects[object.m_objectname] = name;
+		SW_DEBUG ("setting soundobject with name [%s] to: (%s)", object.m_objectname.c_str (), name.c_str ());
 	}
 	else 
 	{
@@ -499,7 +506,8 @@
 	}
 	else if (m_soundobjects.find(name) != m_soundobjects.end())
 	{
-		SoundSystem::deleteSoundObject(m_soundobjects[name]);
+		//SoundSystem::deleteSoundObject(m_soundobjects[name]);
+		// should be deleted automatically by the sound manager
 		m_soundobjects.erase(name);
 		DEBUGX("removing Soundobject %s",name.c_str());
 	}
@@ -920,12 +928,23 @@
 	// update Soundobjects
 	Ogre::Vector3 opos = getTopNode()->_getDerivedPosition();
 	Vector pos(opos.x/GraphicManager::g_global_scale, opos.z / GraphicManager::g_global_scale);
-	std::map<std::string, SoundObject* >::iterator st;
-	for (st = m_soundobjects.begin(); st != m_soundobjects.end(); ++st)
+
+	//std::map<std::string, SoundObject* >::iterator st;
+	for (std::map<std::string, SoundObject>::iterator st = m_soundobjects.begin(); st != m_soundobjects.end(); ++st)
+	//for (std::map<std::string, std::string>::iterator st = m_soundobjects.begin(); st != m_soundobjects.end(); ++st)
 	{
-		st->second->setPosition(pos);
-		st->second->update();
-		DEBUGX("setting sound %s position to %f %f",st->first.c_str(),pos.m_x, pos.m_y);
+		// Note: sounds should be updated automatically by the sound manager.
+		// But they need to be configured correctly as relative or absolute play in order to allow correct updating
+		// when the listener (player) moves and sounds are supposed to move with various actors.
+
+		// TODO: XXX: this is a location where it would make sense to update the position of a 3d sound.
+		// requires to connect a sound adapter instead of a sound name.
+
+		st->second.setPosition (pos);
+		//st->second->setPosition(pos);
+		//st->second->update();
+
+		DEBUGX ("setting sound [%s] position to: %f, %f", st->first.c_str (), pos.m_x, pos.m_y);
 	}
 }
 
@@ -973,12 +992,20 @@
 	}
 	else if (part->m_type == ActionRenderpart::SOUND)
 	{
-		std::map<std::string, SoundObject* >::iterator it;
+		//std::map<std::string, SoundObject* >::iterator it;
+		std::map<std::string, SoundObject>::iterator it;
+		//std::map<std::string, std::string>::iterator it;
 		it = m_soundobjects.find(part->m_objectname);
 		if (it != m_soundobjects.end())
 		{
-			it->second->setSound(part->m_animation);
-			DEBUGX("setting sound object %s to sound %s",it->first.c_str(), part->m_animation.c_str());
+			//it->second->setSound(part->m_animation);
+			it->second.setSoundData (part->m_animation);
+			//it->second = part->m_animation;
+
+			// TODO:XXX: This is where a play command should be triggered.
+			it->second.play ();
+
+			SW_DEBUG ("setting sound object [%s] to sound [%s]", it->first.c_str (), part->m_animation.c_str ());
 		}
 	}
 }
--- a/src/gui/graphicobject.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/graphicobject.h	Thu Mar 20 19:04:28 2014 +0100
@@ -24,7 +24,7 @@
 
 #include <string>
 #include "graphicobjectrenderinfo.h"
-#include "sound.h"
+#include "soundobject.h"
 
 class GraphicObject;
 
@@ -449,7 +449,9 @@
 		/**
 		 * \brief List of attached Soundobjects
 		 */
-		std::map<std::string, SoundObject* > m_soundobjects;
+		//std::map <std::string, SoundObject*> m_soundobjects;
+		std::map <std::string, SoundObject> m_soundobjects;
+		//std::map<std::string, std::string> m_soundobjects;
 		
 		/**
 		 * \brief Dependency for all Subobjects
--- a/src/gui/inventory.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/inventory.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -14,7 +14,13 @@
  */
 
 #include "inventory.h"
-#include "sound.h"
+//#include "sound.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
 
 Inventory::Inventory (Document* doc)
 	: ItemWindow(doc)
@@ -23,33 +29,34 @@
 
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 
-	CEGUI::Window* inventory = win_mgr.loadWindowLayout("inventory.layout");
+	CEGUI::Window* inventory = CEGUIUtility::loadLayoutFromFile ("inventory.layout");
 	if (!inventory)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "inventory.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "inventory.layout");
 	}
 
-	CEGUI::Window* inv_holder = win_mgr.loadWindowLayout( "inventory_holder.layout" );
+	CEGUI::Window* inv_holder = CEGUIUtility::loadLayoutFromFile ("inventory_holder.layout");
 	if (!inv_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "inventory_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "inventory_holder.layout");
 	}
 
-	DEBUG ("Placing layout into holder");
+	SW_DEBUG ("Placing layout into holder");
 	inventory->setVisible (true);
 	inv_holder->setVisible (true);
-	//inv_holder->addChildWindow (inventory);
+	//CEGUIUtility::addChildWidget (inv_holder, inventory);
+
 
-	CEGUI::Window* wndHolder = win_mgr.getWindow("Inventory_Holder");
-	CEGUI::Window* wndInventory = win_mgr.getWindow("Inventory");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (inv_holder, "Inventory_Holder");
+	CEGUI::Window* wndInventory = CEGUIUtility::getWindowForLoadedLayoutEx (inventory, "Inventory");
 	if (wndHolder && wndInventory)
 	{
-		wndHolder->addChildWindow (wndInventory);
+		CEGUIUtility::addChildWidget (wndHolder, wndInventory);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for inventory.");
-		if (!wndInventory) DEBUG ("ERROR: Unable to get the window for inventory.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for inventory.");
+		if (!wndInventory) SW_DEBUG ("ERROR: Unable to get the window for inventory.");
 	}
 	m_window = inv_holder;
 
@@ -62,8 +69,14 @@
 	CEGUI::PushButton* btn;
 	CEGUI::Window* label;
 	
-	label = win_mgr.getWindow("CharacterImage");
-	label->setProperty("Image", "set:character image:character_img"); 
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/CharImageHolder/CharacterImage");
+
+#ifdef CEGUI_07
+	label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("character", "character_img")); 
+#else
+	label->setProperty("Image", "character_img"); 
+#endif
+
 	label->setID(Equipement::NONE);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 	//label->setAlpha(1.0);
@@ -75,12 +88,13 @@
 	for (i=0;i<5;i++)
 	{
 		outStream.str("");
+		outStream << "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain/";
 		outStream << "BigItem" << i<< "Label";
-		label = win_mgr.getWindow(outStream.str());
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
 		label->setID(Equipement::BIG_ITEMS+i);
 		label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 		label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-		label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+		label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 		label->setWantsMultiClickEvents(false);
 	}
 
@@ -90,12 +104,13 @@
 		for (i=0;i<6;i++)
 		{
 			outStream.str("");
+			outStream << "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain/";
 			outStream << "MediumItem" << j*6+i<< "Label";
-			label = win_mgr.getWindow(outStream.str());
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
 			label->setID(Equipement::MEDIUM_ITEMS+j*6+i);
 			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 			label->setWantsMultiClickEvents(false);
 		}
 	}
@@ -105,12 +120,13 @@
 		for (i=0;i<10;i++)
 		{
 			outStream.str("");
+			outStream << "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain/";
 			outStream << "SmallItem" << j*10+i<< "Label";
-			label = win_mgr.getWindow(outStream.str());
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, outStream.str());
 			label->setID(Equipement::SMALL_ITEMS+j*10+i);
 			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 			label->setWantsMultiClickEvents(false);
 		}
 	}
@@ -118,129 +134,99 @@
 
 
 	// Label Ruestung
-	label = win_mgr.getWindow("ArmorItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/ArmorItemLabel");
 	label->setID(Equipement::ARMOR);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 	label->setWantsMultiClickEvents(false);
 
 
 	// Label Waffe
-	label = win_mgr.getWindow("WeaponItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/WeaponItemLabel");
 	label->setID(Equipement::WEAPON);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Label Helm
-	label = win_mgr.getWindow("HelmetItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/HelmetItemLabel");
 	label->setID(Equipement::HELMET);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Label Schild
-	label = win_mgr.getWindow("ShieldItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/ShieldItemLabel");
 	label->setID(Equipement::SHIELD);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*) this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*) this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*) this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Label Handschuhe
-	label = win_mgr.getWindow("GlovesItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/GlovesItemLabel");
 	label->setID(Equipement::GLOVES);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*)this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*)this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Ring links
-	label = win_mgr.getWindow("RingLeftItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/RingLeftItemLabel");
 	label->setID(Equipement::RING_LEFT);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*)this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*)this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Ring rechts
-	label = win_mgr.getWindow("RingRightItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/RingRightItemLabel");
 	label->setID(Equipement::RING_RIGHT);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*)this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*)this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Amulett
-	label = win_mgr.getWindow("AmuletItemLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/AmuletItemLabel");
 	label->setID(Equipement::AMULET);
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonPressed, (ItemWindow*)this));
 	label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&Inventory::onItemMouseButtonReleased, (ItemWindow*)this));
-	label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
+	label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&Inventory::onItemHover, (ItemWindow*)this));
 	label->setWantsMultiClickEvents(false);
 	
 	// Swap weapons button
-	if (win_mgr.isWindowPresent ("SwapEquipButton"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow ("SwapEquipButton"));
-		btn->setText ("1");
-		btn->subscribeEvent (CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&Inventory::onSwapEquipClicked, this));
-	}
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/SwapEquipButton"));
+	btn->setText ("1");
+	btn->subscribeEvent (CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&Inventory::onSwapEquipClicked, this));
 
 	// Label drop Gold
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("GoldDropButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldStaticImage/GoldDropButton"));
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&Inventory::onDropGoldClicked, this));
 	
-	
 	// Label drop Gold (Wert)
 	CEGUI::Editbox* box;
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("GoldDropValueBox"));
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldDropValueBox"));
 	box->subscribeEvent(CEGUI::Editbox::EventTextAccepted, CEGUI::Event::Subscriber(&Inventory::onDropGoldClicked,  this));
 	
 	
 	// Tab Labels
 	setState(Inventory::StateSmall);
 
-	//if (win_mgr.isWindowPresent ("SmallTabButton") 
-	//	&& win_mgr.isWindowPresent ("MediumTabButton") 
-	//	&& win_mgr.isWindowPresent ("BigTabButton"))
-	//{
-	//	CEGUI::TabButton *tabBtn;
-	//	tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow("SmallTabButton"));
-	//}
-
-	label = win_mgr.getWindow("SmallTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton");
 	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onSwitchTabClicked, this));
-	label = win_mgr.getWindow("MediumTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/MediumTabButton");
 	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onSwitchTabClicked, this));
-	label = win_mgr.getWindow("BigTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/BigTabButton");
 	label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onSwitchTabClicked, this));
 	
-	if (win_mgr.isWindowPresent ("InvCloseButton"))
-	{
-		label = win_mgr.getWindow("InvCloseButton");
-		if (label)
-		{
-			label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onCloseButtonClicked, this));
-		}
-	}
-	else
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/__auto_closebutton__");
+	if (label)
 	{
-		if (win_mgr.isWindowPresent ("Inventory__auto_closebutton__"))
-		{
-			label = win_mgr.getWindow ("Inventory__auto_closebutton__");
-			if (label)
-			{
-				label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onCloseButtonClicked, this));
-			}
-		}
-		else
-		{
-			DEBUG ("No close button INSIDE the inventory. Will only be closable via hotkeys and external buttons");
-		}
+		label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&Inventory::onCloseButtonClicked, this));
 	}
 	
 	createAnimations();
@@ -265,7 +251,7 @@
 
 
 	// Weapon - Label/Slot
-	img =  win_mgr.getWindow("WeaponItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/WeaponItemLabel");
 	it = player->getWeapon();
 	updateItemWindow(img,it,player);
 	weapon = it;
@@ -277,21 +263,21 @@
 
 
 	// Body armor - Label/Slot
-	img =  win_mgr.getWindow("ArmorItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/ArmorItemLabel");
 	it = equ->getItem(Equipement::ARMOR);
 	updateItemWindow(img,it,player);
 	
 
 
 	// Helm - Label/Slot
-	img =  win_mgr.getWindow("HelmetItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/HelmetItemLabel");
 	it = equ->getItem(Equipement::HELMET);
 	updateItemWindow(img,it,player);
 	
 	// Shield - Label/Slot
 	// for two handed weapons this will represent the weapon.
 	float alpha = 1.0;
-	img =  win_mgr.getWindow("ShieldItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/ShieldItemLabel");
 	it = player->getShield();
 	if (two_hand && it ==0)
 	{
@@ -307,55 +293,51 @@
 	
 
 	// Handgloves - Label/Slot
-	img =  win_mgr.getWindow("GlovesItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/GlovesItemLabel");
 	it = equ->getItem(Equipement::GLOVES);
 	updateItemWindow(img,it,player);
 	
 	// Left hand ring - Label/Slot
-	img =  win_mgr.getWindow("RingLeftItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/RingLeftItemLabel");
 	it = equ->getItem(Equipement::RING_LEFT);
 	updateItemWindow(img,it,player);
 	
 	// Right hand ring - Label/Slot
-	img =  win_mgr.getWindow("RingRightItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/RingRightItemLabel");
 	it = equ->getItem(Equipement::RING_RIGHT);
 	updateItemWindow(img,it,player);
 	
 
 	// Amulet - Label/Slot
-	img =  win_mgr.getWindow("AmuletItemLabel");
+	img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/AmuletItemLabel");
 	it = equ->getItem(Equipement::AMULET);
 	updateItemWindow(img,it,player);
 	
 	
 	// Swap button - this will also display the state of the current weapon selection.
-	if (win_mgr.isWindowPresent ("SwapEquipButton"))
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GearHolder/SwapEquipButton"));
+	std::string text;
+	if (player->isUsingSecondaryEquip())
 	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SwapEquipButton"));
-		std::string text;// = "set:Inventory image:WeaponSwitchState1";
-		if (player->isUsingSecondaryEquip())
-		{
-			if (btn->isPropertyPresent ("AltStateImage"))
-			{
-				text = btn->getProperty ("AltStateImage").c_str ();
-			}
-			//text="set:Inventory image:WeaponSwitchState2";
-		}
-		else
+		if (btn->isPropertyPresent ("AltStateImage"))
 		{
-			if (btn->isPropertyPresent ("MainStateImage"))
-			{
-				text = btn->getProperty ("MainStateImage").c_str ();
-			}
+			text = btn->getProperty ("AltStateImage").c_str ();
 		}
-		if (btn->isPropertyPresent ("NormalImage") && btn->isPropertyPresent ("HoverImage") && btn->isPropertyPresent ("PushedImage"))
+	}
+	else
+	{
+		if (btn->isPropertyPresent ("MainStateImage"))
 		{
-			if (btn->getProperty("NormalImage") != text)
-			{
-				btn->setProperty("NormalImage",text);
-				btn->setProperty("HoverImage",text);
-				btn->setProperty("PushedImage",text);		
-			}
+			text = btn->getProperty ("MainStateImage").c_str ();
+		}
+	}
+	if (btn->isPropertyPresent ("NormalImage") && btn->isPropertyPresent ("HoverImage") && btn->isPropertyPresent ("PushedImage"))
+	{
+		if (btn->getProperty("NormalImage") != text)
+		{
+			btn->setProperty("NormalImage",text);
+			btn->setProperty("HoverImage",text);
+			btn->setProperty("PushedImage",text);		
 		}
 	}
 
@@ -365,8 +347,9 @@
 	for (i=0;i<5;i++)
 	{
 		out_stream.str("");
+		out_stream << "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain/";
 		out_stream << "BigItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
 		it = equ->getItem(Equipement::BIG_ITEMS+i);
 		updateItemWindow(img,it,player);
 	}
@@ -375,8 +358,9 @@
 	for (i=0;i<12;i++)
 	{
 		out_stream.str("");
+		out_stream << "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain/";
 		out_stream << "MediumItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
 		it = equ->getItem(Equipement::MEDIUM_ITEMS+i);
 		updateItemWindow(img,it,player);
 	}
@@ -385,13 +369,14 @@
 	for (i=0;i<30;i++)
 	{
 		out_stream.str("");
+		out_stream << "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain/";
 		out_stream << "SmallItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
 		it = equ->getItem(Equipement::SMALL_ITEMS+i);
 		updateItemWindow(img,it,player);
 	}
 	
-	label =  win_mgr.getWindow("GoldValueLabel");
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldValueLabel");
 	out_stream.str("");
 	out_stream << equ->getGold();
 	if (label->getText()!=out_stream.str())
@@ -399,7 +384,8 @@
 		label->setText(out_stream.str());
 		if (!m_silent)
 		{
-			SoundSystem::playAmbientSound("sell_buy");
+			//SoundSystem::playAmbientSound("sell_buy");
+			SoundHelper::playAmbientSoundGroup ("sell_buy");
 		}
 	}
 	
@@ -412,53 +398,59 @@
 
 	if(s == Inventory::StateSmall)
 	{
+		SW_DEBUG ("Changed state to small inventory");
+
 		CEGUI::TabButton *tabBtn;
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("SmallTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton"));
 		tabBtn->setSelected (true);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("MediumTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/MediumTabButton"));
 		tabBtn->setSelected (false);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("BigTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/BigTabButton"));
 		tabBtn->setSelected (false);
 
-		label = win_mgr.getWindow("SmallTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain");
 		label->setVisible(true);
-		label = win_mgr.getWindow("MediumTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain");
 		label->setVisible(false);
-		label = win_mgr.getWindow("BigTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain");
 		label->setVisible(false);
 	}
 	else if(s == Inventory::StateMedium)
 	{
+		SW_DEBUG ("Changed state to medium inventory");
+
 		CEGUI::TabButton *tabBtn;
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("SmallTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton"));
 		tabBtn->setSelected (false);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("MediumTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/MediumTabButton"));
 		tabBtn->setSelected (true);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("BigTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/BigTabButton"));
 		tabBtn->setSelected (false);
 
-		label = win_mgr.getWindow("SmallTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain");
 		label->setVisible(false);
-		label = win_mgr.getWindow("MediumTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain");
 		label->setVisible(true);
-		label = win_mgr.getWindow("BigTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain");
 		label->setVisible(false);
 	}
 	else if(s == Inventory::StateBig)
 	{
+		SW_DEBUG ("Changed state to big inventory");
+
 		CEGUI::TabButton *tabBtn;
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("SmallTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton"));
 		tabBtn->setSelected (false);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("MediumTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/MediumTabButton"));
 		tabBtn->setSelected (false);
-		tabBtn = static_cast<CEGUI::TabButton*> (win_mgr.getWindow ("BigTabButton"));
+		tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/BigTabButton"));
 		tabBtn->setSelected (true);
 
-		label = win_mgr.getWindow("SmallTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain");
 		label->setVisible(false);
-		label = win_mgr.getWindow("MediumTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain");
 		label->setVisible(false);
-		label = win_mgr.getWindow("BigTabMain");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain");
 		label->setVisible(true);
 	}
 }
@@ -468,30 +460,22 @@
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 	
-	label = win_mgr.getWindow("GoldDropButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldStaticImage/GoldDropButton");
 	label->setText((CEGUI::utf8*) gettext("Drop:"));
 	
-	if (win_mgr.isWindowPresent ("InvLabel"))
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory");
+	if (label)
 	{
-		label = win_mgr.getWindow("InvLabel");
 		label->setText((CEGUI::utf8*) gettext("Inventory"));
 	}
-	else
-	{
-		label = win_mgr.getWindow ("Inventory");
-		if (label)
-		{
-			label->setText((CEGUI::utf8*) gettext("Inventory"));
-		}
-	}
 	
-	label = win_mgr.getWindow("SmallTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton");
 	label->setText((CEGUI::utf8*) gettext("Small"));
 	
-	label = win_mgr.getWindow("MediumTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/MediumTabButton");
 	label->setText((CEGUI::utf8*) gettext("Medium"));
 	
-	label = win_mgr.getWindow("BigTabButton");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/BigTabButton");
 	label->setText((CEGUI::utf8*) gettext("Big"));
 
 }
@@ -508,7 +492,7 @@
 {
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 
-	CEGUI::Editbox* gold = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("GoldDropValueBox"));
+	CEGUI::Editbox* gold = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/GoldDropValueBox"));
 	int val =0;
 	std::stringstream stream;
 	stream.str(gold->getText().c_str());
@@ -528,6 +512,8 @@
 	const CEGUI::WindowEventArgs* args = static_cast<const CEGUI::WindowEventArgs*>(&evt);
 	std::string name = args->window->getName().c_str();
 
+	SW_DEBUG ("Inventory: Switch Tab [%s]", name.c_str ());
+
 	if(name == "SmallTabButton")
 	{
 		setState(Inventory::StateSmall);
@@ -562,21 +548,21 @@
 	CEGUI::AnimationManager::getSingleton().loadAnimationsFromXML("InventoryAnimations.xml");
 	
 	// Small tab animations
-	label = win_mgr.getWindow("SmallTabMain");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/SmallTabMain");
 	CEGUI::AnimationInstance* instance = CEGUI::AnimationManager::getSingleton().instantiateAnimation("SlotFadeIn");
 	instance->setTargetWindow(label);
     instance->start();
 	label->subscribeEvent(CEGUI::Window::EventShown, CEGUI::Event::Subscriber(&CEGUI::AnimationInstance::handleStart, instance));
 
 	// Medium tab animations
-	label = win_mgr.getWindow("MediumTabMain");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/MediumTabMain");
 	instance = CEGUI::AnimationManager::getSingleton().instantiateAnimation("SlotFadeIn");
 	instance->setTargetWindow(label);
     instance->start();
 	label->subscribeEvent(CEGUI::Window::EventShown, CEGUI::Event::Subscriber(&CEGUI::AnimationInstance::handleStart, instance));
 
 	// Big tab animations
-	label = win_mgr.getWindow("BigTabMain");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/StashItemArea/BigTabMain");
 	instance = CEGUI::AnimationManager::getSingleton().instantiateAnimation("SlotFadeIn");
 	instance->setTargetWindow(label);
     instance->start();
--- a/src/gui/itemwindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/itemwindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,405 +1,427 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "graphicmanager.h"
-#include "itemwindow.h"
-#include "tooltipmanager.h"
-#include "ceguiutility.h"
-#include "sound.h"
-
-
-std::map<Item::Subtype, std::string> ItemWindow::m_item_images;
-
-
-ItemWindow::ItemWindow (Document* doc)
-	: Window(doc)
-{
-	m_silent = false;
-}
-
-bool ItemWindow::onItemHover(const CEGUI::EventArgs& evt)
-{
-
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	Player* player = m_document->getLocalPlayer();
-	Item* itm;
-	if (id == Equipement::WEAPON)
-	{
-		itm = player->getWeapon();
-	}
-	else if (id == Equipement::SHIELD)
-	{
-		itm = player->getShield();
-	}
-	else
-	{
-		itm = player->getEquipement()->getItem(id);
-	}
-	
-	float factor = 1.0;
-	Creature* npc = player->getTradePartner();
-	if (npc != 0)
-	{
-		NPCTrade& tradeinfo = Dialogue::getNPCTrade(npc->getRefName());
-		factor = tradeinfo.m_pay_multiplier;
-	}
-	updateItemWindowTooltip(we.window,itm ,player,-1,factor);
-	return true;
-}
-
-
-bool ItemWindow::onItemMouseButtonPressed(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	if (we.button == CEGUI::LeftButton)
-	{
-		m_document->onItemLeftClick((short) id);
-	}
-
-	if (we.button == CEGUI::RightButton)
-	{
-		m_document->onItemRightClick((short) id);
-	}
-
-	DEBUGX("left button pressed on Item %i",id);
-	return true;
-}
-
-bool ItemWindow::onItemMouseButtonReleased(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	if (we.button == CEGUI::LeftButton)
-	{
-		DEBUGX("left button released on Item %i",id);
-	}
-	return true;
-}
-
-
-std::string ItemWindow::getItemImage(Item::Subtype type)
-{
-	std::map<Item::Subtype, std::string>::iterator it;
-	it = m_item_images.find(type);
-
-	if (it != m_item_images.end())
-	{
-		return it->second;
-	}
-
-	return "set: noMedia.png image: full_image";
-}
-
-
-void ItemWindow::updateItemWindow(CEGUI::Window* img, Item* item, Player* player, int gold)
-{
-	std::string imgname="";
-	std::string idstr = "";
-	bool playsound = false;
-	if (item != 0)
-	{
-		std::stringstream stream;
-		stream << item->m_subtype << ":" << item->m_id;
-		idstr = stream.str();
-		
-		imgname= getItemImage(item->m_subtype);
-		if (img->getProperty("Image")!=imgname)
-		{
-			img->setProperty("Image", imgname);
-		}
-		
-		if (!img->isUserStringDefined("idstr") || img->getUserString("idstr") != idstr)
-		{
-			if (item != 0)
-			{
-				playsound = true;
-			}
-			img->setUserString("idstr",idstr);
-		}
-	}
-	else
-	{
-		if (img->getProperty("Image")!=imgname)
-		{
-			img->setProperty("Image", imgname);
-			img->setUserString("idstr",idstr);
-		}
-	}
-	
-	// TODO:remove when no longer needed - end
-	if (img->isPropertyPresent ("BackgroundColours") && item != 0)
-	{
-		std::string propold = img->getProperty("BackgroundColours").c_str();
-		std::string propnew = "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000";
-
-		// rot wenn Spieler Item nicht verwenden kann
-		// oder es bezahlen muss und nicht genug Geld hat
-		if (!player->checkItemRequirements(item).m_overall)
-		{
-			propnew = "tl:FFAA5555 tr:FFAA5555 bl:FFAA5555 br:FFAA5555";
-		}
-		else if (gold>=0 && gold<item->m_price)
-		{
-			propnew = "tl:FFAA5555 tr:FFAA5555 bl:FFAA5555 br:FFAA5555";
-		}
-		else if (item->m_rarity == Item::MAGICAL)
-		{
-			propnew = "tl:FF5555AA tr:FF5555AA bl:FF5555AA br:FF5555AA";
-		}
-	
-		if (propold != propnew)
-		{
-			img->setProperty("BackgroundColours", propnew); 
-		}
-	}
-	// TODO:remove when no longer needed - begin
-	else if (img->isPropertyPresent ("BackgroundColour") && item != 0)
-	{
-		std::string propold = img->getProperty("BackgroundColour").c_str();
-		std::string propnew = "2AFFFFFF";
-
-		// TODO: move colours to separate locations. Preferably make non-hard-coded.
-		// Red colour when the player cannot use the item or (shop scenario) not enough gold available for purchase
-		if (!player->checkItemRequirements(item).m_overall)
-		{
-			propnew = "FFAA5555";
-		}
-		else if (gold>=0 && gold<item->m_price)
-		{
-			propnew = "FFAA5555";
-		}
-		else if (item->m_rarity == Item::MAGICAL)
-		{
-			propnew = "FF5555AA";
-		}
-	
-		if (propold != propnew)
-		{
-			img->setProperty("BackgroundColour", propnew); 
-		}
-	}
-
-	if (item == 0)
-	{
-		if (img->isPropertyPresent ("BackgroundColour"))
-		{
-			img->setProperty ("BackgroundColour", img->getPropertyDefault ("BackgroundColour"));
-		}
-	}
-	
-	// try to find a Progressbar with a matching name
-	// remove "Label" and add "ProgressBar"
-	CEGUI::String  windowname = img->getName();
-	std::size_t pos =	windowname.find ("Label");
-	if (pos != std::string::npos)
-	{
-		windowname.erase(pos,5);
-	}
-	windowname.append("ProgressBar");
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	if (win_mgr.isWindowPresent(windowname))
-	{
-		// update progress bar to reflect item timer
-		CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( windowname));
-		double progress = 0;
-		if (item != 0 && item->m_consumable && item->m_consume_timer_nr != 0)
-		{
-			// there is an item with potentially running timer
-			progress = player->getTimerPercent(item->m_consume_timer_nr);
-		}
-		
-		// update progress
-		if (bar->getProgress() != progress)
-		{
-			bar->setProgress(progress);
-		}
-		
-		// display image gray if the item is not available
-		double alpha = 1;
-		if (progress > 0)
-		{
-			alpha = 0.5;
-			if (bar->getAlpha() != 0.5)
-			{
-				bar->setAlpha(0.5);
-			}
-		}
-		if (img->getAlpha() != alpha)
-		{
-			img->setAlpha(alpha);
-		}
-	}
-	
-	if (playsound && !m_silent_current_update)
-	{
-		SoundName sname = GraphicManager::getDropSound(item->m_subtype);
-		if (sname != "")
-		{
-			SoundSystem::playAmbientSound(sname);
-			
-			// play only one sound per update...
-			m_silent_current_update = true;
-		}
-		DEBUGX("drop sound %s",sname.c_str());
-	}
-}
-
-void ItemWindow::updateItemWindowTooltip(CEGUI::Window* img, Item* item, Player* player, int gold,float price_factor)
-{
-	TooltipManager *tMgr = TooltipManager::getSingletonPtr();
-
-	if ( item == 0 )
-		return;
-
-	CEGUI::Font *font = img->getTooltip()->getFont();
-	std::string msg;
-	ItemRequirementsMet irm = player->checkItemRequirements ( item );
-	
-	Item *currentEqItem = 0;
-	Item *currentEqItemOffhand = 0;
-	Item *attachedItem = player->getEquipement()->getItem (Equipement::CURSOR_ITEM);
-
-	std::string primary_eq_head = gettext("Equipped:\n");
-	std::string secondary_eq_head = gettext("Equipped:\n");
-	
-	switch ( item->m_type )
-	{
-		case Item::NOITEM:
-			break;
-
-		case Item::ARMOR:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::ARMOR );
-			break;
-
-		case Item::HELMET:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::HELMET );
-			break;
-
-		case Item::GLOVES:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::GLOVES );
-			break;
-
-		case Item::WEAPON:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::WEAPON );
-			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::WEAPON2 );
-			secondary_eq_head = gettext("Equipped (secondary):\n");
-			
-			// swap pointers if secondary equip is activated
-			if (player->isUsingSecondaryEquip())
-			{
-				std::swap(currentEqItem,currentEqItemOffhand); 
-			}
-			break;
-
-		case Item::SHIELD:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::SHIELD );
-			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::SHIELD2 );
-			// swap pointers if secondary equip is activated
-			if (player->isUsingSecondaryEquip())
-			{
-				std::swap(currentEqItem,currentEqItemOffhand); 
-			}
-			break;
-
-		case Item::POTION:
-			break;
-
-		case Item::RING:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::RING_LEFT );
-			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::RING_RIGHT );
-			primary_eq_head = gettext("Equipped (left):\n");
-			secondary_eq_head = gettext("Equipped (right):\n");
-			break;
-
-		case Item::AMULET:
-			currentEqItem = player->getEquipement()->getItem ( Equipement::AMULET );
-			break;
-
-		case Item::GOLD_TYPE:
-			break;
-
-		default:
-			break;
-
-	}
-	
-	bool hoverEqItem = false;
-	bool hoverEqItemOffhand = false;
-	// Do not display the same item twice (happens if you hover an equiped item)
-	if (item == currentEqItem)
-	{
-		currentEqItem = 0;
-		hoverEqItem = true;
-	}
-	else if (item == currentEqItemOffhand)
-	{
-		hoverEqItemOffhand = true;
-		currentEqItemOffhand = 0;
-	}
-	
-	// create main tooltip
-	std::list<std::string> l = item->getDescriptionAsStringList ( price_factor, irm );
-	if (hoverEqItem)
-	{
-		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, primary_eq_head, CEGUIUtility::Black ));
-	}
-	if (hoverEqItemOffhand)
-	{
-		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, secondary_eq_head, CEGUIUtility::Black ));
-	}
-	l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, gettext("Hovered:\n"), CEGUIUtility::Black ));
-	std::ostringstream out_stream;
-
-	tMgr->createTooltip ( img, l, 0, font, Tooltip::Main );
-
-	// create secondary tooltips
-	if (attachedItem != 0)
-	{
-		l = attachedItem->getDescriptionAsStringList ( price_factor );
-		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, gettext("Attached:\n"), CEGUIUtility::Black ));
-		tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
-	}
-	else
-	{
-		if ( currentEqItem )
-		{
-			l = currentEqItem->getDescriptionAsStringList ( price_factor );
-			l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, primary_eq_head, CEGUIUtility::Black ));
-			tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
-		}
-		
-		if ( currentEqItemOffhand )
-		{
-			l = currentEqItemOffhand->getDescriptionAsStringList ( price_factor );
-			l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, secondary_eq_head, CEGUIUtility::Black ));
-			tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
-		}
-	}
-}
-
-void ItemWindow::registerItemImage(Item::Subtype type, std::string image)
-{
-	m_item_images[type] = image;
-}
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "graphicmanager.h"
+#include "itemwindow.h"
+#include "tooltipmanager.h"
+#include "ceguiutility.h"
+//#include "sound.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+std::map<Item::Subtype, std::string> ItemWindow::m_item_images;
+
+
+ItemWindow::ItemWindow (Document* doc)
+	: Window(doc)
+{
+	m_silent = false;
+}
+
+bool ItemWindow::onItemHover(const CEGUI::EventArgs& evt)
+{
+
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	Player* player = m_document->getLocalPlayer();
+	Item* itm;
+	if (id == Equipement::WEAPON)
+	{
+		itm = player->getWeapon();
+	}
+	else if (id == Equipement::SHIELD)
+	{
+		itm = player->getShield();
+	}
+	else
+	{
+		itm = player->getEquipement()->getItem(id);
+	}
+	
+	float factor = 1.0;
+	Creature* npc = player->getTradePartner();
+	if (npc != 0)
+	{
+		NPCTrade& tradeinfo = Dialogue::getNPCTrade(npc->getRefName());
+		factor = tradeinfo.m_pay_multiplier;
+	}
+	updateItemWindowTooltip(we.window,itm ,player,-1,factor);
+	return true;
+}
+
+
+bool ItemWindow::onItemMouseButtonPressed(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	if (we.button == CEGUI::LeftButton)
+	{
+		m_document->onItemLeftClick((short) id);
+	}
+
+	if (we.button == CEGUI::RightButton)
+	{
+		m_document->onItemRightClick((short) id);
+	}
+
+	DEBUGX("left button pressed on Item %i",id);
+	return true;
+}
+
+bool ItemWindow::onItemMouseButtonReleased(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	if (we.button == CEGUI::LeftButton)
+	{
+		DEBUGX("left button released on Item %i",id);
+	}
+	return true;
+}
+
+
+std::string ItemWindow::getItemImage(Item::Subtype type)
+{
+	std::map<Item::Subtype, std::string>::iterator it;
+	it = m_item_images.find(type);
+
+	if (it != m_item_images.end())
+	{
+		return it->second;
+	}
+
+	return CEGUIUtility::getImageNameWithSkin ("noMedia.png", "full_image");
+}
+
+
+void ItemWindow::updateItemWindow(CEGUI::Window* img, Item* item, Player* player, int gold)
+{
+	std::string imgname="";
+	std::string idstr = "";
+	bool playsound = false;
+	if (item != 0)
+	{
+		std::stringstream stream;
+		stream << item->m_subtype << ":" << item->m_id;
+		idstr = stream.str();
+		
+		imgname= getItemImage(item->m_subtype);
+		if (img->getProperty("Image")!=imgname)
+		{
+			img->setProperty("Image", imgname);
+		}
+		
+		if (!img->isUserStringDefined("idstr") || img->getUserString("idstr") != idstr)
+		{
+			if (item != 0)
+			{
+				playsound = true;
+			}
+			img->setUserString("idstr",idstr);
+		}
+	}
+	else
+	{
+		if (img->getProperty("Image")!=imgname)
+		{
+			img->setProperty("Image", imgname);
+			img->setUserString("idstr",idstr);
+		}
+	}
+	
+	// TODO:remove when no longer needed - end
+	if (img->isPropertyPresent ("BackgroundColours") && item != 0)
+	{
+		std::string propold = img->getProperty("BackgroundColours").c_str();
+		std::string propnew = "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000";
+
+		// rot wenn Spieler Item nicht verwenden kann
+		// oder es bezahlen muss und nicht genug Geld hat
+		if (!player->checkItemRequirements(item).m_overall)
+		{
+			propnew = "tl:FFAA5555 tr:FFAA5555 bl:FFAA5555 br:FFAA5555";
+		}
+		else if (gold>=0 && gold<item->m_price)
+		{
+			propnew = "tl:FFAA5555 tr:FFAA5555 bl:FFAA5555 br:FFAA5555";
+		}
+		else if (item->m_rarity == Item::MAGICAL)
+		{
+			propnew = "tl:FF5555AA tr:FF5555AA bl:FF5555AA br:FF5555AA";
+		}
+	
+		if (propold != propnew)
+		{
+			img->setProperty("BackgroundColours", propnew); 
+		}
+	}
+	// TODO:remove when no longer needed - begin
+	else if (img->isPropertyPresent ("BackgroundColour") && item != 0)
+	{
+		std::string propold = img->getProperty("BackgroundColour").c_str();
+		std::string propnew = "2AFFFFFF";
+
+		// TODO: move colours to separate locations. Preferably make non-hard-coded.
+		// Red colour when the player cannot use the item or (shop scenario) not enough gold available for purchase
+		if (!player->checkItemRequirements(item).m_overall)
+		{
+			propnew = "FFAA5555";
+		}
+		else if (gold>=0 && gold<item->m_price)
+		{
+			propnew = "FFAA5555";
+		}
+		else if (item->m_rarity == Item::MAGICAL)
+		{
+			propnew = "FF5555AA";
+		}
+	
+		if (propold != propnew)
+		{
+			img->setProperty("BackgroundColour", propnew); 
+		}
+	}
+
+	if (item == 0)
+	{
+		if (img->isPropertyPresent ("BackgroundColour"))
+		{
+			img->setProperty ("BackgroundColour", img->getPropertyDefault ("BackgroundColour"));
+		}
+	}
+	
+	// try to find a Progressbar with a matching name
+	// remove "Label" and add "ProgressBar"
+	std::size_t pos;
+#ifdef CEGUI_07
+	CEGUI::String  windowname = img->getName ();
+#else
+	CEGUI::String  windowname = img->getNamePath ();
+	pos = windowname.find ("SW/");
+	if (pos != std::string::npos)
+	{
+		windowname.erase (pos, 3);
+	}
+	//DEBUG ("Name [%s], namepath [%s]", windowname.c_str (), img->getNamePath ().c_str ());
+#endif
+	// TODO:XXX:this was initially meant only for items such as : SmallItem0Label > SmallItem0ProgressBar
+	pos = windowname.find ("Label");
+	if (pos != std::string::npos)
+	{
+		windowname.erase(pos,5);
+	}
+	windowname.append("ProgressBar");
+	// Fenstermanager
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	if (CEGUIUtility::isWindowPresent (windowname))
+	{
+		// update progress bar to reflect item timer
+		CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow (windowname));
+		double progress = 0;
+		if (item != 0 && item->m_consumable && item->m_consume_timer_nr != 0)
+		{
+			// there is an item with potentially running timer
+			progress = player->getTimerPercent(item->m_consume_timer_nr);
+		}
+		
+		// update progress
+		if (bar->getProgress() != progress)
+		{
+			bar->setProgress(progress);
+		}
+		
+		// display image gray if the item is not available
+		double alpha = 1;
+		if (progress > 0)
+		{
+			alpha = 0.5;
+			if (bar->getAlpha() != 0.5)
+			{
+				bar->setAlpha(0.5);
+			}
+		}
+		if (img->getAlpha() != alpha)
+		{
+			img->setAlpha(alpha);
+		}
+	}
+	
+	if (playsound && !m_silent_current_update)
+	{
+		std::string sname = GraphicManager::getDropSound(item->m_subtype);
+		if (sname != "")
+		{
+			//SoundSystem::playAmbientSound(sname);
+			SoundHelper::playAmbientSoundGroup (sname);
+			
+			// play only one sound per update...
+			m_silent_current_update = true;
+		}
+		DEBUGX("drop sound %s",sname.c_str());
+	}
+}
+
+void ItemWindow::updateItemWindowTooltip(CEGUI::Window* img, Item* item, Player* player, int gold,float price_factor)
+{
+	TooltipManager *tMgr = TooltipManager::getSingletonPtr();
+
+	if ( item == 0 )
+		return;
+
+	const CEGUI::Font *font = img->getTooltip()->getFont();
+	std::string msg;
+	ItemRequirementsMet irm = player->checkItemRequirements ( item );
+	
+	Item *currentEqItem = 0;
+	Item *currentEqItemOffhand = 0;
+	Item *attachedItem = player->getEquipement()->getItem (Equipement::CURSOR_ITEM);
+
+	std::string primary_eq_head = gettext("Equipped:");
+	std::string secondary_eq_head = gettext("Equipped:");
+	
+	switch ( item->m_type )
+	{
+		case Item::NOITEM:
+			break;
+
+		case Item::ARMOR:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::ARMOR );
+			break;
+
+		case Item::HELMET:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::HELMET );
+			break;
+
+		case Item::GLOVES:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::GLOVES );
+			break;
+
+		case Item::WEAPON:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::WEAPON );
+			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::WEAPON2 );
+			secondary_eq_head = gettext("Equipped (secondary):\n");
+			
+			// swap pointers if secondary equip is activated
+			if (player->isUsingSecondaryEquip())
+			{
+				std::swap(currentEqItem,currentEqItemOffhand); 
+			}
+			break;
+
+		case Item::SHIELD:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::SHIELD );
+			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::SHIELD2 );
+			// swap pointers if secondary equip is activated
+			if (player->isUsingSecondaryEquip())
+			{
+				std::swap(currentEqItem,currentEqItemOffhand); 
+			}
+			break;
+
+		case Item::POTION:
+			break;
+
+		case Item::RING:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::RING_LEFT );
+			currentEqItemOffhand = player->getEquipement()->getItem ( Equipement::RING_RIGHT );
+			primary_eq_head = gettext("Equipped (left):");
+			secondary_eq_head = gettext("Equipped (right):");
+			break;
+
+		case Item::AMULET:
+			currentEqItem = player->getEquipement()->getItem ( Equipement::AMULET );
+			break;
+
+		case Item::GOLD_TYPE:
+			break;
+
+		default:
+			break;
+
+	}
+	
+	bool hoverEqItem = false;
+	bool hoverEqItemOffhand = false;
+	// Do not display the same item twice (happens if you hover an equiped item)
+	if (item == currentEqItem)
+	{
+		currentEqItem = 0;
+		hoverEqItem = true;
+	}
+	else if (item == currentEqItemOffhand)
+	{
+		hoverEqItemOffhand = true;
+		currentEqItemOffhand = 0;
+	}
+	
+	// create main tooltip
+	std::list<std::string> l = item->getDescriptionAsStringList ( price_factor, irm );
+	if (hoverEqItem)
+	{
+		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, primary_eq_head, CEGUIUtility::Black ));
+	}
+	if (hoverEqItemOffhand)
+	{
+		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, secondary_eq_head, CEGUIUtility::Black ));
+	}
+	l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, gettext("Hovered:"), CEGUIUtility::Black ));
+	std::ostringstream out_stream;
+
+	//XXX-begin; TODO: delete this
+	//DEBUG ("Obtained description for item as string list.");
+	//for (std::list <std::string>::iterator it = l.begin (); it != l.end (); ++ it)
+	//{
+	//	DEBUG ("[%s]", it->c_str ());
+	//}
+	//XXX-end
+	tMgr->createTooltip ( img, l, 0, font, Tooltip::Main );
+
+	// create secondary tooltips
+	if (attachedItem != 0)
+	{
+		l = attachedItem->getDescriptionAsStringList ( price_factor );
+		l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, gettext("Attached:\n"), CEGUIUtility::Black ));
+		tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
+	}
+	else
+	{
+		if ( currentEqItem )
+		{
+			l = currentEqItem->getDescriptionAsStringList ( price_factor );
+			l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, primary_eq_head, CEGUIUtility::Black ));
+			tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
+		}
+		
+		if ( currentEqItemOffhand )
+		{
+			l = currentEqItemOffhand->getDescriptionAsStringList ( price_factor );
+			l.push_front (  CEGUIUtility::getColourizedString(CEGUIUtility::Blue, secondary_eq_head, CEGUIUtility::Black ));
+			tMgr->createTooltip ( img, l, 0, font, Tooltip::Comparision );
+		}
+	}
+}
+
+void ItemWindow::registerItemImage(Item::Subtype type, std::string image)
+{
+	m_item_images[type] = image;
+}
--- a/src/gui/listitem.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/listitem.h	Thu Mar 20 19:04:28 2014 +0100
@@ -16,6 +16,11 @@
 #ifndef __SUMWARS_GUI_LISTITEM_H__
 #define __SUMWARS_GUI_LISTITEM_H__
 
+// Need tp add the cross version header here, as it may define symbols related to CEGUI_07
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
 #include "CEGUI/CEGUI.h"
 
 /**
@@ -27,7 +32,15 @@
 	public:
 		ListItem(const CEGUI::String& skin, const CEGUI::String& text, unsigned int id=0) : ListboxTextItem(text,id)
 		{
+#ifdef CEGUI_07
 			setSelectionBrushImage(skin, "MultiListSelectionBrush");
+#else
+			CEGUI::String summedUpName (skin);
+			summedUpName.append ("/MultiListSelectionBrush");
+			setSelectionBrushImage (summedUpName);
+
+#endif
+			
 			setAutoDeleted (true);
 		}
 };
@@ -42,7 +55,13 @@
 	public:
 		StrListItem(const CEGUI::String& skin, const CEGUI::String& text, std::string data, unsigned int id=0) : ListItem(skin, text,id)
 		{
+#ifdef CEGUI_07
 			setSelectionBrushImage(skin, "MultiListSelectionBrush");
+#else
+			CEGUI::String summedUpName (skin);
+			summedUpName.append ("/MultiListSelectionBrush");
+			setSelectionBrushImage (summedUpName);
+#endif
 			m_data = data;
 		}
 
--- a/src/gui/main_gui.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/main_gui.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -222,7 +222,7 @@
 	*/
 	catch (CEGUI::Exception& e)
 	{
-		DEBUG("Program died with exception %s", e.getMessage().c_str());
+		SW_DEBUG("Program died with exception %s", e.getMessage().c_str());
 	}
 	// Ende
 	return 0;
--- a/src/gui/mainmenu.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/mainmenu.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,935 +1,1001 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "OgreEntity.h"
-#include "mainmenu.h"
-#include <OgreRenderWindow.h>
-#include <OgreSubEntity.h>
-#include <OgreMeshManager.h>
-#include <OgreParticleSystem.h>
-#include "listitem.h"
-#include "savegamelist.h"
-#include "messageboxes.h"
-#include "graphicmanager.h"
-#include "scene.h"
-#include "version.h"
-
-#include <iostream>
-
-MainMenu::MainMenu (Document* doc, const std::string& ceguiSkinName)
-        : Window (doc)
-		, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUG ("MainMenu created");
-
-	m_savegame_player ="";
-	m_savegame_player_object =0;
-	
-	m_savegame_player_action.m_type = "noaction";
-	m_savegame_player_action.m_time = 2000;
-	m_savegame_player_action.m_elapsed_time = 0;
-
-	
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-
-	CEGUI::FrameWindow* start_menu_root = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout( "mainmenu.layout" );
-    m_window = start_menu_root;
-	m_window->setMousePassThroughEnabled(true);
-    m_window->subscribeEvent(CEGUI::Window::EventShown, CEGUI::Event::Subscriber(&MainMenu::onShown, this));
-    m_window->subscribeEvent(CEGUI::Window::EventHidden, CEGUI::Event::Subscriber(&MainMenu::onHidden, this));
-
-    // Button Einzelspieler
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SinglePlayerButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartSinglePlayer, this));
-
-	// Button Server beitreten
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ServerJoinButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartMultiPlayer, this));
-
-
-    // Button Server aufsetzen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ServerHostButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartMultiPlayerHost, this));
-
-    // Button Credits
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CreditsButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onShowCredits, this));
-
-    // Button Optionen
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("MainOptionsButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onShowOptions, this));
-
-
-    // Button beenden
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("EndGameButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onQuitGameHost, this));
-
-	CEGUI::Window* verlbl;
-
-	verlbl = win_mgr.getWindow("SumwarsVersionLabel");
-	verlbl->setText(CEGUI::String("Version: ").append(SUMWARS_VERSION));
-
-	CEGUI::FrameWindow* lbl;
-
-	if (win_mgr.isWindowPresent ("SinglePlayerButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("SinglePlayerButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-	if (win_mgr.isWindowPresent ("ServerJoinButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerJoinButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-	if (win_mgr.isWindowPresent ("ServerHostButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerHostButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-	if (win_mgr.isWindowPresent ("CreditsButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("CreditsButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-	if (win_mgr.isWindowPresent ("MainOptionsButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("MainOptionsButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-	if (win_mgr.isWindowPresent ("EndGameButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("EndGameButton/Label"));
-		lbl->setMousePassThroughEnabled(true);
-	}
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginToOnlineService, this));
-
-    CEGUI::FrameWindow* login_dialog = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout( "LoginDialog.layout" );
-    m_window->addChildWindow(login_dialog);
-	login_dialog->hide();
-
-    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginDialog/LoginButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginDialogLoginButton, this));
-
-    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginDialog/CancelButton"));
-    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginDialogCancelButton, this));
-
-    OnlineServicesManager::getSingleton().registerLoginStatusListener(this);
-#else
-    lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("SumwarsOnlineIndicatorLabel"));
-    lbl->hide();
-
-    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginButton"));
-    btn->hide();
-#endif
-
-	Ogre::Root *root = Ogre::Root::getSingletonPtr();
-	m_sceneMgr = root->createSceneManager(Ogre::ST_GENERIC, "MainMenuSceneManager");
-	m_mainMenuCamera = m_sceneMgr->createCamera("MainMenuCamera");
-	m_mainMenuCamera->setNearClipDistance(0.1f);
-	m_mainMenuCamera->setFarClipDistance(10000);
-
-    m_sceneCreated = false;
-    m_userLoggedIn = false;
-
-    createSavegameList();
-
-    updateTranslation();
-}
-
-
-void MainMenu::update()
-{
-    updateCharacterView();
-}
-
-
-void MainMenu::updateTranslation()
-{
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::FrameWindow* lbl;
-
-	// Update the button labels.
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("SinglePlayerButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Single player"));
-
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerJoinButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Join game"));
-
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerHostButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Host game"));
-
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("CreditsButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Credits"));
-
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("MainOptionsButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Options"));
-
-	lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("EndGameButton"));
-	lbl->setText((CEGUI::utf8*) gettext("Quit"));
-
-	if (win_mgr.isWindowPresent ("SinglePlayerButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("SinglePlayerButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Single player"));
-	}
-
-	if (win_mgr.isWindowPresent ("ServerJoinButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerJoinButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Join game"));
-	}
-
-	if (win_mgr.isWindowPresent ("ServerHostButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("ServerHostButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Host game"));
-	}
-
-	if (win_mgr.isWindowPresent ("CreditsButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("CreditsButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Credits"));
-	}
-
-	if (win_mgr.isWindowPresent ("MainOptionsButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("MainOptionsButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Options"));
-	}
-
-	if (win_mgr.isWindowPresent ("EndGameButton/Label"))
-	{
-		// TODO: remove when no longer needed.
-		lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("EndGameButton/Label"));
-		lbl->setText((CEGUI::utf8*) gettext("Quit"));
-	}
-
-
-	// Update message windows
-	//lbl = static_cast<CEGUI::FrameWindow*>(win_mgr.getWindow("DeleteCharLabel")); // note: this has no in-between slash!
-	//if (lbl) lbl->setText((CEGUI::utf8*) gettext("Really delete savegame?"));
-
-	// Propagation onto sub-windows
-	if (m_saveGameList != 0)
-	{
-		m_saveGameList->updateTranslation ();
-
-		// The save game list doesn't forward all item changes, so also call the full update.
-		m_saveGameList->update ();
-	}
-}
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-bool MainMenu::onLoginToOnlineService ( const CEGUI::EventArgs& evt )
-{
-	if(!m_userLoggedIn)
-	    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->show();
-    else
-        OnlineServicesManager::getSingleton().logout();
-
-    return true;
-}
-
-bool MainMenu::onLoginDialogLoginButton ( const CEGUI::EventArgs& evt )
-{
-    if(!m_userLoggedIn)
-    {
-        static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->show();
-        CEGUI::String username = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/UsernameEditbox"))->getText();
-        CEGUI::String pw = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/PasswordEditbox"))->getText();
-		static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/PasswordEditbox"))->setText("");
-        OnlineServicesManager::getSingleton().login(username.c_str(), pw.c_str());
-    }
-
-	return true;
-}
-
-
-bool MainMenu::onLoginDialogCancelButton ( const CEGUI::EventArgs& evt )
-{
-    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->hide();
-	return true;
-}
-
-void MainMenu::onLoginFinished(std::vector<OnlineServicesManager::CharacterLite*> &characters)
-{
-    std::vector<OnlineServicesManager::CharacterLite*>::iterator iter;
-    for(iter = characters.begin(); iter != characters.end(); iter++)
-        std::cout << (*iter)->name << std::endl;
-
-    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->hide();
-    //static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginButton/Label"))->setText((CEGUI::utf8*) gettext("Logout"));
-    std::string username = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/UsernameEditbox"))->getText().c_str();
-    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("SumwarsOnlineIndicatorLabel"))->setText((CEGUI::utf8*) (gettext("Logged in as: ") + username).c_str());
-    m_userLoggedIn = true;
-    m_saveGameList->update();
-
-}
-
-void MainMenu::onLogoutFinished()
-{
-    //static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginButton/Label"))->setText((CEGUI::utf8*) gettext("Login"));
-    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("SumwarsOnlineIndicatorLabel"))
-            ->setText((CEGUI::utf8*) gettext("Not logged in."));
-	m_userLoggedIn = false;
-    m_saveGameList->update();
-}
-
-void MainMenu::onSyncCharFinished()
-{
-    DEBUGX("Character sync finished");
-}
-
-#endif
-
-bool MainMenu::onStartSinglePlayer(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonStartSinglePlayer();
-    return true;
-}
-
-bool MainMenu::onStartMultiPlayer(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonJoinGame();
-    return true;
-}
-
-bool MainMenu::onStartMultiPlayerHost(const CEGUI::EventArgs& evt)
-{
-    m_document->onButtonHostGame();
-    return true;
-}
-
-bool MainMenu::onShowCredits(const CEGUI::EventArgs& evt)
-{
-    m_document->onButtonCredits();
-    return true;
-}
-
-bool MainMenu::onShown( const CEGUI::EventArgs& evt )
-{
-	Ogre::Root *root = Ogre::Root::getSingletonPtr();
-    if (!m_sceneCreated)
-	{
-        createScene();
-		m_gameCamera = root->getAutoCreatedWindow()->getViewport(0)->getCamera();
-		
-		// we need a scene to display the character, so set the savegame now
-		m_saveGameList->selectDefaultSavegame();
-	}
-	m_saveGameList->update();
-
-	root->getAutoCreatedWindow()->getViewport(0)->setCamera(m_mainMenuCamera);
-    root->addFrameListener(this);
-	
-    CEGUI::WindowManager::getSingleton().getWindow("MainMenu")->setAlpha(0);
-    return true;
-}
-
-bool MainMenu::onHidden( const CEGUI::EventArgs& evt )
-{
-	Ogre::Root *root = Ogre::Root::getSingletonPtr();
-    if (m_sceneCreated)
-	{
-		root->getAutoCreatedWindow()->getViewport(0)->setCamera(m_gameCamera);
-	}
-    CEGUI::WindowManager::getSingleton().getWindow("MainMenu")->setAlpha(1);
-
-    root->removeFrameListener(this);
-	
-    return true;
-}
-
-void MainMenu::updateSaveGameList()
-{
-	m_saveGameList->update();
-}
-
-void MainMenu::setSavegameListVisible(bool show)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::FrameWindow* savegameList = (CEGUI::FrameWindow*) win_mgr.getWindow("SaveGameSelectionFrame");
-	if (savegameList->isVisible() != show)
-	{
-		savegameList->setVisible(show);
-		// hide/show some buttons along with savegamelist
-		win_mgr.getWindow("SinglePlayerButton")->setVisible(show);
-		win_mgr.getWindow("ServerJoinButton")->setVisible(show);
-		win_mgr.getWindow("ServerHostButton")->setVisible(show);
-		
-		if (show == true)
-		{
-			m_saveGameList->update();
-		}
-	}
-}
-
-
-bool MainMenu::onShowOptions(const CEGUI::EventArgs& evt)
-{
-    m_document->onButtonOptionsClicked();
-    return true;
-}
-
-
-bool MainMenu::onQuitGameHost(const CEGUI::EventArgs& evt)
-{
-    m_document->onButtonSaveExitClicked();
-    return true;
-}
-
-
-
-bool MainMenu::frameStarted(const Ogre::FrameEvent& evt)
-{
-    
-	/*m_mainMenuCamera->setPosition(Ogre::Vector3(0,0,-0.6)+m_mainMenuCamera->getPosition());
-	std::stringstream ss;
-    ss << "V3: " << m_mainMenuCamera->getPosition().x << " " << m_mainMenuCamera->getPosition().y << " " << m_mainMenuCamera->getPosition().z << " " << std::endl;
-	Ogre::LogManager::getSingleton().logMessage(Ogre::LML_NORMAL, ss.str().c_str());
-	*/
-	return Ogre::FrameListener::frameStarted(evt);
-}
-
-
-bool MainMenu::frameEnded(const Ogre::FrameEvent& evt)
-{
-	/*
-	if(m_sceneMgr)
-		m_sceneMgr->getEntity("MainMenuZombie")->getAnimationState("zombieWalk")->addTime(evt.timeSinceLastFrame);
-	*/
-    return Ogre::FrameListener::frameEnded(evt);
-}
-
-void MainMenu::createScene()
-{
-    if (!m_sceneCreated)
-    {
-
-		
-        m_mainNode = m_sceneMgr->getRootSceneNode()->createChildSceneNode("MainMenuMainNode");
-        m_mainNode->setPosition(Ogre::Vector3::ZERO);
-
-		m_mainMenuCamera->setPosition(Ogre::Vector3(-12.2126, 0.597, -14.1));
-		m_mainMenuCamera->lookAt(Ogre::Vector3::ZERO);
-		m_mainMenuCamera->setOrientation(Ogre::Quaternion(0.986127f, 0.120615f, -0.1132f, 0.0138457f));
-
-		Ogre::SceneNode *n = m_mainNode->createChildSceneNode();
-		Ogre::Entity *e;
-		//Ogre::MeshPtr *m; // 2011.10.23: found as unused.
-		Ogre::ParticleSystem *p;
-		Ogre::Light *l;
-
-		m_sceneMgr->setAmbientLight(Ogre::ColourValue(0.1, 0.1, 0.3, 2));
-
-
-		l = m_sceneMgr->createLight("mainMen_MoonLight");
-		l->setType(Ogre::Light::LT_POINT);
-		l->setPosition(Ogre::Vector3(0.929331, 16.9939, -29.9981));
-		l->setDirection(0, 0, 1);
-		l->setAttenuation(100, 0.2, 0.8, 0);
-		l->setCastShadows(true);
-		l->setDiffuseColour(Ogre::ColourValue(1, 1, 1, 1));
-		l->setSpecularColour(Ogre::ColourValue(0.45098, 0.45098, 0.47451, 1));
-		l->setPowerScale(1);
-
-		l = m_sceneMgr->createLight("mainMen_FireLight1");
-		l->setType(Ogre::Light::LT_POINT);
-		l->setPosition(Ogre::Vector3(-10.5044, 0.121838, -21.5031));
-		l->setDirection(0, 0, 1);
-		l->setAttenuation(100, 0.5, 0.02, 0.008);
-		l->setCastShadows(false);
-		l->setDiffuseColour(Ogre::ColourValue(0.443137, 0.215686, 0.145098, 1));
-		l->setSpecularColour(Ogre::ColourValue(0.407843, 0.176471, 0.0588235, 1));
-		l->setPowerScale(3);
-
-		
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("long_sw.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-13.7902, 0.0892202, -24.5334));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.852776, 0.413687, 0.248387, -0.199852));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("gold.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.4538, 0.990349, -26.0507));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("leathArm.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-12.9917, -0.00965142, -23.8061));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.985556, 0, 0.16935, 0));
-		
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("heal_2.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-11.8726, 0.990349, -25.4361));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("heal_1.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-12.286, 0.990349, -25.537));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("box_m3.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-12.0797, -0.00965118, -25.5948));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.998848, 0, 0.0479781, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("box_m2.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-12.3237, -0.00965214, -28.5043));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.975342, 0, 0.220697, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("box_m2.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.4654, -0.00965118, -26.1655));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.992546, 0, -0.121869, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("buckler.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-13.3333, 0.356877, -25.1495));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.928377, 0.304607, 0.111193, -0.181566));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("campFire.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.4943, -0.00965166, -21.3849));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("tree4.mesh");
-		e->getSubEntity(0)->setMaterialName("env_blaetter");
-		e->getSubEntity(1)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-1.38935, -0.00965309, -32.0907));
-		n->setScale(Ogre::Vector3(2.55586, 2.41194, 2.55586));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("chestBox.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-15.4144, -0.00964898, -22.8803));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.598323, 4.69282e-006, 0.801255, 2.4053e-006));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stool_konz.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-8.98199, -0.00965166, -21.4096));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stool_konz.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-8.39954, -0.00965166, -26.3683));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("chestLid.mesh");
-		e->getSubEntity(0)->setMaterialName("gimcrack");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-15.5435, 0.746074, -23.2522));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.374504, -0.624886, 0.501524, -0.466624));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones3.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.5055, -0.00965118, -27.8262));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.743145, 0, -0.669131, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("tree3.mesh");
-		e->getSubEntity(0)->setMaterialName("env_blaetter");
-		e->getSubEntity(1)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-23.2304, -0.00965118, -34.9225));
-		n->setScale(Ogre::Vector3(1.62948, 1.5, 1.62948));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("gobDog.mesh");
-		e->getSubEntity(0)->setMaterialName("Monster_Aisen");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-9.9569, -0.00965178, -24.6495));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.354291, 0, -0.935135, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("gold_rng.mesh");
-		e->getSubEntity(0)->setMaterialName("Item");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.1393, 0.990349, -25.7856));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-5.92453, -0.00965118, -29.1621));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-7.36273, -0.00965309, -28.5372));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-3.0643, -0.00965214, -45.8015));
-		n->setScale(Ogre::Vector3(5, 5, 5));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-6.39304, -0.00965166, -27.8417));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone_l1.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-16.307, -0.385546, -31.6074));
-		n->setScale(Ogre::Vector3(1, 1, 1.57439));
-		n->setOrientation(Ogre::Quaternion(0.963639, -0.000392383, -0.267202, 0.00166609));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stone_l1.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-4.65489, -0.00965118, -26.1386));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.995396, 0, -0.0958458, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones1.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-14.9308, 0, -31.1942));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.973379, 6.74019e-011, -0.2292, -2.41509e-010));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-20.6536, 0, -23.9446));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.973379, 6.74019e-011, -0.2292, -2.41509e-010));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones3.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-19.3292, 0, -24.7372));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(0.612217, 2.04367e-010, -0.790689, -1.4527e-010));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones3.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-10.1034, -0.00965118, -31.4112));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("stones3.mesh");
-		e->getSubEntity(0)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-6.93122, -0.00965214, -42.3686));
-		n->setScale(Ogre::Vector3(6, 6, 6));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("tree2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_blaetter");
-		e->getSubEntity(1)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-17.1033, -0.00965214, -38.6637));
-		n->setScale(Ogre::Vector3(1.30359, 1.2, 1.30359));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("tree4.mesh");
-		e->getSubEntity(0)->setMaterialName("env_blaetter");
-		e->getSubEntity(1)->setMaterialName("env_waldland");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-7.77576, -0.00965118, -37.878));
-		n->setScale(Ogre::Vector3(1.41222, 1.3, 1.41222));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		n = m_mainNode->createChildSceneNode();
-		e = m_sceneMgr->createEntity("vase2.mesh");
-		e->getSubEntity(0)->setMaterialName("env_konzil");
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-14.3816, -0.00965166, -23.7364));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		p = m_sceneMgr->createParticleSystem("mainMen_Particle#0","CampFire");
-		n = m_mainNode->createChildSceneNode();
-		n->attachObject(p);
-		n->setPosition(Ogre::Vector3(-10.5017, 0.150328, -21.4926));
-		n->setScale(Ogre::Vector3(1, 1, 1));
-		n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
-
-		Ogre::Plane plane0(Ogre::Vector3::UNIT_Y, 0);
-		Ogre::MeshManager::getSingletonPtr()->createPlane("mainMen_Plane#0", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane0, 10, 10, 6, 6 ,true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
-		e = m_sceneMgr->createEntity("mainMen_Plane#0");
-		e->setMaterialName("grass1");
-		n = m_mainNode->createChildSceneNode();
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-12.0042, -0.00965166, -29.7625));
-		n->setScale(Ogre::Vector3(5, 1, 5));
-		n->setOrientation(Ogre::Quaternion(0.418659, -1.48815e-010, -0.908144, -2.01801e-010));
-
-		Ogre::Plane plane1(Ogre::Vector3::UNIT_Y, 0);
-		Ogre::MeshManager::getSingletonPtr()->createPlane("mainMen_Plane#1", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane1, 10, 10, 6, 6 ,true, 1, 1, 1, Ogre::Vector3::UNIT_Z);
-		e = m_sceneMgr->createEntity("mainMen_Plane#1");
-		e->setMaterialName("env_nightsky");
-		n = m_mainNode->createChildSceneNode();
-		n->attachObject(e);
-		n->setPosition(Ogre::Vector3(-2.64068, 14.1513, -57.029));
-		n->setScale(Ogre::Vector3(5.8, 1, 4.83));
-		n->setOrientation(Ogre::Quaternion(0.248194, -0.15685, 0.597531, 0.74616));
-
-		m_sceneCreated = true;
-	}
-    
-}
-
-void MainMenu::updateCharacterView()
-{
-	bool update = false;
-	Ogre::SceneManager* scene_mgr = Ogre::Root::getSingleton().getSceneManager("MainMenuSceneManager");
-	GraphicManager::setSceneManager(scene_mgr);
-	
-	Player* pl = m_document->getLocalPlayer();
-
-	static Ogre::Timer actiontimer;
-	
-	if ((pl ==0 && m_savegame_player!=""))
-	{
-		DEBUGX("deleting inv player");
-		m_savegame_player="";
-		GraphicManager::destroyGraphicObject(m_savegame_player_object);
-		m_savegame_player_object =0;
-		update = true;
-	}
-
-	if (pl !=0)
-	{
-		std::string correctname = pl->getNameId();
-		correctname += pl->getPlayerLook().m_render_info;
-		
-		if ((correctname != m_savegame_player))
-		{
-            DEBUGX("updating inv player %s to %s",m_savegame_player.c_str(), correctname.c_str());
-			GraphicManager::destroyGraphicObject(m_savegame_player_object);
-			m_savegame_player_object =0;
-			update = true;
-		}
-		
-		m_savegame_player = correctname;
-		
-		if (m_savegame_player_object ==0)
-		{
-			update = true;
-			
-			GraphicObject::Type type = pl->getPlayerLook().m_render_info;
-			m_savegame_player_object = GraphicManager::createGraphicObject(type,pl->getNameId(), pl->getId());
-			
-			m_savegame_player_object->getTopNode()->setPosition(Ogre::Vector3(-9.27905, -0.0096519, -22.9244));
-			m_savegame_player_object->getTopNode()->setOrientation(Ogre::Quaternion(-0.190809, 0, 0.981627, 0));
-			m_savegame_player_object->setExactAnimations(true);
-		}
-		
-		update |= Scene::updatePlayerGraphicObject(m_savegame_player_object,pl);
-	}	
-	
-	if (m_savegame_player_object !=0)
-	{
-		// set action for the renderer call
-		Action actsave = *(pl->getAction());
-		
-		float frametime = actiontimer.getMicroseconds ()/1000.0;
-		m_savegame_player_action.m_elapsed_time += frametime;
-		if (m_savegame_player_action.m_elapsed_time > m_savegame_player_action.m_time)
-		{
-			// determine new action
-			if (m_savegame_player_action.m_type != "noaction")
-			{
-				// never play to actions directly after each other
-				m_savegame_player_action.m_type = "noaction";
-				m_savegame_player_action.m_time = pl->getActionTime(m_savegame_player_action.m_type);
-			}
-			else
-			{
-				m_savegame_player_action.m_type = "noaction";
-				
-				// get a random action
-				if (Random::random() < 0.5)
-				{
-					std::map<std::string, AbilityInfo>::iterator it;
-					std::map<std::string, AbilityInfo>& abl = pl->getBaseAttrMod()->m_abilities;
-					int abl_found = 0;
-					for (it = abl.begin(); it != abl.end(); ++it)
-					{
-						if (it->first == "noaction" || it->first == "die" || it->first == "walk" || it->first == "dead" 
-							|| it->first == "take_item" || it->first == "use" || it->first == "speak" || it->first == "trade")
-							continue;
-						
-						Action::ActionInfo* aci2 = Action::getActionInfo(it->first);
-						if (aci2->m_target_type == Action::PASSIVE)
-							continue;
-							
-						abl_found++;
-						
-						if (Random::randi(abl_found) == 0)
-						{
-							m_savegame_player_action.m_type = it->first;
-						}
-					}
-				}
-				
-				// determine time of the action
-				m_savegame_player_action.m_time = pl->getActionTime(m_savegame_player_action.m_type);
-				
-				// apply attack speed
-				Action::ActionType baseact = "noaction";
-				Action::ActionInfo* ainfo = Action::getActionInfo(m_savegame_player_action.m_type);
-				if (ainfo != 0)
-				{
-					baseact = ainfo->m_base_action;
-				}
-				
-				if (baseact == "attack" || baseact == "range_attack" || baseact == "holy_attack" || m_savegame_player_action.m_type == "magic_attack")
-				{
-					float atksp = MathHelper::Min((short) 5000,pl->getBaseAttrMod()->m_attack_speed);
-					m_savegame_player_action.m_time *= 1000000/atksp;
-				}
-				
-				// reduce speed (just looks better :P )
-				m_savegame_player_action.m_time *= 1.3;
-			}
-			m_savegame_player_action.m_elapsed_time = 0;
-		}
-		
-		pl->setAction(m_savegame_player_action);
-		std::string act = pl->getActionString();
-		float perc = m_savegame_player_action.m_elapsed_time / m_savegame_player_action.m_time;
-		
-		m_savegame_player_object->updateAction(act,perc);
-		m_savegame_player_object->update(0);
-		
-		pl->setAction(actsave);
-	}
-	actiontimer.reset();
-}
-
-void MainMenu::createSavegameList()
-{
-    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-    // Select the frame for the saved games in the menu
-	CEGUI::FrameWindow* savegameList = (CEGUI::FrameWindow*) win_mgr.getWindow("SaveGameSelectionFrame");
-    savegameList->setInheritsAlpha(false);
-
-	SavegameList* sgl = new SavegameList (m_document, m_ceguiSkinName);
-    m_saveGameList = sgl;
-
-    savegameList->addChildWindow(m_saveGameList->getCEGUIWindow());
-    m_saveGameList->update();
-    m_saveGameList->updateTranslation();
-
-	// TODO: this implementation is really wacky... not consistent with the rest.
-	// Will need to bring the entire implementation to a common base.
-    MessageQuestionWindow * delchar = new MessageQuestionWindow (m_document,
-		std::string ("messagequestionwindow.layout"), 
-		std::string (gettext("Really delete savegame?")),
-		std::string (gettext("Yes")),
-		CEGUI::Event::Subscriber(&SavegameList:: onDeleteCharConfirmClicked, m_saveGameList),
-		std::string (gettext("No")),
-		CEGUI::Event::Subscriber(&SavegameList::onDeleteCharAbortClicked, m_saveGameList));
-
-    m_window->addChildWindow(delchar->getCEGUIWindow());
-
-}
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "OgreEntity.h"
+#include "mainmenu.h"
+#include <OgreRenderWindow.h>
+#include <OgreSubEntity.h>
+#include <OgreMeshManager.h>
+#include <OgreParticleSystem.h>
+#include "listitem.h"
+#include "savegamelist.h"
+#include "messageboxes.h"
+#include "graphicmanager.h"
+#include "scene.h"
+#include "version.h"
+
+#include <iostream>
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+// Allow the use of the sound manager.
+#include "gussound.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+using gussound::SoundManager;
+
+
+MainMenu::MainMenu (Document* doc, const std::string& ceguiSkinName)
+        : Window (doc)
+		, m_ceguiSkinName (ceguiSkinName)
+		, m_starMenuRoot (0)
+{
+	SW_DEBUG ("MainMenu created");
+
+	m_savegame_player ="";
+	m_savegame_player_object =0;
+	
+	m_savegame_player_action.m_type = "noaction";
+	m_savegame_player_action.m_time = 2000;
+	m_savegame_player_action.m_elapsed_time = 0;
+	
+	
+    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+#if 0
+	// Load the holder (this should be aspect ratio dependent).
+	CEGUI::Window* main_menu_holder = CEGUIUtility::loadLayoutFromFile ("mainmenu_holder.layout");
+	if (!main_menu_holder)
+	{
+		WARNING ("WARNING: Failed to load [%s]", "mainmenu_holder.layout");
+	}
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (main_menu_holder, "MainMenu_Holder");
+#endif
+	// Load the main menu (will be aspect ratio independent)
+	m_starMenuRoot = CEGUIUtility::loadLayoutFromFile ("mainmenu.layout");
+	if (!m_starMenuRoot)
+	{
+		WARNING ("WARNING: Failed to load [%s]", "mainmenu.layout");
+	}
+	CEGUI::Window* wndHeld = CEGUIUtility::getWindowForLoadedLayoutEx (m_starMenuRoot, "MainMenuRoot");
+
+	SW_DEBUG ("Placing layout into holder");
+	m_starMenuRoot->setVisible (true);
+
+#if 0
+	main_menu_holder->setVisible (true);
+
+	if (wndHolder && wndHeld)
+	{
+		CEGUIUtility::addChildWidget (wndHolder, wndHeld);
+	}
+	else
+	{
+		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for main menu.");
+		if (!wndHeld) DEBUG ("ERROR: Unable to get the window for main menu.");
+	}
+#endif
+
+	//m_window = main_menu_holder;
+    m_window = m_starMenuRoot;// Augustin Preda, 2014.01.08: switched main window to the holder.
+
+	// Augustin Preda, 2014.01.12: Please revise this. This is highly dependent on internal workings of the CEGUI lib.
+	// As it seems there have been some recent changes, this led to the callback not being triggered as expected.
+	m_window->setMousePassThroughEnabled(true);
+    m_window->subscribeEvent(CEGUI::Window::EventShown, CEGUI::Event::Subscriber(&MainMenu::onShown, this));
+    m_window->subscribeEvent(CEGUI::Window::EventHidden, CEGUI::Event::Subscriber(&MainMenu::onHidden, this));
+
+    // Button for a single-player game
+	std::string widgetName (CEGUIUtility::getNameForWidget("SinglePlayerButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartSinglePlayer, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+	// Button used for joining a (remote) server.
+	widgetName = CEGUIUtility::getNameForWidget("ServerJoinButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartMultiPlayer, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+    // Button used for hosting a multiplayer game (creating the server)
+	widgetName = CEGUIUtility::getNameForWidget("ServerHostButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onStartMultiPlayerHost, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+    // Button used for accessing the game's credits
+	widgetName = CEGUIUtility::getNameForWidget("CreditsButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onShowCredits, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+    // Button used for accessing the game's options
+	widgetName = CEGUIUtility::getNameForWidget("MainOptionsButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onShowOptions, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+    // Button used for exiting the game
+	widgetName = CEGUIUtility::getNameForWidget("EndGameButton");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onQuitGameHost, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&MainMenu::onMainMenuButtonHover, this));
+	}
+
+	CEGUI::Window* verlbl;
+
+	widgetName = CEGUIUtility::getNameForWidget("SumwarsVersionLabel");
+	verlbl = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (verlbl)
+	{
+		verlbl->setText(CEGUI::String("Version: ").append(SUMWARS_VERSION));
+		SW_DEBUG ("Set sumwars version text to : [%s]", verlbl->getText ().c_str ());
+	}
+
+	CEGUI::FrameWindow* lbl;
+
+
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginButton"));
+    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginToOnlineService, this));
+
+    CEGUI::FrameWindow* login_dialog = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout( "LoginDialog.layout" );
+    m_window->addChildWindow(login_dialog);
+	login_dialog->hide();
+
+    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginDialog/LoginButton"));
+    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginDialogLoginButton, this));
+
+    btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("LoginDialog/CancelButton"));
+    btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenu::onLoginDialogCancelButton, this));
+
+    OnlineServicesManager::getSingleton().registerLoginStatusListener(this);
+#else
+	widgetName = CEGUIUtility::getNameForWidget("SumwarsOnlineIndicatorLabel");
+    lbl = static_cast<CEGUI::FrameWindow*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+    lbl->hide();
+
+	widgetName = CEGUIUtility::getNameForWidget("LoginButton");
+    btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+    btn->hide();
+#endif
+
+	Ogre::Root *root = Ogre::Root::getSingletonPtr();
+	m_sceneMgr = root->createSceneManager(Ogre::ST_GENERIC, "MainMenuSceneManager");
+	m_mainMenuCamera = m_sceneMgr->createCamera("MainMenuCamera");
+	m_mainMenuCamera->setNearClipDistance(0.1f);
+	m_mainMenuCamera->setFarClipDistance(10000);
+
+    m_sceneCreated = false;
+    m_userLoggedIn = false;
+
+    createSavegameList();
+
+    updateTranslation();
+}
+
+
+void MainMenu::update()
+{
+	updateCharacterView();
+}
+
+
+void MainMenu::updateTranslation()
+{
+    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	CEGUI::Window* widget;
+
+	// Update the button labels.
+
+	std::string widgetName (CEGUIUtility::getNameForWidget("SinglePlayerButton"));
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Single player"));
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("ServerJoinButton");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Join game"));
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("ServerHostButton");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Host game"));
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("CreditsButton");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Credits"));
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("MainOptionsButton");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Options"));
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("EndGameButton");
+	widget = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName);
+	if (widget)
+	{
+		widget->setText((CEGUI::utf8*) gettext("Quit"));
+	}
+
+
+	// Update message windows
+	//CEGUI::FrameWindow* lbl;
+	//lbl = static_cast<CEGUI::FrameWindow*>(CEGUIUtility::getWindow ("DeleteCharLabel")); // note: this has no in-between slash!
+	//if (lbl) lbl->setText((CEGUI::utf8*) gettext("Really delete savegame?"));
+
+	// Propagation onto sub-windows
+	if (m_saveGameList != 0)
+	{
+		m_saveGameList->updateTranslation ();
+
+		// The save game list doesn't forward all item changes, so also call the full update.
+		m_saveGameList->update ();
+	}
+}
+
+
+/**
+ * \fn bool onMainMenuButtonHover(const CEGUI::EventArgs& evt)
+ * \brief Handle the hovering of a button in the main menu
+ */
+bool MainMenu::onMainMenuButtonHover (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+bool MainMenu::onLoginToOnlineService ( const CEGUI::EventArgs& evt )
+{
+	if(!m_userLoggedIn)
+	    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->show();
+    else
+        OnlineServicesManager::getSingleton().logout();
+
+    return true;
+}
+
+bool MainMenu::onLoginDialogLoginButton ( const CEGUI::EventArgs& evt )
+{
+    if(!m_userLoggedIn)
+    {
+        static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->show();
+        CEGUI::String username = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/UsernameEditbox"))->getText();
+        CEGUI::String pw = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/PasswordEditbox"))->getText();
+		static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/PasswordEditbox"))->setText("");
+        OnlineServicesManager::getSingleton().login(username.c_str(), pw.c_str());
+    }
+
+	return true;
+}
+
+
+bool MainMenu::onLoginDialogCancelButton ( const CEGUI::EventArgs& evt )
+{
+    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->hide();
+	return true;
+}
+
+void MainMenu::onLoginFinished(std::vector<OnlineServicesManager::CharacterLite*> &characters)
+{
+    std::vector<OnlineServicesManager::CharacterLite*>::iterator iter;
+    for(iter = characters.begin(); iter != characters.end(); iter++)
+        std::cout << (*iter)->name << std::endl;
+
+    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog"))->hide();
+    //static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginButton/Label"))->setText((CEGUI::utf8*) gettext("Logout"));
+    std::string username = static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginDialog/UsernameEditbox"))->getText().c_str();
+    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("SumwarsOnlineIndicatorLabel"))->setText((CEGUI::utf8*) (gettext("Logged in as: ") + username).c_str());
+    m_userLoggedIn = true;
+    m_saveGameList->update();
+
+}
+
+void MainMenu::onLogoutFinished()
+{
+    //static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("LoginButton/Label"))->setText((CEGUI::utf8*) gettext("Login"));
+    static_cast<CEGUI::FrameWindow*>(CEGUI::WindowManager::getSingleton().getWindow("SumwarsOnlineIndicatorLabel"))
+            ->setText((CEGUI::utf8*) gettext("Not logged in."));
+	m_userLoggedIn = false;
+    m_saveGameList->update();
+}
+
+void MainMenu::onSyncCharFinished()
+{
+    DEBUGX("Character sync finished");
+}
+
+#endif
+
+
+bool MainMenu::onStartSinglePlayer(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+	m_document->onButtonStartSinglePlayer();
+    return true;
+}
+
+bool MainMenu::onStartMultiPlayer(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+	m_document->onButtonJoinGame();
+    return true;
+}
+
+bool MainMenu::onStartMultiPlayerHost(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+    m_document->onButtonHostGame();
+    return true;
+}
+
+bool MainMenu::onShowCredits(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+    m_document->onButtonCredits();
+    return true;
+}
+
+bool MainMenu::onShown( const CEGUI::EventArgs& evt )
+{
+	SW_DEBUG ("Main menu shown");
+	Ogre::Root *root = Ogre::Root::getSingletonPtr();
+    if (!m_sceneCreated)
+	{
+        createScene();
+		m_gameCamera = root->getAutoCreatedWindow()->getViewport(0)->getCamera();
+		
+		// we need a scene to display the character, so set the savegame now
+		m_saveGameList->selectDefaultSavegame();
+	}
+	m_saveGameList->update();
+
+	root->getAutoCreatedWindow()->getViewport(0)->setCamera(m_mainMenuCamera);
+    root->addFrameListener(this);
+	
+	CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "MainMenuRoot")->setAlpha(0);
+
+	// Also switch to the menu's playlist.
+	try
+	{
+		SoundManager::getPtr ()->getMusicPlayer ()->switchToPlaylist ("menu");
+	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Encountered error while trying to switch to the menu playlist: %s", e.what ());
+	}
+    return true;
+}
+
+bool MainMenu::onHidden( const CEGUI::EventArgs& evt )
+{
+	SW_DEBUG ("Main menu hidden");
+	Ogre::Root *root = Ogre::Root::getSingletonPtr();
+    if (m_sceneCreated)
+	{
+		root->getAutoCreatedWindow()->getViewport(0)->setCamera(m_gameCamera);
+	}
+	CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "MainMenuRoot")->setAlpha(1);
+
+    root->removeFrameListener(this);
+	
+    return true;
+}
+
+void MainMenu::updateSaveGameList()
+{
+	m_saveGameList->update();
+}
+
+void MainMenu::setSavegameListVisible(bool show)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::FrameWindow* savegameList = (CEGUI::FrameWindow*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "SaveGameSelectionFrame");
+	if (savegameList->isVisible() != show)
+	{
+		savegameList->setVisible(show);
+		// hide/show some buttons along with savegamelist
+		CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "SinglePlayerButton")->setVisible(show);
+		CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ServerJoinButton")->setVisible(show);
+		CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ServerHostButton")->setVisible(show);
+		
+		if (show == true)
+		{
+			m_saveGameList->update();
+		}
+	}
+}
+
+
+bool MainMenu::onShowOptions(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+    m_document->onButtonOptionsClicked();
+    return true;
+}
+
+
+bool MainMenu::onQuitGameHost(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+    m_document->onButtonSaveExitClicked();
+    return true;
+}
+
+
+
+bool MainMenu::frameStarted(const Ogre::FrameEvent& evt)
+{
+    
+	/*m_mainMenuCamera->setPosition(Ogre::Vector3(0,0,-0.6)+m_mainMenuCamera->getPosition());
+	std::stringstream ss;
+    ss << "V3: " << m_mainMenuCamera->getPosition().x << " " << m_mainMenuCamera->getPosition().y << " " << m_mainMenuCamera->getPosition().z << " " << std::endl;
+	Ogre::LogManager::getSingleton().logMessage(Ogre::LML_NORMAL, ss.str().c_str());
+	*/
+	return Ogre::FrameListener::frameStarted(evt);
+}
+
+
+bool MainMenu::frameEnded(const Ogre::FrameEvent& evt)
+{
+	/*
+	if(m_sceneMgr)
+		m_sceneMgr->getEntity("MainMenuZombie")->getAnimationState("zombieWalk")->addTime(evt.timeSinceLastFrame);
+	*/
+    return Ogre::FrameListener::frameEnded(evt);
+}
+
+void MainMenu::createScene()
+{
+    if (!m_sceneCreated)
+    {
+		try
+		{
+			m_mainNode = m_sceneMgr->getRootSceneNode()->createChildSceneNode("MainMenuMainNode");
+			m_mainNode->setPosition(Ogre::Vector3::ZERO);
+
+			m_mainMenuCamera->setPosition(Ogre::Vector3(-12.2126, 0.597, -14.1));
+			m_mainMenuCamera->lookAt(Ogre::Vector3::ZERO);
+			m_mainMenuCamera->setOrientation(Ogre::Quaternion(0.986127f, 0.120615f, -0.1132f, 0.0138457f));
+
+			Ogre::SceneNode *n = m_mainNode->createChildSceneNode();
+			Ogre::Entity *e;
+			Ogre::MeshPtr ptrMesh; // 2014.01.12: re-added.
+			Ogre::ParticleSystem *p;
+			Ogre::Light *l;
+
+			m_sceneMgr->setAmbientLight(Ogre::ColourValue(0.1, 0.1, 0.3, 2));
+
+
+			l = m_sceneMgr->createLight("mainMen_MoonLight");
+			l->setType(Ogre::Light::LT_POINT);
+			l->setPosition(Ogre::Vector3(0.929331, 16.9939, -29.9981));
+			l->setDirection(0, 0, 1);
+			l->setAttenuation(100, 0.2, 0.8, 0);
+			l->setCastShadows(true);
+			l->setDiffuseColour(Ogre::ColourValue(1, 1, 1, 1));
+			l->setSpecularColour(Ogre::ColourValue(0.45098, 0.45098, 0.47451, 1));
+			l->setPowerScale(1);
+
+			l = m_sceneMgr->createLight("mainMen_FireLight1");
+			l->setType(Ogre::Light::LT_POINT);
+			l->setPosition(Ogre::Vector3(-10.5044, 0.121838, -21.5031));
+			l->setDirection(0, 0, 1);
+			l->setAttenuation(100, 0.5, 0.02, 0.008);
+			l->setCastShadows(false);
+			l->setDiffuseColour(Ogre::ColourValue(0.443137, 0.215686, 0.145098, 1));
+			l->setSpecularColour(Ogre::ColourValue(0.407843, 0.176471, 0.0588235, 1));
+			l->setPowerScale(3);
+
+			Ogre::NameGenerator localNameGen ("SWMO");
+		
+			ptrMesh = Ogre::MeshManager::getSingletonPtr ()->load ("long_sw.mesh", "General");
+			n = m_mainNode->createChildSceneNode();
+			//e = m_sceneMgr->createEntity (Ogre::String ("long_mesh_01"), Ogre::String ("this_does_not_exist.mesh"));
+			e = m_sceneMgr->createEntity (localNameGen.generate (), "long_sw.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-13.7902, 0.0892202, -24.5334));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.852776, 0.413687, 0.248387, -0.199852));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("gold.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.4538, 0.990349, -26.0507));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("leathArm.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-12.9917, -0.00965142, -23.8061));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.985556, 0, 0.16935, 0));
+		
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("heal_2.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-11.8726, 0.990349, -25.4361));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("heal_1.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-12.286, 0.990349, -25.537));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("box_m3.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-12.0797, -0.00965118, -25.5948));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.998848, 0, 0.0479781, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("box_m2.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-12.3237, -0.00965214, -28.5043));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.975342, 0, 0.220697, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("box_m2.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.4654, -0.00965118, -26.1655));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.992546, 0, -0.121869, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("buckler.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-13.3333, 0.356877, -25.1495));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.928377, 0.304607, 0.111193, -0.181566));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("campFire.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.4943, -0.00965166, -21.3849));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("tree4.mesh");
+			e->getSubEntity(0)->setMaterialName("env_blaetter");
+			e->getSubEntity(1)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-1.38935, -0.00965309, -32.0907));
+			n->setScale(Ogre::Vector3(2.55586, 2.41194, 2.55586));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("chestBox.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-15.4144, -0.00964898, -22.8803));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.598323, 4.69282e-006, 0.801255, 2.4053e-006));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stool_konz.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-8.98199, -0.00965166, -21.4096));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stool_konz.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-8.39954, -0.00965166, -26.3683));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("chestLid.mesh");
+			e->getSubEntity(0)->setMaterialName("gimcrack");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-15.5435, 0.746074, -23.2522));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.374504, -0.624886, 0.501524, -0.466624));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones3.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.5055, -0.00965118, -27.8262));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.743145, 0, -0.669131, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("tree3.mesh");
+			e->getSubEntity(0)->setMaterialName("env_blaetter");
+			e->getSubEntity(1)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-23.2304, -0.00965118, -34.9225));
+			n->setScale(Ogre::Vector3(1.62948, 1.5, 1.62948));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("gobDog.mesh");
+			e->getSubEntity(0)->setMaterialName("Monster_Aisen");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-9.9569, -0.00965178, -24.6495));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.354291, 0, -0.935135, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("gold_rng.mesh");
+			e->getSubEntity(0)->setMaterialName("Item");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.1393, 0.990349, -25.7856));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-5.92453, -0.00965118, -29.1621));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-7.36273, -0.00965309, -28.5372));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-3.0643, -0.00965214, -45.8015));
+			n->setScale(Ogre::Vector3(5, 5, 5));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-6.39304, -0.00965166, -27.8417));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone_l1.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-16.307, -0.385546, -31.6074));
+			n->setScale(Ogre::Vector3(1, 1, 1.57439));
+			n->setOrientation(Ogre::Quaternion(0.963639, -0.000392383, -0.267202, 0.00166609));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stone_l1.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-4.65489, -0.00965118, -26.1386));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.995396, 0, -0.0958458, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones1.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-14.9308, 0, -31.1942));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.973379, 6.74019e-011, -0.2292, -2.41509e-010));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-20.6536, 0, -23.9446));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.973379, 6.74019e-011, -0.2292, -2.41509e-010));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones3.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-19.3292, 0, -24.7372));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(0.612217, 2.04367e-010, -0.790689, -1.4527e-010));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones3.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-10.1034, -0.00965118, -31.4112));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("stones3.mesh");
+			e->getSubEntity(0)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-6.93122, -0.00965214, -42.3686));
+			n->setScale(Ogre::Vector3(6, 6, 6));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("tree2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_blaetter");
+			e->getSubEntity(1)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-17.1033, -0.00965214, -38.6637));
+			n->setScale(Ogre::Vector3(1.30359, 1.2, 1.30359));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("tree4.mesh");
+			e->getSubEntity(0)->setMaterialName("env_blaetter");
+			e->getSubEntity(1)->setMaterialName("env_waldland");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-7.77576, -0.00965118, -37.878));
+			n->setScale(Ogre::Vector3(1.41222, 1.3, 1.41222));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			n = m_mainNode->createChildSceneNode();
+			e = m_sceneMgr->createEntity("vase2.mesh");
+			e->getSubEntity(0)->setMaterialName("env_konzil");
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-14.3816, -0.00965166, -23.7364));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			p = m_sceneMgr->createParticleSystem("mainMen_Particle#0","CampFire");
+			n = m_mainNode->createChildSceneNode();
+			n->attachObject(p);
+			n->setPosition(Ogre::Vector3(-10.5017, 0.150328, -21.4926));
+			n->setScale(Ogre::Vector3(1, 1, 1));
+			n->setOrientation(Ogre::Quaternion(1, 0, 0, 0));
+
+			Ogre::Plane plane0(Ogre::Vector3::UNIT_Y, 0);
+			Ogre::MeshManager::getSingletonPtr()->createPlane("mainMen_Plane#0", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane0, 10, 10, 6, 6 ,true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
+			e = m_sceneMgr->createEntity("mainMen_Plane#0");
+			e->setMaterialName("grass1");
+			n = m_mainNode->createChildSceneNode();
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-12.0042, -0.00965166, -29.7625));
+			n->setScale(Ogre::Vector3(5, 1, 5));
+			n->setOrientation(Ogre::Quaternion(0.418659, -1.48815e-010, -0.908144, -2.01801e-010));
+
+			Ogre::Plane plane1(Ogre::Vector3::UNIT_Y, 0);
+			Ogre::MeshManager::getSingletonPtr()->createPlane("mainMen_Plane#1", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane1, 10, 10, 6, 6 ,true, 1, 1, 1, Ogre::Vector3::UNIT_Z);
+			e = m_sceneMgr->createEntity("mainMen_Plane#1");
+			e->setMaterialName("env_nightsky");
+			n = m_mainNode->createChildSceneNode();
+			n->attachObject(e);
+			n->setPosition(Ogre::Vector3(-2.64068, 14.1513, -57.029));
+			n->setScale(Ogre::Vector3(5.8, 1, 4.83));
+			n->setOrientation(Ogre::Quaternion(0.248194, -0.15685, 0.597531, 0.74616));
+
+			m_sceneCreated = true;
+		}
+		catch (std::exception& e)
+		{
+			SW_DEBUG ("[MainMenu] Caught exception in scene creation: [%s]", e.what ());
+		}
+	}
+    
+}
+
+void MainMenu::updateCharacterView()
+{
+	bool update = false;
+	Ogre::SceneManager* scene_mgr = Ogre::Root::getSingleton().getSceneManager("MainMenuSceneManager");
+	GraphicManager::setSceneManager(scene_mgr);
+	
+	Player* pl = m_document->getLocalPlayer();
+
+	static Ogre::Timer actiontimer;
+	
+	if ((pl ==0 && m_savegame_player!=""))
+	{
+		DEBUGX("deleting inv player");
+		m_savegame_player="";
+		GraphicManager::destroyGraphicObject(m_savegame_player_object);
+		m_savegame_player_object =0;
+		update = true;
+	}
+
+	if (pl !=0)
+	{
+		std::string correctname = pl->getNameId();
+		correctname += pl->getPlayerLook().m_render_info;
+		
+		if ((correctname != m_savegame_player))
+		{
+			DEBUGX("updating inv player %s to %s",m_savegame_player.c_str(), correctname.c_str());
+			GraphicManager::destroyGraphicObject(m_savegame_player_object);
+			m_savegame_player_object =0;
+			update = true;
+		}
+		
+		m_savegame_player = correctname;
+		
+		if (m_savegame_player_object ==0)
+		{
+			update = true;
+			
+			GraphicObject::Type type = pl->getPlayerLook().m_render_info;
+			m_savegame_player_object = GraphicManager::createGraphicObject(type,pl->getNameId(), pl->getId());
+			
+			m_savegame_player_object->getTopNode()->setPosition(Ogre::Vector3(-9.27905, -0.0096519, -22.9244));
+			m_savegame_player_object->getTopNode()->setOrientation(Ogre::Quaternion(-0.190809, 0, 0.981627, 0));
+			m_savegame_player_object->setExactAnimations(true);
+		}
+		
+		update |= Scene::updatePlayerGraphicObject(m_savegame_player_object,pl);
+	}	
+	
+	if (m_savegame_player_object !=0)
+	{
+		// set action for the renderer call
+		Action actsave = *(pl->getAction());
+		
+		float frametime = actiontimer.getMicroseconds ()/1000.0;
+		m_savegame_player_action.m_elapsed_time += frametime;
+		if (m_savegame_player_action.m_elapsed_time > m_savegame_player_action.m_time)
+		{
+			// determine new action
+			if (m_savegame_player_action.m_type != "noaction")
+			{
+				// never play to actions directly after each other
+				m_savegame_player_action.m_type = "noaction";
+				m_savegame_player_action.m_time = pl->getActionTime(m_savegame_player_action.m_type);
+			}
+			else
+			{
+				m_savegame_player_action.m_type = "noaction";
+				
+				// get a random action
+				if (Random::random() < 0.5)
+				{
+					std::map<std::string, AbilityInfo>::iterator it;
+					std::map<std::string, AbilityInfo>& abl = pl->getBaseAttrMod()->m_abilities;
+					int abl_found = 0;
+					for (it = abl.begin(); it != abl.end(); ++it)
+					{
+						if (it->first == "noaction" || it->first == "die" || it->first == "walk" || it->first == "dead" 
+							|| it->first == "take_item" || it->first == "use" || it->first == "speak" || it->first == "trade")
+							continue;
+						
+						Action::ActionInfo* aci2 = Action::getActionInfo(it->first);
+						if (aci2->m_target_type == Action::PASSIVE)
+							continue;
+							
+						abl_found++;
+						
+						if (Random::randi(abl_found) == 0)
+						{
+							m_savegame_player_action.m_type = it->first;
+						}
+					}
+				}
+				
+				// determine time of the action
+				m_savegame_player_action.m_time = pl->getActionTime(m_savegame_player_action.m_type);
+				
+				// apply attack speed
+				Action::ActionType baseact = "noaction";
+				Action::ActionInfo* ainfo = Action::getActionInfo(m_savegame_player_action.m_type);
+				if (ainfo != 0)
+				{
+					baseact = ainfo->m_base_action;
+				}
+				
+				if (baseact == "attack" || baseact == "range_attack" || baseact == "holy_attack" || m_savegame_player_action.m_type == "magic_attack")
+				{
+					float atksp = MathHelper::Min((short) 5000,pl->getBaseAttrMod()->m_attack_speed);
+					m_savegame_player_action.m_time *= 1000000/atksp;
+				}
+				
+				// reduce speed (just looks better :P )
+				m_savegame_player_action.m_time *= 1.3;
+			}
+			m_savegame_player_action.m_elapsed_time = 0;
+		}
+		
+		pl->setAction(m_savegame_player_action);
+		std::string act = pl->getActionString();
+		float perc = m_savegame_player_action.m_elapsed_time / m_savegame_player_action.m_time;
+		
+		m_savegame_player_object->updateAction(act,perc);
+		m_savegame_player_object->update(0);
+		
+		pl->setAction(actsave);
+	}
+	actiontimer.reset();
+}
+
+void MainMenu::createSavegameList()
+{
+    CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+    // Select the frame for the saved games in the menu
+	std::string widgetName (CEGUIUtility::getNameForWidget("SaveGameSelectionFrame"));
+	CEGUI::FrameWindow* savegameList = static_cast<CEGUI::FrameWindow*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_starMenuRoot, widgetName));
+    savegameList->setInheritsAlpha(false);
+
+	SavegameList* sgl = new SavegameList (m_document, m_ceguiSkinName);
+    m_saveGameList = sgl;
+
+	CEGUIUtility::addChildWidget (savegameList, m_saveGameList->getCEGUIWindow());
+    m_saveGameList->update();
+    m_saveGameList->updateTranslation();
+
+	// TODO: this implementation is really wacky... not consistent with the rest.
+	// Will need to bring the entire implementation to a common base.
+    MessageQuestionWindow * delchar = new MessageQuestionWindow (m_document,
+		std::string ("messagequestionwindow.layout"), 
+		std::string (gettext("Really delete savegame?")),
+		std::string (gettext("Yes")),
+		CEGUI::Event::Subscriber(&SavegameList:: onDeleteCharConfirmClicked, m_saveGameList),
+		std::string (gettext("No")),
+		CEGUI::Event::Subscriber(&SavegameList::onDeleteCharAbortClicked, m_saveGameList));
+
+	CEGUIUtility::addChildWidget (m_window, delchar->getCEGUIWindow());
+}
--- a/src/gui/mainmenu.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/mainmenu.h	Thu Mar 20 19:04:28 2014 +0100
@@ -141,6 +141,12 @@
     void createSavegameList();
 
     /**
+     * \fn bool onMainMenuButtonHover(const CEGUI::EventArgs& evt)
+     * \brief Handle the hovering of a button in the main menu
+     */
+    bool onMainMenuButtonHover (const CEGUI::EventArgs& evt);
+
+	/**
      * \fn bool onStartSinglePlayer(const CEGUI::EventArgs& evt)
      * \brief Handles start of the SinglePlayer mode
      */
@@ -243,6 +249,11 @@
     SavegameList *m_saveGameList;
 	
 	/**
+	 * \brief The root CEGUI node of the start menu
+	 */
+	CEGUI::Window* m_starMenuRoot;
+
+	/**
 	 * \brief Name of the previewed savegame player 
 	 */
 	std::string m_savegame_player;
--- a/src/gui/mainwindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/mainwindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,2939 +1,2985 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "mainwindow.h"
-
-#include <string>
-#include <sstream>
-
-#include "gettext.h"
-#include "player.h"
-#include "graphicmanager.h"
-
-#include "charinfo.h"
-#include "controlpanel.h"
-#include "inventory.h"
-#include "skilltree.h"
-#include "mainmenu.h"
-#include "savegamelist.h"
-#include "chatline.h"
-#include "partyinfo.h"
-#include "charcreate.h"
-#include "questinfo.h"
-#include "minimapwindow.h"
-#include "tradewindow.h"
-#include "optionswindow.h"
-#include "networkwindows.h"
-#include "worldmap.h"
-#include "messageboxes.h"
-#include "dialoguewindow.h"
-#include "creditswindow.h"
-#include "music.h"
-#include "tooltipmanager.h"
-#include "ceguiutility.h"
-
-// Access the OS clipboard.
-#include "clipboard.h"
-
-#ifdef SUMWARS_BUILD_TOOLS
-#include "debugpanel.h"
-#include "contenteditor.h"
-#endif
-
-// Generic colour settings.
-#include "tooltipsettings.h"
-
-
-MainWindow::MainWindow(Ogre::Root* ogreroot, CEGUI::System* ceguisystem,Ogre::RenderWindow* window,Document* doc)
-{
-	m_ogre_root = ogreroot;
-	m_cegui_system = ceguisystem;
-	m_window = window;
-	m_document = doc;
-	m_scene_manager = m_ogre_root->getSceneManager("DefaultSceneManager");
-
-	// Initialisieren
-	bool res = init();
-	if (res==false)
-	{
-		ERRORMSG("GUI erzeugen fehlgeschlagen");
-	}
-	
-	m_key =0;
-	m_highlight_id =0;
-	m_ready_to_start = false;
-}
-
-bool MainWindow::init()
-{
-	bool result = true;
-
-	m_ceguiSkinName = Options::getInstance ()->getCeguiSkin ();
-	DEBUG ("Main Window (init): Cegui skin name found in options as: [%s]", m_ceguiSkinName.c_str ());
-
-	// Eingabegeraete initialisieren
-	result &= initInputs();
-
-	GraphicManager::init();
-
-	// Hauptmenue erzeugen
-	result &= setupMainMenu();
-
-	// Hauptspielfenster erzeugen
-	result &= setupGameScreen();
-
-	// Aktuelle Ebene setzen
-	CEGUI::System::getSingleton().setGUISheet(m_main_menu);
-
-	
-	return result;
-
-}
-
-
-MainWindow::~MainWindow()
-{
-	m_ois->destroyInputObject(m_mouse);
-	m_ois->destroyInputObject(m_keyboard);
-	OIS::InputManager::destroyInputSystem(m_ois);
-
-	// Dynamisch angelegte Objekte loeschen
-	delete m_scene;
-}
-
-bool MainWindow::initInputs()
-{
-	DEBUGX("init inputs");
-	OIS::ParamList pl;
-	// Handle fuer das aktuelle Fenster
-	unsigned long hWnd;
-	m_window->getCustomAttribute("WINDOW", &hWnd);
-	// OIS mitteilen fuer welches Fenster die Eingaben abgefangen werden sollen
-	pl.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
-
-	if(!Options::getInstance()->getGrabMouseInWindowedMode() && !m_window->isFullScreen())
-	{
-	#ifndef WIN32
-		pl.insert( std::make_pair(std::string("x11_mouse_grab"), std::string("false") ) );
-		pl.insert( std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
-	#else
-		pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
-		pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
-		pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
-		pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
-	#endif
-	}
-
-	m_ois = OIS::InputManager::createInputSystem( pl );
-
-	// Maus initialisieren
-	m_mouse = static_cast<OIS::Mouse*>(m_ois->createInputObject( OIS::OISMouse, true ));
-	m_mouse->setEventCallback(this);
-	m_mouse->getMouseState().width = (int) m_window->getWidth();
-	m_mouse->getMouseState().height = (int) m_window->getHeight();
-
-	// Tastatur initialisieren
-	m_keyboard = static_cast<OIS::Keyboard*>(m_ois->createInputObject( OIS::OISKeyboard, true));
-	m_keyboard->setEventCallback(this);
-	m_keyboard->setTextTranslation (OIS::Keyboard::Unicode);
-	return true;
-}
-
-
-bool MainWindow::setupMainMenu()
-{
-	try
-	{
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-		// Oberstes Fenster der Hauptmenue Schicht
-		m_main_menu = win_mgr.createWindow("DefaultWindow", "MainMenu");
-
-		CEGUI::Window* start_screen_holder = win_mgr.loadWindowLayout ("startscreen.layout");
-
-		if (start_screen_holder)
-		{
-			m_main_menu->addChildWindow (start_screen_holder);
-
-			if (win_mgr.isWindowPresent ("StartScreenImage"))
-			{
-				CEGUI::Window* temp = win_mgr.getWindow ("StartScreenImage");
-				temp->setMousePassThroughEnabled (true);
-			}
-			if (win_mgr.isWindowPresent ("StartScreenRoot"))
-			{
-				CEGUI::Window* temp = win_mgr.getWindow ("StartScreenRoot");
-				temp->setMousePassThroughEnabled (true);
-			}
-			if (win_mgr.isWindowPresent ("LoadRessourcesProgressBar"))
-			{
-				CEGUI::Window* temp = win_mgr.getWindow ("LoadRessourcesProgressBar");
-				temp->setMousePassThroughEnabled (true);
-			}
-		}
-		else
-		{
-			DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout");
-			// TODO: remove code when no longer needed - begin
-			CEGUI::Window* img;
-
-			img  = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "StartScreenImage");
-			m_main_menu->addChildWindow(img);
-			img->setProperty("Image", "set:SumWarsLogo.png image:full_image");
-			img->moveToBack ();
-			img->setProperty ("FrameEnabled", "False");
-			img->setMousePassThroughEnabled(true);
-		
-			CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.createWindow(CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ProgressBar"), "LoadRessourcesProgressBar"));
-			m_main_menu->addChildWindow(bar);
-			bar->setPosition(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.9f)));
-			bar->setSize(CEGUI::UVector2(cegui_reldim(0.70f), cegui_reldim( 0.04f)));
-			bar->setWantsMultiClickEvents(false);
-			bar->setProgress(0.0);
-			bar->setProperty ("GS_DarkerThemeColour", "FF005464");
-			bar->setProperty ("GS_LighterThemeColour", "FF13C6BC");
-			bar->setProperty ("GS_MainThemeColour", "FF13868B");
-			bar->setProperty ("GS_MainThemeGradientLeftToRight", "tl:00FFFFFF tr:FF13C6BC bl:00FFFFFF br:FF13C6BC");
-			// TODO: remove code when no longer needed - end
-		}
-		CreditsWindow* crd = new CreditsWindow (m_document, m_ceguiSkinName);
-		m_sub_windows["CreditsWindow"] = crd;
-		m_main_menu->addChildWindow(crd->getCEGUIWindow());
-
-		Window * wnd = new MainMenu(m_document, m_ceguiSkinName);
-		m_sub_windows["MainMenu"] = wnd;
-		m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-		
-		wnd = new CharCreate (m_document, m_ceguiSkinName);
-		m_sub_windows["CharCreate"] = wnd;
-		m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-		
-		wnd = new OptionsWindow(m_document,m_keyboard, m_ceguiSkinName);
-		m_sub_windows["Options"] = wnd;
-		m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-		
-		wnd = new HostGameWindow(m_document);
-		m_sub_windows["HostGame"] = wnd;
-		m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-		
-		wnd = new JoinGameWindow(m_document);
-		m_sub_windows["JoinGame"] = wnd;
-		m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-		
-	// Verbinden mit dem Document
-	}
-	catch (CEGUI::Exception & e)
-	{
-		ERRORMSG("Error message: %s",e.getMessage().c_str());
-	}
-	return true;
-}
-
-void MainWindow::update(float time)
-{
-	// Eingaben abfangen
-	m_mouse->capture();
-	m_keyboard->capture();
-
-	TooltipManager::getSingleton().update(time);
-
-#ifdef SUMWARS_BUILD_TOOLS
-	DebugPanel::getSingleton().update(m_keyboard, m_mouse);
-	ContentEditor::getSingleton().update(m_keyboard, m_mouse);
-#endif
-
-	if (m_document->getGUIState()->m_left_mouse_pressed || m_document->getGUIState()->m_right_mouse_pressed)
-	{
-		Vector pos = getIngamePos(m_mouse->getMouseState().X.abs,m_mouse->getMouseState().Y.abs);
-		m_document->getGUIState()->m_clicked = pos;
-	}
-	
-	// Tastenwiederholung erzeugen
-	if (m_key !=0)
-	{
-		if (m_key_repeat)
-		{
-			if ( m_key_repeat_timer.getTime()>60)
-			{
-				m_key_repeat_timer.start();
-				m_cegui_system->injectChar(m_key);
-				
-				// Sonderbehandlung fuer Backspace
-				if (m_key == 8)
-				{
-					m_cegui_system->injectKeyDown(OIS::KC_BACK);
-				}
-			}
-		}
-		else
-		{
-			if ( m_key_repeat_timer.getTime()>400)
-			{
-				m_key_repeat_timer.start();
-				m_key_repeat = true;
-			}
-		}
-	}
-
-	
-	if (m_document->getModified() & Document::SAVEGAME_MODIFIED)
-	{
-		m_scene->updateCharacterView();
-		m_document->setModified(m_document->getModified() & (~Document::SAVEGAME_MODIFIED));
-	}
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	// Sprache anpassen
-	if (Gettext::getLocaleChanged())
-	{
-		DEBUGX("language changed");
-		std::map<std::string, Window*>::iterator it;
-		for (it= m_sub_windows.begin(); it != m_sub_windows.end(); ++it)
-		{
-			it->second->updateTranslation();
-		}
-	}
-	
-	// Flags, welche Fenster gezeigt werden
-	int wflags = m_document->getGUIState()->m_shown_windows;
-
-	
-	
-	// Testen ob die Anzeige der Fenster geaendert werden muss
-	if (m_document->getModified() & Document::GUISHEET_MODIFIED)
-	{
-		if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU)
-		{
-			updateMainMenu();
-			m_cegui_system->setGUISheet(m_main_menu);
-			m_main_menu->addChildWindow(m_sub_windows["Options"]->getCEGUIWindow());
-			MusicManager::instance().stop();
-		}
-
-		if (m_document->getGUIState()->m_sheet ==  Document::GAME_SCREEN)
-		{
-			m_cegui_system->setGUISheet(m_game_screen);
-			m_game_screen->addChildWindow(m_sub_windows["Options"]->getCEGUIWindow());
-			MusicManager::instance().stop();
-			
-			// one silent update of the belt
-			// to avoid silly sounds on startup
-			static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(true);
-			m_sub_windows["ControlPanel"]->update();
-			static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
-			
-		}
-		m_document->setModified(m_document->getModified() & (~Document::GUISHEET_MODIFIED));
-	}
-	
-	// Testen ob Anzeige der Subfenster geaendert werden muss
-	if (m_document->getModified() & Document::WINDOWS_MODIFIED)
-	{
-		DEBUGX("new shown windows %x",wflags);
-
-		/*// Auswahlliste Savegames  anzeigen wenn entsprechendes Flag gesetzt
-		CEGUI::FrameWindow* savelist = (CEGUI::FrameWindow*) win_mgr.getWindow("SavegameMenu");
-		if (wflags & Document::SAVEGAME_LIST)
-		{
-			
-			savelist->setVisible(true);
-			m_sub_windows["SavegameList"]->update();
-		}
-		else
-		{
-			savelist->setVisible(false);
-		}*/
-
-		// Menu Spielstart anzeigen wenn entsprechendes Flag gesetzt
-		CEGUI::FrameWindow* start_menu = (CEGUI::FrameWindow*) win_mgr.getWindow("StartMenuRoot");
-		MainMenu* main_menu = static_cast<MainMenu*>(m_sub_windows["MainMenu"]);
-		if (wflags & Document::START_MENU)
-		{
-			start_menu->setVisible(true);
-			main_menu->setSavegameListVisible(true);
-		}
-		else
-		{
-			if (wflags & Document::CHAR_CREATE)
-			{
-				start_menu->setVisible(true);
-				main_menu->setSavegameListVisible(false);
-			}
-			else
-			{
-				start_menu->setVisible(false);
-			}
-		}
-		
-		CEGUI::FrameWindow* credits = (CEGUI::FrameWindow*) win_mgr.getWindow("CreditsWindow");
-		if (wflags & Document::CREDITS)
-		{
-			credits->setVisible(true);
-		}
-		else
-		{
-			credits->setVisible(false);
-		}
-		
-		CEGUI::FrameWindow* host_game = (CEGUI::FrameWindow*) win_mgr.getWindow("HostGameWindow_Holder");
-		if (wflags & Document::HOST_GAME)
-		{
-			m_sub_windows["HostGame"]->update();
-			host_game->setVisible(true);
-		}
-		else
-		{
-			host_game->setVisible(false);
-		}
-		
-		CEGUI::FrameWindow* join_game = (CEGUI::FrameWindow*) win_mgr.getWindow("JoinGameWindow_Holder");
-		if (wflags & Document::JOIN_GAME)
-		{
-			m_sub_windows["JoinGame"]->update();
-			join_game->setVisible(true);
-		}
-		else
-		{
-			join_game->setVisible(false);
-		}
-		
-		CEGUI::FrameWindow* options = 0;
-		if (win_mgr.isWindowPresent ("OptionsWindow_Holder"))
-		{
-			options = (CEGUI::FrameWindow*) win_mgr.getWindow("OptionsWindow_Holder");
-		}
-		else
-		{
-			options = (CEGUI::FrameWindow*) win_mgr.getWindow("OptionsWindow");
-		}
-		if (wflags & Document::OPTIONS)
-		{
-			static_cast<OptionsWindow*>(m_sub_windows["Options"])->reset();
-			options->setVisible(true);
-			options->activate ();
-		}
-		else
-		{
-			options->setVisible(false);
-		}
-		
-		
-		CEGUI::FrameWindow* char_create = (CEGUI::FrameWindow*) win_mgr.getWindow("CharCreate");
-		if (wflags & Document::CHAR_CREATE)
-		{
-			if (!char_create->isVisible())
-			{	
-				static_cast<CharCreate*>(m_sub_windows["CharCreate"])->updateClassList();
-			}
-			char_create->setVisible(true);
-			char_create->activate();
-		}
-		else
-		{
-			char_create->setVisible(false);
-		}
-        
-        CEGUI::FrameWindow* error_dialog = (CEGUI::FrameWindow*) win_mgr.getWindow("ErrorDialogWindow");
-        if (wflags & Document::MESSAGE)
-        {
-            m_sub_windows["errorDialog"]->update();
-            error_dialog->setVisible(true);
-			error_dialog->activate();
-            //error_dialog->setModalState(true);
-        }
-        else
-        {
-            error_dialog->setVisible(false);
-            //error_dialog->setModalState(false);
-        }
-
-		if (m_document->getGUIState()->m_sheet ==  Document::GAME_SCREEN)
-		{
-			// Charinfo anzeigen wenn entsprechendes Flag gesetzt
-			CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) win_mgr.getWindow("CharInfo_Holder");
-			if (wflags & Document::CHARINFO)
-			{
-				char_info->setVisible(true);
-			}
-			else
-			{
-				char_info->setVisible(false);
-			}
-	
-			// Inventar anzeigen wenn entsprechendes Flag gesetzt
-			CEGUI::FrameWindow* inventory = (CEGUI::FrameWindow*) win_mgr.getWindow("Inventory_Holder");
-			if (wflags & Document::INVENTORY)
-			{
-				if (!inventory->isVisible())
-				{
-					inventory->setVisible(true);
-					// make one silent update to avoid that new inventory items play sounds
-					static_cast<ItemWindow*>(m_sub_windows["Inventory"])->setSilent(true);
-					m_sub_windows["Inventory"]->update();
-					static_cast<ItemWindow*>(m_sub_windows["Inventory"])->setSilent(false);
-				}
-			}
-			else
-			{
-				inventory->setVisible(false);
-				static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
-			}
-			
-			// show/hide control panel
-			CEGUI::FrameWindow* control_panel = (CEGUI::FrameWindow*) win_mgr.getWindow("ControlPanel_Holder");
-			if (wflags & Document::CONTROL_PANEL)
-			{
-				if (!control_panel->isVisible())
-				{
-					control_panel->setVisible(true);
-					
-					// one silent update of the belt
-					// to avoid silly sounds on startup
-					static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(true);
-					m_sub_windows["ControlPanel"]->update();
-					static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
-				}
-			}
-			else
-			{
-				control_panel->setVisible(false);
-			}
-			
-			// QuestInfo anzeigen wenn entsprechendes Flag gesetzt
-			CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) win_mgr.getWindow("QuestInfo_Holder");
-			if (wflags & Document::QUEST_INFO)
-			{
-				quest_info->setVisible(true);
-				m_sub_windows["QuestInfo"]->update();
-			}
-			else
-			{
-				quest_info->setVisible(false);
-			}
-			
-			CEGUI::FrameWindow* minimap = (CEGUI::FrameWindow*) win_mgr.getWindow("MinimapWindow_Holder");
-			if (wflags & Document::MINIMAP)
-			{
-				minimap->setVisible(true);
-			}
-			else
-			{
-				minimap->setVisible(false);
-			}
-			
-			CEGUI::FrameWindow* trade = (CEGUI::FrameWindow*) win_mgr.getWindow("TradeWindow_Holder");
-			if (wflags & Document::TRADE)
-			{
-								
-				if (!trade->isVisible())
-				{
-					static_cast<TradeWindow*>(m_sub_windows["Trade"])->reset();
-					trade->setVisible(true);
-					
-					// make one silent update to avoid that new inventory items play sounds
-					static_cast<ItemWindow*>(m_sub_windows["Trade"])->setSilent(true);
-					m_sub_windows["Trade"]->update();
-					static_cast<ItemWindow*>(m_sub_windows["Trade"])->setSilent(false);
-				}
-			}
-			else
-			{
-				trade->setVisible(false);
-			}
-			
-			CEGUI::FrameWindow* worldmap = (CEGUI::FrameWindow*) win_mgr.getWindow("WorldmapWindow_Holder");
-			if (wflags & Document::WORLDMAP)
-			{
-				m_sub_windows["Worldmap"]->update();
-				worldmap->setVisible(true);
-			}
-			else
-			{
-				worldmap->setVisible(false);
-			}
-			
-			CEGUI::FrameWindow* save_exit = (CEGUI::FrameWindow*) win_mgr.getWindow("SaveExitWindow");
-			if (wflags & Document::SAVE_EXIT)
-			{
-				save_exit->setVisible(true);
-				save_exit->setModalState(true);
-			}
-			else
-			{
-				save_exit->setVisible(false);
-				save_exit->setModalState(false);
-			}
-			
-			// Chat Fenster anzeigen wenn entsprechendes Flag gesetzt
-			CEGUI::FrameWindow* chat_window = (CEGUI::FrameWindow*) win_mgr.getWindow("Chatline");
-			if (wflags & Document::CHAT)
-			{
-				// Fokus setzen, wenn das Fenster gerade geoeffnet wurde
-				if (!chat_window->isVisible())
-				{
-					CEGUI::Editbox* chatline;
-					chatline = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("Chatline"));
-					chat_window->setVisible(true);
-					chatline->activate();
-				}
-				
-				chat_window->setVisible(true);
-			}
-			else
-			{
-				chat_window->setVisible(false);
-				// Chatzeile deaktivieren
-				CEGUI::Editbox* chatline;
-				chatline = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("Chatline"));
-				chatline->deactivate();
-			}
-			
-			CEGUI::FrameWindow* party_info = (CEGUI::FrameWindow*) win_mgr.getWindow("PartyInfo");
-			if (wflags & Document::PARTY)
-			{
-				party_info->setVisible(true);
-			}
-			else
-			{
-				party_info->setVisible(false);
-			}
-	
-			if (m_document->getLocalPlayer()!=0)
-			{
-				// Skilltree anzeigen wenn entsprechendes Flag gesetzt
-				
-				CEGUI::TabControl* skilltree = (CEGUI::TabControl*) win_mgr.getWindow("Skilltree_Holder");
-				if (wflags & Document::SKILLTREE)
-				{
-					skilltree->setVisible(true);
-				}
-				else
-				{
-					skilltree->setVisible(false);
-				}
-				
-			}
-		}
-		
-		m_document->setModified(m_document->getModified() & ~Document::WINDOWS_MODIFIED);
-	}
-	
-	if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU)
-	{
-		updateMainMenu();
-	}
-	
-	m_sub_windows["CreditsWindow"]->update();
-	
-	if (wflags & Document::OPTIONS)
-	{
-		// Fenster Optionen aktualisieren
-		m_sub_windows["Options"]->update();
-	}
-
-	// Musik aktualisieren
-	updateSound();
-	updateMusic();
-	
-	
-
-	// Objekte aus dem Dokument darstellen
-	if (m_document->getLocalPlayer()!=0 && m_document->getLocalPlayer()->getRegion()!=0)
-	{
-
-		// ObjectInfo aktualisieren
-		updateObjectInfo();
-		
-		updateItemInfo();
-		updateRegionInfo();
-		updateChatContent();
-		updateFloatingText();
-		
-		// Szene aktualisieren
-		m_scene->update(time);
-		
-		// Bild am Curso aktualisieren
-		updateCursorItemImage();
-		
-		// Informationen ueber Partymitglieder aktualisieren
-		updatePartyInfo();
-
-		if (wflags & Document::CHARINFO)
-		{
-			// Fenster CharacterInfo aktualisieren
-			m_sub_windows["CharInfo"]->update();
-		}
-
-		if (wflags & Document::CHAT)
-		{
-			// Fenster CharacterInfo aktualisieren
-			m_sub_windows["Chatline"]->update();
-		}
-
-		if (wflags & Document::MINIMAP)
-		{
-			// Fenster Minimap aktualisieren
-			m_sub_windows["Minimap"]->update();
-		}
-		
-		
-		// Steuerleiste aktualisieren
-		m_sub_windows["ControlPanel"]->update();
-
-
-		if (wflags & Document::INVENTORY)
-		{
-			// Fenster Inventar aktualisieren
-			m_sub_windows["Inventory"]->update();
-		}
-		if (wflags & Document::SKILLTREE)
-		{
-			// Skilltree aktualisieren
-			m_sub_windows["SkillTree"]->update();
-		}
-		
-		if (wflags & Document::PARTY)
-		{
-			// Skilltree aktualisieren
-			m_sub_windows["PartyInfo"]->update();
-		}
-		
-		if (wflags & Document::TRADE)
-		{
-			// Skilltree aktualisieren
-			m_sub_windows["Trade"]->update();
-		}
-		
-		m_sub_windows["DialogueWindow"]->update();
-		
-		// + Buttons fuer Levelup aktualisieren
-		bool vis = false;
-		CEGUI::PushButton* btn;
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("CharInfoUpgradeButton"));
-		if (!(wflags & Document::CHARINFO) && m_document->getLocalPlayer()->getAttributePoints() >0)
-		{
-			vis = true;
-		}
-		
-		if (btn->isVisible() != vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		vis = false;
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SkillUpgradeButton"));
-		if (!(wflags & Document::SKILLTREE) && m_document->getLocalPlayer()->getSkillPoints() >0)
-		{
-			vis = true;
-		}
-		
-		if (btn->isVisible() != vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		/*
-		vis = false;
-		CEGUI::Window* label = win_mgr.getWindow("MinimapImage");
-		if (wflags & Document::MINIMAP)
-		{
-			vis = true;
-		}
-		if (label->isVisible() != vis)
-		{
-			if (vis)
-			{
-				label->setProperty("Image", "set:minimap image:minimap_img"); 
-			}
-			label->setVisible(vis);
-		}
-		*/
-	}
-}
-
-
-bool MainWindow::setupGameScreen()
-{
-	DEBUGX("setup game screen");
-	try
-	{
-		// Szene erzeugen
-		m_scene = new Scene(m_document,m_window);
-
-		// GUI Elemente erzeugen
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-		// Oberstes Fenster der Hauptmenue Schicht
-		m_game_screen =  win_mgr.createWindow("DefaultWindow", "GameScreen");
-        m_game_screen->setMousePassThroughEnabled(true);
-
-		// Kontrollleiste anlegen
-		setupControlPanel();
-
-		// Inventar Fenster anlegen
-		setupInventory();
-
-		// CharInfo Fenster anlegen
-		setupCharInfo();
-
-		// Skilltree Fenster anlegen
-		setupSkilltree();
-		
-		setupQuestInfo();
-
-		// Leiste fuer Item/Objekt-Info anlegen
-		setupObjectInfo();
-		
-		setupItemInfo();
-		setupRegionInfo();
-		setupSaveExitWindow();
-        setupErrorDialogWindow();
-		setupChatContent();
-		
-		// Chatfenster anlegen
-		setupChatWindow();
-		
-		// Fenster fuer Partyinfos
-		setupPartyInfo();
-		
-		// Bild fuer das Item am Cursor
-		setupCursorItemImage();
-		
-		setupMinimap();
-		
-		setupTrade();
-		
-		setupWorldmap();
-		
-		m_sub_windows["DialogueWindow"] = new DialogueWindow(m_document, m_scene, m_ceguiSkinName);
-		
-		CEGUI::Window* label;
-		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "CharacterPreviewImage");
-		m_main_menu->addChildWindow(label);
-		label->setProperty("FrameEnabled", "false");
-		label->setProperty("BackgroundEnabled", "false");
-		label->setPosition(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.15)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.7f)));
-		label->setMousePassThroughEnabled(true);
-		label->setInheritsAlpha(false);
-		label->setProperty("Image", "set:character image:character_img"); 
-		label->setVisible(false);
-		
-		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "CharacterPreviewBackground");
-		m_main_menu->addChildWindow(label);
-		label->setProperty("FrameEnabled", "false");
-		label->setProperty("BackgroundEnabled", "true");
-		label->setPosition(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.0)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 1.0f)));
-		label->setMousePassThroughEnabled(true);
-		label->setVisible(false);
-		label->moveToBack();
-	}
-	catch (CEGUI::Exception & e)
-	{
-		ERRORMSG("Error message: %s",e.getMessage().c_str());
-		return false;
-	}
-
-	return true;
-}
-
-void MainWindow::setupControlPanel()
-{
-	Window* wnd = new ControlPanel(m_document);
-	m_sub_windows["ControlPanel"] = wnd;
-	
-	
-	// Charakterinfo anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	
-	// zwei weitere Buttons die Skilltree bzw Charinfo oeffnen, wenn Punkte zu verteilen sind
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), "CharInfoUpgradeButton"));
-	m_game_screen->addChildWindow(btn);
-	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim( 0.65f)));
-	btn->setSize(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.07f)));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonCharInfoClicked, static_cast<ControlPanel*>(wnd)));
-	btn->setVisible(false);
-	if (btn->isPropertyPresent ("NormalImage"))
-	{
-		btn->setProperty("NormalImage", "set:CharScreen image:PlusBtnReleased"); 	 
-	}
-	if (btn->isPropertyPresent ("DisabledImage"))
-	{
-		btn->setProperty("DisabledImage", "set:CharScreen image:PlusBtnReleased"); 	 
-	}
-	if (btn->isPropertyPresent ("HoverImage"))
-	{
-		btn->setProperty("HoverImage", "set:CharScreen image:PlusBtnReleased"); 	 
-	}
-	if (btn->isPropertyPresent ("PushedImage"))
-	{
-		btn->setProperty("PushedImage", "set:CharScreen image:PlusBtnPressed");
-	}
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), "SkillUpgradeButton"));
-	m_game_screen->addChildWindow(btn);
-	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.92f), cegui_reldim( 0.65f)));
-	btn->setSize(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.07f)));
-	btn->setWantsMultiClickEvents(false);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, static_cast<ControlPanel*>(wnd)));
-	btn->setVisible(false);
-	
-	
-	if (btn->isPropertyPresent ("NormalImage"))
-	{
-		btn->setProperty("NormalImage", "set:CharScreen image:PlusBtnReleased");
-	}
-	if (btn->isPropertyPresent ("DisabledImage"))
-	{
-		btn->setProperty("DisabledImage", "set:CharScreen image:PlusBtnReleased");
-	}
-	if (btn->isPropertyPresent ("HoverImage"))
-	{
-		btn->setProperty("HoverImage", "set:CharScreen image:PlusBtnReleased");
-	}
-	if (btn->isPropertyPresent ("PushedImage"))
-	{
-		btn->setProperty("PushedImage", "set:CharScreen image:PlusBtnPressed");
-	}
-
-}
-
-void MainWindow::setupCharInfo()
-{
-	Window* wnd = new CharInfo(m_document);
-	m_sub_windows["CharInfo"] = wnd;
-	
-	
-	// Charakterinfo anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-void MainWindow::setupInventory()
-{
-	
-	Window* wnd = new Inventory(m_document);
-	m_sub_windows["Inventory"] = wnd;
-	
-	// Inventar anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-	
-
-}
-
-void MainWindow::setupQuestInfo()
-{
-	Window* wnd = new QuestInfo (m_document, m_ceguiSkinName);
-	m_sub_windows["QuestInfo"] = wnd;
-	
-	// anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-
-void MainWindow::setupSkilltree()
-{
-	SkillTree* wnd = new SkillTree (m_document ,m_keyboard, m_ceguiSkinName);
-	m_sub_windows["SkillTree"] = wnd;
-	
-	// Skilltree anfangs ausblenden
-
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-
-}
-
-void MainWindow::setupChatWindow()
-{
-	Window* wnd = new ChatLine(m_document, m_ceguiSkinName);
-	m_sub_windows["Chatline"] = wnd;
-	
-	
-	// Inventar anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-void MainWindow::setupCursorItemImage()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* label;
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "CursorItemImage");
-	m_game_screen->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "false");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.04f), cegui_reldim( 0.06f)));
-
-	// Just use a default image.
-	std::string portraitname ("set:Portrait image:Portrait");
-	label->setProperty ("Image", portraitname.c_str ());
-
-	label->setVisible(false);
-	label->setAlwaysOnTop(true);
-	label->setMousePassThroughEnabled(true);
-	label->setID(0);
-}
-
-void MainWindow::setupMinimap()
-{
-	Window* wnd = new MinimapWindow (m_document, m_ceguiSkinName);
-	m_sub_windows["Minimap"] = wnd;
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());	
-}
-
-bool MainWindow::setupObjectInfo()
-{
-	DEBUGX("setup object info");
-
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	// Leiste fuer Informationen
-	CEGUI::Window* monster_health_holder = win_mgr.loadWindowLayout ("monsterhealthbar.layout");
-	if (monster_health_holder)
-	{
-		m_game_screen->addChildWindow (monster_health_holder);
-	}
-	
-	return true;
-}
-
-bool MainWindow::setupItemInfo()
-{
-	DEBUGX("setup object info");
-
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-
-	// Leiste fuer Informationen
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "ItemInfoLabel");
-	m_game_screen->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "true");
-	if (label->isPropertyPresent ("BackgroundColours"))
-	{
-		label->setProperty("BackgroundColours", "tl:77000000 tr:77000000 bl:77000000 br:77000000"); 
-	}
-	else if (label->isPropertyPresent ("BackgroundColour"))
-	{
-		label->setProperty("BackgroundColour", "B2000000"); 
-	}
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.02f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.08f), cegui_reldim( 0.03f)));
-	label->setText("");
-	label->setVisible(false);
-	label->setAlpha(0.9);
-	label->setProperty("MousePassThroughEnabled","true");
-
-	return true;
-}
-
-
-bool MainWindow::setupPartyInfo()
-{
-	
-	Window* wnd = new PartyInfo(m_document, m_ceguiSkinName);
-	m_sub_windows["PartyInfo"] = wnd;
-	
-	// PartyInfo anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* img;
-	CEGUI::ProgressBar* bar;
-	
-	std::ostringstream stream;
-	
-	for (int i=0; i<7; i++)
-	{
-		stream.str("");
-		stream << "PartyMemberImage";
-		stream << i;
-		
-		img = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-		m_game_screen->addChildWindow(img);
-		img->setProperty("FrameEnabled", "true");
-		img->setProperty("BackgroundEnabled", "true");
-		img->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f + 0.1f *i)));
-		img->setSize(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.07f)));
-		img->setID(i);
-		img->setVisible(false);
-		img->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&MainWindow::onPartyMemberClicked, this));
-		
-		stream.str("");
-		stream << "PartyMemberHealthBar";
-		stream << i;
-		
-		bar = static_cast<CEGUI::ProgressBar*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ProgressBar"), stream.str()));
-		m_game_screen->addChildWindow(bar);
-		m_game_screen->addChildWindow(bar);
-		bar->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.08f+ 0.1f *i)));
-		bar->setSize(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.02f)));
-		bar->setProgress(1.0);
-		bar->setVisible(false);
-	}
-	
-	return true;
-}
-
-void MainWindow::setupTrade()
-{
-	Window* wnd = new TradeWindow(m_document, m_ceguiSkinName);
-	m_sub_windows["Trade"] = wnd;
-	
-	
-	// Inventar anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-
-void MainWindow::setupWorldmap()
-{
-	Window* wnd = new Worldmap (m_document, m_ceguiSkinName);
-	m_sub_windows["Worldmap"] = wnd;
-	
-	
-	// Inventar anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-void MainWindow::setupRegionInfo()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* label;
-	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "RegionInfoLabel");
-	m_game_screen->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	label->setProperty("BackgroundEnabled", "false");
-	label->setProperty("HorzFormatting", "HorzCentred");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.05)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.06f)));
-	label->setVisible(false);
-	label->setAlwaysOnTop(true);
-	label->setMousePassThroughEnabled(true);
-	label->setID(0);
-}
-
-void MainWindow::setupSaveExitWindow()
-{
-	Window* wnd = new SaveExitWindow(m_document);
-	m_sub_windows["saveExit"] = wnd;
-	
-	
-	// Inventar anfangs ausblenden
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-void MainWindow::setupErrorDialogWindow()
-{
-	Window* wnd = new ErrorDialogWindow(m_document);
-	m_sub_windows["errorDialog"] = wnd;
-	
-	m_game_screen->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-	
-	wnd = new WarningDialogWindow(m_document);
-	m_sub_windows["warningDialog"] = wnd;
-	
-	m_main_menu->addChildWindow(wnd->getCEGUIWindow());
-	wnd->getCEGUIWindow()->setVisible(false);
-}
-
-void MainWindow::setupChatContent()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* label;
-	label = static_cast<CEGUI::MultiLineEditbox*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "ChatContent"));
-	m_game_screen->addChildWindow(label);
-	label->setProperty("FrameEnabled", "false");
-	//label->setProperty("BackgroundEnabled", "false");
-	label->setPosition(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.63f)));
-	label->setSize(CEGUI::UVector2(cegui_reldim(.43f), cegui_reldim( 0.2f)));
-	if (label->isPropertyPresent ("BackgroundColours"))
-	{
-		label->setProperty("BackgroundColours", "tl:44000000 tr:44000000 bl:44000000 br:44000000");
-	}
-	else if (label->isPropertyPresent ("BackgroundColour"))
-	{
-		label->setProperty("BackgroundColour", "B2000000");
-	}
-	label->setProperty("VertFormatting", "VertCentred");
-	label->setProperty("HorzFormatting", "WordWrapLeftAligned");
-	label->setText("");
-	label->setAlwaysOnTop(true);
-	label->setMousePassThroughEnabled(true);
-	label->setID(0);
-}
-
-void  MainWindow::setWindowExtents(int width, int height){
-	//Set Mouse Region.. if window resizes, we should alter this to reflect as well
-	const OIS::MouseState &ms = m_mouse->getMouseState();
-	ms.width = width;
-	ms.height = height;
-}
-
-
-void  MainWindow::updateMainMenu()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* img;
-	if (win_mgr.isWindowPresent ("StartScreenRoot"))
-	{
-		img  = win_mgr.getWindow ("StartScreenRoot");
-		img->setMousePassThroughEnabled (true);
-	}
-	if (win_mgr.isWindowPresent ("StartScreenImage"))
-	{
-		img  = win_mgr.getWindow ("StartScreenImage");
-		img->setMousePassThroughEnabled (true);
-	}
-	CEGUI::Window* label;
-	label = win_mgr.getWindow("CharacterPreviewImage");
-	CEGUI::Window* label2;
-	label2 = win_mgr.getWindow("CharacterPreviewBackground");
-	
-	
-	
-	int wflags = m_document->getGUIState()->m_shown_windows;
-	if (wflags & (Document::SAVEGAME_LIST | Document::CHAR_CREATE))
-	{
-		img->setVisible(false);
-	}
-	else
-	{
-		img->setVisible(true);
-	}
-	
-	m_sub_windows["MainMenu"]->update();
-}
-
-void  MainWindow::updateCharCreate()
-{
-	m_sub_windows["CharCreate"]->update();
-
-}
-
-
-void MainWindow::updateCursorItemImage()
-{
-	Player* player = m_document->getLocalPlayer();
-	Item* item = 0;
-	item = player->getEquipement()->getItem(Equipement::CURSOR_ITEM);
-	
-	
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label = win_mgr.getWindow("CursorItemImage");
-	
-	if (item == 0)
-	{
-		// Kein Item mehr am Cursor
-		// Bild verstecken
-		
-		if (label->isVisible())
-		{
-			label->setVisible(false);
-		}
-	}
-	else
-	{
-		// Es befindet sich ein Item am Cursor
-		// Bild zeigen
-		
-		if (! label->isVisible())
-		{
-			label->setVisible(true);
-		}	
-		
-		// Groesse des Items am Cursor ermitteln
-		unsigned int size = item->m_size;
-
-			
-		if (size != label->getID())
-		{
-			// Groesse des Labels setzen
-			if (size == Item::BIG)
-			{
-				label->setSize(CEGUI::UVector2(cegui_reldim(0.060f), cegui_reldim( 0.075f)));
-			}
-			else if (size == Item::MEDIUM)
-			{
-				label->setSize(CEGUI::UVector2(cegui_reldim(0.045f), cegui_reldim( 0.06f)));
-			}
-			else if (size == Item::SMALL)
-			{
-				label->setSize(CEGUI::UVector2(cegui_reldim(0.033f), cegui_reldim( 0.043f)));
-			}
-			
-			label->setID(size);
-		}
-		
-		std::ostringstream out_stream("");
-		out_stream<< ItemWindow::getItemImage(item->m_subtype);
-		
-		if (label->getProperty("Image")!=out_stream.str())
-		{
-			label->setProperty("Image", out_stream.str());
-			OIS::MouseEvent me(m_mouse,m_mouse->getMouseState ());
-			
-			mouseMoved(me);
-		}
-		
-	}
-}
-
-void MainWindow::updateObjectInfo()
-{
-	Player* player = m_document->getLocalPlayer();
-	Region* reg = player->getRegion();
-	if (reg ==0)
-		return;
-	
-	// Ogre Name des Objektes auf das der Mauszeiger zeigt
-	std::string objname = "";
-
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label = win_mgr.getWindow("ObjectInfoLabel");
-	CEGUI::Window* itmlabel = win_mgr.getWindow("ItemInfoLabel");
-	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "MonsterHealthProgressBar"));
-	
-	
-	// Position der Maus
-	float x = m_mouse->getMouseState().X.abs;
-	float y = m_mouse->getMouseState().Y.abs;
-
-
-	// Position des Mausklicks relativ zum Viewport
-	Ogre::Viewport* viewport = m_scene->getViewport();
-	float relx = x*1.0/(viewport->getActualWidth());
-	float rely = y*1.0/(viewport->getActualHeight());
-
-	// Strahl von der Kamera durch den angeklickten Punkt
-	Ogre::Camera* camera = m_scene->getCamera();
-	Ogre::Ray ray = camera->getCameraToViewportRay(relx,rely);
-
-	// Query zum Anfragen auf getroffene Objekte
-	Ogre::RaySceneQuery * query = m_scene_manager->createRayQuery(ray);
-	query->setQueryTypeMask(Ogre::SceneManager::ENTITY_TYPE_MASK);
-	query->setSortByDistance (true);
-	query->setQueryMask(Scene::WORLDOBJECT | Scene::ITEM);
-	
-	// Anfrage ausfuehren
-	Ogre::RaySceneQueryResult& result = query->execute();
-	Ogre::RaySceneQueryResult::iterator it;
-	
-	int id=0;
-	int objid =0;
-	bool search_for_object = true;
-	
-	if (reg->getCutsceneMode () == true || player->getDialogue () != 0)
-	{
-		objid = 0;
-		search_for_object = false;
-	}
-	else if (m_mouse->getMouseState().buttons !=0)
-	{
-		// fokussiertes Objekt nicht wechseln, wenn Maustaste gedrueckt
-		if (m_document->getGUIState()->m_clicked_object_id != 0)
-		{
-			objid = m_document->getGUIState()->m_clicked_object_id;
-			GameObject* go = reg->getObject(objid);
-			search_for_object = false;
-			if (go == 0)
-			{
-				search_for_object = true;
-			}
-			else if (go->getState() != WorldObject::STATE_ACTIVE)
-			{
-				search_for_object = true;
-			}
-		}
-		else
-		{
-			search_for_object = false;
-		}
-	}
-	
-	if (search_for_object)
-	{
-
-		WorldObject* wo;
-		GameObject* go;
-		float dist, mindist = 100000;
-		for (it = result.begin(); it != result.end(); ++it)
-		{
-			dist = it->distance;
-			
-			// unsichtbare Objekte nicht fokussierbar
-			if (it->movable->getVisible() == false)
-			{
-				continue;
-			}
-			
-			try
-			{
-				id = Ogre::any_cast<int>(it->movable->getUserAny());
-			}
-			catch (Ogre::Exception&)
-			{
-				WARNING("Object %s has no ID",it->movable->getName().c_str());
-				continue;
-			}
-			DEBUGX("ray scene query dist %f obj %s mask %x id %i",it->distance, it->movable->getName().c_str(),it->movable->getQueryFlags(), id);
-			// nur aktive Objekte beruecksichtigen
-			go = reg->getGameObject(id);
-			if (go == 0)
-			{
-				continue;
-			}
-			if (go->getState() != WorldObject::STATE_ACTIVE)
-				continue;
-			
-			// verbuendete Einheiten bekommen einen Malus - dadurch selektiert man im Kampf bevorzugt Feinde
-			wo = dynamic_cast<WorldObject*>(go);
-			if (wo != 0)
-			{
-				if (wo->checkInteractionFlag(WorldObject::USABLE) == false)
-				{
-					continue;
-				}
-				
-				if (World::getWorld()->getRelation(m_document->getLocalPlayer()->getFraction(), wo->getFraction()) == Fraction::ALLIED)
-				{
-					dist *=10;
-				}
-			}
-			
-			// Pruefung gegen das Polygon
-			// get the entity to check
-			
-			Ogre::Entity *pentity = dynamic_cast<Ogre::Entity*>(it->movable);
-			bool rayhit = true;
-			if (((wo!=0 && wo->checkInteractionFlag(WorldObject::EXACT_MOUSE_PICKING)) || go->getType() == "DROPITEM")  && pentity != 0)
-			{
-				rayhit = false;
-				
-				// mesh data to retrieve
-				size_t vertex_count;
-				size_t index_count;
-				Ogre::Vector3 *vertices;
-				unsigned long *indices;
-	
-				// get the mesh information
-				Scene::getMeshInformation(pentity->getMesh(), vertex_count, vertices, index_count, indices,
-										pentity->getParentNode()->_getDerivedPosition(),
-										pentity->getParentNode()->_getDerivedOrientation(),
-										pentity->getParentNode()->_getDerivedScale());
-	
-				// test for hitting individual triangles on the mesh
-				for (int i = 0; i < static_cast<int>(index_count)-2; i += 3)
-				{
-					// check for a hit against this triangle
-					// I hope that volatile avoids that these variables are optimized out
-					volatile int index1 = indices[i];
-					volatile int index2 = indices[i+1];
-					volatile int index3 = indices[i+2];
-					if (index1 >=0 && index2>=0 && index3>=0
-						&& index1 < (int)vertex_count && index2 < (int)vertex_count &&  index3 < (int)vertex_count)
-					{
-					
-						std::pair<bool, Ogre::Real> hit = Ogre::Math::intersects(ray, vertices[index1],
-								vertices[index2], vertices[index3], true, false);
-		
-						// if it was a hit check if its the closest
-						if (hit.first)
-						{
-							if ( (hit.second < dist))
-							{
-								// this is the closest so far, save it off
-								dist = hit.second;
-							}
-							rayhit = true;
-						}
-					}
-					else
-					{
-						ERRORMSG("Invalid indices: %i %i %i",index1,index2,index3);
-					}
-				}
-	
-				// free the verticies and indicies memory
-				delete[] vertices;
-				delete[] indices;
-				
-				if (rayhit)
-				{
-					dist /=10;
-				}
-				
-				if (go->getType() == "DROPITEM")
-					rayhit = true;
-			}
-			
-			// Objekt wird vom Kamerastrahl geschnitten
-			// Distance zum Spieler ausrechnen
-			
-			if (dist<mindist && rayhit)
-			{
-				// Objekt ist das bisher naechste
-				objid = id;
-				mindist = dist;
-			}
-		}
-		m_document->getGUIState()->m_cursor_object=objname;
-
-	}
-	
-	if (objid==0)
-	{
-		// aktuell kein Objekt unterm Mauszeiger
-		m_document->getGUIState()->m_cursor_object_id =0;
-		m_document->getGUIState()->m_cursor_item_id =0;
-
-		label->setVisible(false);
-		bar->setVisible(false);
-		itmlabel->setVisible(false);
-			
-	}
-	
-	if (objid==player->getId())
-	{
-		label->setVisible(false);
-		bar->setVisible(false);
-		itmlabel->setVisible(false);
-		m_document->getGUIState()->m_cursor_object_id = objid;
-		objid=0;
-	}
-	
-	std::string highlightcol = "white";
-	std::string highlightmat = "_highlight_alpha_nodepth";
-	
-	std::string name;
-	std::ostringstream string_stream;
-	if (objid!=0)
-	{
-		// es gibt ein ein Objekt unterm Mauszeiger
-		// zur ID gehoerendes Objekt
-		GameObject* go = reg->getGameObject(objid);
-		if (go != 0)
-		{
-			DEBUGX("highlight object %i,",objid);
-			WorldObject* cwo = dynamic_cast<WorldObject*>(go);
-			Creature* cr;
-				
-			if (cwo !=0 && cwo->getState() == WorldObject::STATE_ACTIVE)
-			{
-				// Objekt existiert
-				m_document->getGUIState()->m_cursor_object_id = objid;
-				m_document->getGUIState()->m_cursor_item_id =0;
-				cr = dynamic_cast<Creature*>(cwo);
-				if (cr != 0)
-				{
-					if (!bar->isVisible())
-						bar->setVisible(true);
-					
-					// Objekt ist ein Lebewesen
-					// Lebenspunkte anfuegen
-					string_stream<< cr->getName().getTranslation();
-					float perc = cr->getDynAttr()->m_health / cr->getBaseAttrMod()->m_max_health;
-					if (bar->getProgress() != perc)
-					{
-						bar->setProgress(perc);
-					}
-				}
-				else
-				{
-					bar->setVisible(false);
-				}
-				
-				if (!label->isVisible())
-				{
-					label->setVisible(true);
-				}
-				name = string_stream.str();
-				if (label->getText() != (CEGUI::utf8*) name.c_str())
-				{
-					label->setText((CEGUI::utf8*) name.c_str());
-				}
-				
-				if (World::getWorld()->getRelation(cwo->getFraction(),player) == Fraction::HOSTILE)
-				{
-					highlightcol = Options::getInstance()->getEnemyHighlightColor();
-				}
-			}
-			else
-			{
-				label->setVisible(false);
-				bar->setVisible(false);
-			}
-			
-			DropItem* di = dynamic_cast<DropItem*>(go);
-			if (di != 0)
-			{
-				Item* itm = di->getItem();
-				m_document->getGUIState()->m_cursor_item_id = id;
-				m_document->getGUIState()->m_cursor_object_id =0;
-				
-				if (!m_document->getGUIState()->m_item_labels)
-				{
-					itmlabel->setVisible(true);
-				}
-				
-				name = itm->getName();
-				
-				float len = itmlabel->getArea().getWidth().d_scale;
-				
-				if (itmlabel->getText() != (CEGUI::utf8*) name.c_str())
-				{
-					CEGUI::Font* font = itmlabel->getFont();
-					float width = font->getTextExtent((CEGUI::utf8*) name.c_str());
-					CEGUI::Rect rect = m_game_screen->getInnerRectClipper();
-					len = width / rect.getWidth();
-					
-					itmlabel->setText((CEGUI::utf8*) name.c_str());
-				}
-				
-				if (fabs( itmlabel->getArea().getWidth().d_scale - len) > 0.001)
-				{
-					DEBUGX("old value %f new value %f",itmlabel->getArea().getWidth().d_scale, len);
-					itmlabel->setSize(CEGUI::UVector2(cegui_reldim(len), cegui_reldim( 0.03f)));
-				}
-				
-				std::string propold = itmlabel->getProperty("TextColours").c_str();
-				std::string propnew = "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF";
-				if (itm->m_rarity == Item::MAGICAL)
-				{
-					std::string magicColour = TooltipSettings::getGroundItemMagicalHexColourCode ();
-					std::stringstream ssColour;
-					ssColour << "tl:" << magicColour << " tr:" << magicColour << " bl:" << magicColour << " br:" << magicColour;
-					propnew = ssColour.str ();
-					//propnew = "tl:FF8888FF tr:FF8888FF bl:FF8888FF br:FF8888FF";
-				}
-				if (propold != propnew)
-				{
-					itmlabel->setProperty("TextColours", propnew); 
-				}
-				
-				
-				std::pair<float,float> rpos = m_scene->getProjection(di->getPosition());
-				itmlabel->setPosition(CEGUI::UVector2(CEGUI::UDim(MathHelper::Max(0.0,rpos.first-0.03),0), CEGUI::UDim(MathHelper::Max(0.0,rpos.second-0.05),0)));
-			}
-			else
-			{
-				itmlabel->setVisible(false);
-			}
-		}
-		else
-		{
-			m_document->getGUIState()->m_cursor_object_id =0;
-			label->setVisible(false);
-			bar->setVisible(false);
-			objid = 0;
-		}
-	}
-
-	int hlid = objid;
-	if (hlid == player->getId())
-		hlid =0;
-	
-	if (m_highlight_id !=  hlid)
-	{
-		GraphicObject* grobj = m_scene->getGraphicObject(m_highlight_id);
-		if (grobj != 0)
-		{
-			grobj->setHighlight(false, highlightcol + highlightmat);
-		}
-		
-		if (objid != 0)
-		{
-			grobj = m_scene->getGraphicObject(hlid);
-			if (grobj != 0)
-			{
-				grobj->setHighlight(true, highlightcol + highlightmat);
-			}
-		}
-		m_highlight_id = hlid;
-	}
-
-}
-
-void MainWindow::updateItemInfo()
-{
-	// Zaehler wie viele Labels fuer Items existieren
-	static int lcount =0;
-	
-	// Fenstermanager
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label = win_mgr.getWindow("ItemInfoLabel");
-	
-	
-	
-	DropItem* di;
-	
-	Player* player = m_document->getLocalPlayer();
-	Vector plpos = player->getShape()->m_center;
-	
-	DropItemMap& itms = player->getRegion()->getDropItems();
-	DropItemMap::iterator it;
-	
-	if (m_document->getGUIState()->m_item_labels)
-	{
-		label->setVisible(false);
-		
-		// Alt gedrueckt
-		// fuer alle Items ein Label erstellen
-		std::ostringstream stream;
-		int nr =0;
-		std::string name;
-		std::pair<float,float> rpos;
-		
-		float height = 0.030;
-		int num = (int) (0.9/height);
-		// fuer jede 0.025 hohe Spalte ein Element des Vektors
-		// fuer jede Spalte eine Liste von Wertepaaren: Anfang, Ende
-		std::vector< std::list < std::pair<float,float> > > itempos(num);
-		
-		// Lokales Koordinatensystem fuer die Items herstellen
-		Vector pu,pl,pll,pmr,pml,ox,oy;
-		pu = getIngamePos(0.5,0.1,true);
-		pl = getIngamePos(0.5,0.9,true);
-		pll = getIngamePos(0,0.9,true);
-		pmr = getIngamePos(1.0,0.5,true);
-		pml = getIngamePos(0,0.5,true);
-		
-		oy = pu - pl;
-		ox = pmr - pml;
-		
-		Vector po = pll - pml;
-		po.projectOn(ox);
-		po = pll - po;
-		
-		// Abfangen numerischer Schwankungen
-		static Vector oldoy = Vector(0,-1);
-		
-		if (fabs(oldoy.angle(oy)) < 0.01 && fabs(oy.getLength() - oldoy.getLength())<0.01 )
-		{
-			oy = oldoy;
-		}
-		else
-		{
-			oldoy = oy;
-		}
-		DEBUGX("oy %f %f",oy.m_x, oy.m_y);
-		
-		// Skalierung der Achsen
-		float oxl = ox.getLength();
-		float oyl = oy.getLength();
-		
-		//float xscal = oxl;
-		float yscal = oyl*height/0.9;
-		
-		ox.normalize();
-		oy.normalize();
-
-		DEBUGX("scal %f %f",xscal,yscal);
-		
-		// Ursprung des neuen Koordinatensystems
-		Vector ypart = po;
-		float ylen = ypart*oy;
-		ypart.projectOn(oy);
-		Vector xpart = po - ypart;
-		
-		DEBUGX("xpart %f %f",xpart.m_x, xpart.m_y);
-		DEBUGX("ypart %f %f",ypart.m_x, ypart.m_y);
-		float yoffs = ylen/yscal - roundf(ylen/yscal);
-		
-		
-		Vector o = xpart + oy*(yscal*( roundf(ylen/yscal)));
-		
-		DEBUGX("pll %f %f %f",pll.m_x, pll.m_y,ylen);
-		DEBUGX("o %f %f ", o.m_x, o.m_y);
-		
-		
-		DEBUGX("\nitems\n");
-		
-		// Distanz zur wahren Position
-		float optdist,dist;
-		int optrow;
-		float optcol;
-		float len;
-		// Begrenzung fuer den Schriftzug
-		float lbound=0,rbound =1;
-		int app;
-		
-		std::string propnew, propold;
-		
-		Vector tpos,pos;
-		for (it = itms.begin(); it != itms.end();++it)
-		{
-			
-			di = it->second;
-			
-			
-			name = di->getItem()->getName();
-			DEBUGX(" ");
-			DEBUGX(" %s %i",name.c_str(), di->getId());
-			
-			tpos = di->getPosition();
-			tpos -= o;
-			
-			pos.m_x = tpos*ox;
- 			pos.m_y = tpos*oy;
-			
-			DEBUGX("tpos %f %f  %f",(tpos+o).m_x, (tpos+o).m_y,yscal);
-			DEBUGX("test %f %f %f   oy %f %f",o*oy/yscal, (tpos+o)*oy/yscal, pos.m_y/yscal,oy.m_x, oy.m_y);
-			
-			// Position auf dem Bildschirm ermitteln
-			DEBUGX("pos %f %f  -- %f",pos.m_x, pos.m_y,pos.m_y/yscal);
-			rpos.first = pos.m_x / oxl;
-			rpos.second = 0.9-pos.m_y / oyl*0.9;
-			DEBUGX("rpos %f %f  - %f",rpos.first, rpos.second, rpos.second/height);
-			
-			// nur Items die wirklich sichtbar sind behandeln
-			if (rpos.first<0 || rpos.first>1 || rpos.second<0 || rpos.second>0.9)
-			{
-				continue;
-			}
-			
-			
-			DEBUGX("optpos %i %f",optrow,optcol);
-			
-			// Laenge des Schriftzugs
-			CEGUI::Font* font = label->getFont();
-			float width = font->getTextExtent((CEGUI::utf8*) name.c_str());
-			CEGUI::Rect rect = m_game_screen->getInnerRectClipper();
-			len = width / rect.getWidth();
-			
-			// eine Laenge fuer die Darstellung (mit Rand), eine ohne
-			float reallen = len;
-			float margin = 0.004;
-			len +=2*margin;
-			
-			DEBUGX("length %f",len);
-			
-			std::list < std::pair<float,float> >::iterator jt, optjt;
-			// optimale Position ermitteln
-			// Distanz zur wahren Position
-			optdist = 1000000;
-			
-			// beste gefundene Platzierung
-			rpos.first -= len/2;
-			optrow= (int) (rpos.second/height);
-			optcol= rpos.first;
-			app = 1;
-			
-			
-			
-			// schleife ueber die Zeilen
-			int row, centerrow = optrow;
-			float col= rpos.second;
-			int i;
-			for (i=0; i<2*num; i++)
-			{
-				
-				lbound=0;
-				rbound =1;
-				
-				
-				
-				row = centerrow;
-				if (i%2 == 0)
-					row += (i+1)/2;
-				else
-					row -= (i+1)/2;
-				
-				if (row<0 || row >= num)
-					continue;
-				
-				// Zeilen ueberspringen die so weit wegliegen, dass garantiert schon eine bessere Platzierung gefunden ist
-				if ((rpos.second- row*height)*(rpos.second- row*height) > optdist)
-					continue;
-				
-				// iterieren ueber die Liste der Gegenstaende, die bisher in der Zeile liegen
-				// (genauer: die Luecken zwischen den Labels)
-				for (jt = itempos[row].begin(); jt != itempos[row].end(); ++jt)
-				{
-					rbound = jt->first;
-					
-					// Test ob das Label in die Luecke passt
-					if (rbound -lbound < len)
-					{
-						lbound = jt->second;
-						continue;
-					}
-					
-					// Optimale Platzierung des Labels in der Luecke ermitteln
-					if (rpos.first+len > rbound)
-					{
-						col = rbound-len;
-					}
-					else if (rpos.first<lbound)
-					{
-						col = lbound;
-					}
-					else
-						col = rpos.first;
-					
-					dist = (rpos.first-col)*(rpos.first-col) + (centerrow-row)*(centerrow-row)*height*height;
-					if (dist+0.0001 < optdist)
-					{
-						optdist = dist;
-						optcol = col;
-						optrow = row;
-						optjt = jt;
-						app = 0;
-						
-						DEBUGX("optdist %f pos %i %f ",optdist, row, col);
-						DEBUGX("lbound %f rbound %f",lbound,rbound);
-					}
-					
-					lbound = jt->second;
-				}
-				
-				// Option, das Label hinter dem letzten bestehenden Label einzufuegen
-				rbound = 1;
-				if (rbound-lbound >= len)
-				{
-					if (rpos.first<lbound)
-					{
-						col = lbound;
-					}
-					else
-						col = rpos.first;
-					
-					dist = (rpos.first-col)*(rpos.first-col) + (centerrow-row)*(centerrow-row)*height*height;
-					
-					if (dist+0.0001 < optdist)
-					{
-						app = 1;
-						optdist = dist;
-						optcol = col;
-						optrow = row;
-						
-						DEBUGX("optdist %f optrow %i pos %i %f  app %i",optdist, optrow, row, col,app);
-						DEBUGX("lbound %f rbound %f",lbound,rbound);
-					}
-					
-				}
-				
-				
-				
-			}
-			
-			if (optdist > 10000)
-				continue;
-			
-			DEBUGX("center %i rpos %f  %f",centerrow,rpos.second, rpos.second-centerrow*height);
-			
-			rpos.first=optcol;
-			rpos.second=(optrow + yoffs) *height;
-			
-			
-			
-			DEBUGX("optdist %f optrow %i pos ",optdist, optrow);
-			DEBUGX("final position %f %f",rpos.second, rpos.first);
-			
-			if (app == 1)
-			{
-				itempos[optrow].push_back(std::make_pair(rpos.first,rpos.first+len));
-			}
-			else
-			{
-				DEBUGX("insert before %f %f",optjt->first, optjt->second);
-				itempos[optrow].insert(optjt,std::make_pair(rpos.first,rpos.first+len));
-			}
-			
-			if (rpos.first<0 || rpos.first+len>1 || rpos.second<0 || rpos.second+height>0.9)
-				continue;
-			
-			stream.str("");
-			stream << "ItemLabel";
-			stream << nr;
-			
-			if (nr >= lcount)
-			{
-				lcount ++;
-				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-				m_game_screen->addChildWindow(label);
-				label->setProperty("FrameEnabled", "false");
-				label->setProperty("BackgroundEnabled", "true");
-				if (label->isPropertyPresent ("BackgroundColours"))
-				{
-					label->setProperty("BackgroundColours", "tl:77000000 tr:77000000 bl:77000000 br:77000000"); 
-				}
-				else if (label->isPropertyPresent ("BackgroundColour"))
-				{
-					label->setProperty("BackgroundColour", "B2000000");
-				}
-				label->setPosition(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.02f)));
-				label->setSize(CEGUI::UVector2(cegui_reldim(reallen), cegui_reldim( 0.03f)));
-				label->setText("");
-				label->setAlpha(0.9);
-				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&MainWindow::onDropItemClicked, this));
-				
-			}
-			else
-			{
-				label = win_mgr.getWindow(stream.str());
-				
-			}
-			label->setVisible(true);
-			
-			
-			if (label->getText() != (CEGUI::utf8*) name.c_str())
-			{
-	
-				label->setText((CEGUI::utf8*) name.c_str());
-			}
-			
-			if (fabs( label->getArea().getWidth().d_scale - reallen) > 0.001)
-			{
-				DEBUGX("old value %f new value %f",label->getArea().getWidth().d_scale, len);
-				label->setSize(CEGUI::UVector2(cegui_reldim(reallen), cegui_reldim( 0.03f)));
-			}
-			
-			label->setID(it->first);
-			
-			
-			label->setPosition(CEGUI::UVector2(CEGUI::UDim(MathHelper::Max(0.0f,rpos.first+margin),0), CEGUI::UDim(MathHelper::Max(0.0f,rpos.second),0)));
-			
-			propold = label->getProperty("TextColours").c_str();
-			propnew = "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF";
-			if (di->getItem()->m_rarity == Item::MAGICAL)
-			{
-				std::string magicColour = TooltipSettings::getGroundItemMagicalHexColourCode ();
-				std::stringstream ssColour;
-				ssColour << "tl:" << magicColour << " tr:" << magicColour << " bl:" << magicColour << " br:" << magicColour;
-				propnew = ssColour.str ();
-				//propnew = "tl:FF8888FF tr:FF8888FF bl:FF8888FF br:FF8888FF";
-			}
-			if (propold != propnew)
-			{
-				label->setProperty("TextColours", propnew); 
-			}
-			nr++;
-
-		}
-		
-		
-		for (; nr<lcount; nr++)
-		{
-			stream.str("");
-			stream << "ItemLabel";
-			stream << nr;
-			
-			label = win_mgr.getWindow(stream.str());
-			label->setVisible(false);
-		}
-		
-	}
-	else
-	{
-		std::ostringstream stream;
-		for (int i=0; i<lcount; i++)
-		{
-			stream.str("");
-			stream << "ItemLabel";
-			stream << i;
-			label = win_mgr.getWindow(stream.str());
-			label->setVisible(false);
-		}
-	}
-}
-
-
-void MainWindow::updatePartyInfo()
-{
-	int windows = m_document->getGUIState()->m_shown_windows;
-	if (windows & Document::PARTY)
-	{
-		// Fenster PartyInfo aktualisieren
-		m_sub_windows["PartyInfo"]->update();
-	}
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* img;
-	CEGUI::ProgressBar* bar;
-	
-	std::ostringstream stream;
-	
-	int i=0;
-	if (!( windows & Document::PARTY || windows & Document::CHARINFO || windows & Document::QUEST_INFO)) 
-	{
-		float hperc;
-		Player* player = m_document->getLocalPlayer();
-		Player* pl;
-		Party* party = World::getWorld()->getParty(player->getFraction());
-		
-		std::set<int>::iterator it;
-		// Schleife ueber die Mitglieder der Party des Spielers
-		for (it =  party->getMembers().begin(); it!= party->getMembers().end(); ++it)
-		{
-			// eigenen Spieler ueberspringen
-			if (*it == player->getId())
-				continue;
-			
-			pl =  static_cast<Player*>(World::getWorld()->getPlayer(*it));
-			if (pl ==0)
-				continue;
-			
-			stream.str("");
-			stream << "PartyMemberImage";
-			stream << i;
-			img = win_mgr.getWindow(stream.str());
-			img->setID(pl->getId());
-			
-			// Bild setzen und anzeigen
-			if (!img->isVisible())
-			{
-				img->setVisible(true);
-			}
-			std::string imagestr = pl->getEmotionImage(pl->getSpeakText().m_emotion);
-			if (img->getProperty("Image") != imagestr)
-			{
-				img->setProperty("Image",imagestr);
-			}
-			
-			if (img->getTooltipText() != (CEGUI::utf8*) pl->getName().getRawText().c_str())
-			{
-				img->setTooltipText((CEGUI::utf8*) pl->getName().getRawText().c_str());
-			}
-			
-			stream.str("");
-			stream << "PartyMemberHealthBar";
-			stream << i;
-			bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow(stream.str()));
-			
-			// Fortschrittsbalken setzen und anzeigen
-			hperc = pl->getDynAttr()->m_health / pl->getBaseAttrMod()->m_max_health;
-			if (bar->getProgress() != hperc)
-			{
-				bar->setProgress(hperc);
-			}
-			
-			stream.str("");
-			stream << (int) pl->getDynAttr()->m_health<<"/"<< (int) pl->getBaseAttrMod()->m_max_health;
-			if (bar->getTooltipText() != stream.str())
-			{
-				bar->setTooltipText(stream.str());
-			}
-			
-			if (!bar->isVisible())
-			{
-				bar->setVisible(true);
-			}
-			
-			i++;
-		}
-	}
-	
-	
-	// restliche Bilder verstecken
-	for (;i<7; i++)
-	{
-		stream.str("");
-		stream << "PartyMemberImage";
-		stream << i;
-		img = win_mgr.getWindow(stream.str());
-		if (img->isVisible())
-		{
-			img->setVisible(false);
-		}
-		
-		stream.str("");
-		stream << "PartyMemberHealthBar";
-		stream << i;
-		bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow(stream.str()));
-		if (bar->isVisible())
-		{
-			bar->setVisible(false);
-		}
-
-	}
-}
-
-void MainWindow::updateRegionInfo()
-{
-	static int region = -1;
-	static int id = 0;
-	static Timer timer;
-	
-	bool refresh = false;
-	
-	Player* pl = m_document->getLocalPlayer();	
-	if (pl->getRegion() != 0)
-	{
-		// update, when a new player is set or when a new region is set.
-		if (pl->getId() != id)
-		{
-			refresh = true;
-			id = pl->getId();
-		}
-		
-		if (pl->getRegion()->getId() != region)
-		{
-			refresh = true;
-			region = pl->getRegion()->getId();
-			MusicManager::instance().stop();
-		}
-		
-		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-		if (refresh)
-		{
-			DEBUG ("*** main window expecting refresh for region");
-			timer.start();
-
-			MinimapWindow* myMinimap = static_cast<MinimapWindow*> (m_sub_windows["Minimap"]);
-			myMinimap->reloadIconsOnNextUpdate ();
-		}
-		
-		float time = timer.getTime();
-		
-		bool vis = false;
-		if (time > 500 &&  time < 3000)
-		{
-			vis = true;
-		}
-		
-	
-		CEGUI::Window* label;
-		label = win_mgr.getWindow("RegionInfoLabel");
-		
-		// Only show when the minimap is not opened.
-		int wflags = m_document->getGUIState()->m_shown_windows;
-		vis &= !(wflags & Document::MINIMAP);
-		
-		if (label->isVisible() != vis)
-		{
-			label->setVisible(vis);
-			
-			if (vis == true)
-			{
-				label->setText( (CEGUI::utf8*) dgettext("sumwars",pl->getRegion()->getName().c_str()));
-			}
-		}
-		
-	}
-}
-
-void MainWindow::updateFloatingText()
-{
-	// Zaehler wie viele Labels fuer Schaden existieren
-	static int lcount =0;
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-			
-	Player* player = m_document->getLocalPlayer();
-	Region* reg = player->getRegion();
-	std::map<int,FloatingText*>& dmgvis = reg->getFloatingTexts();
-	std::map<int,FloatingText*>::iterator it;
-	
-	int nr =0;
-	std::stringstream stream;
-	
-	std::pair<float,float> pos;
-	
-	float maxtime;
-	
-	for (it = dmgvis.begin(); it != dmgvis.end(); ++it)
-	{
-		FloatingText& dmgv = *(it->second);
-		
-		maxtime = dmgv.m_maxtime;
-		pos = m_scene->getProjection(dmgv.m_position,1.0f);
-		pos.second -= dmgv. m_float_offset *(maxtime -dmgv.m_time)/maxtime;
-		
-		
-		// nur Kreaturen behandeln, die wirklich zu sehen sind
-		if (pos.first <0 || pos.first >1 || pos.second <0 || pos.second >1)
-			continue;
-		
-		stream.str("");
-		stream << "FloatingTextLabel";
-		stream << nr;
-		
-		std::string col = dmgv.m_colour;
-		std::string colour = std::string("tl:") + col + " tr:" + col + " bl:" + col + " br:"+ col;
-		
-		if (nr >= lcount)
-		{
-			lcount ++;
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-			m_game_screen->addChildWindow(label);
-			label->setProperty("FrameEnabled", "false");
-			label->setProperty("BackgroundEnabled", "false");
-			label->setText("");
-			label->setAlpha(0.9);
-			label->setFont("DejaVuSerif-12");
-			
-			label->setProperty("TextColours",colour ); 
-			label->	setMousePassThroughEnabled(true);
-		}
-		else
-		{
-			label = win_mgr.getWindow(stream.str());
-				
-		}
-		
-		if (label->getProperty("TextColours") != colour)
-		{
-			label->setProperty("TextColours",colour );
-		}
-		
-		const std::string& text =  dmgv.m_text.getTranslation();
-		
-		if (label->getText() != (CEGUI::utf8*) text.c_str())
-		{
-			label->setText((CEGUI::utf8*) text.c_str());
-		}
-		
-		std::string fontname = "DejaVuSerif-16";
-		if (dmgv.m_size == 1)
-		{
-			fontname = "DejaVuSerif-12";
-		}
-		if (label->getFont()->getProperty("Name") != fontname)
-		{
-			label->setFont(fontname);
-		}
-		
-		CEGUI::Font* font = label->getFont();
-			
-		float width = font->getTextExtent((CEGUI::utf8*) text.c_str())+15;
-		float height = font->getFontHeight() +15;
-			
-		label->setSize(CEGUI::UVector2(CEGUI::UDim(0,width),  CEGUI::UDim(0,height)));
-		label->setPosition(CEGUI::UVector2(CEGUI::UDim(pos.first,-width/2), CEGUI::UDim(pos.second,-height)));
-		
-		float fadetime = 0.4* maxtime;
-		if (dmgv.m_time < fadetime)
-		{
-			label->setAlpha(0.9 * dmgv.m_time / fadetime);
-		}
-		else
-		{
-			label->setAlpha(0.9);
-		}
-		
-		label->setVisible(true);
-		nr ++;
-	}
-	
-	for (; nr<lcount; nr++)
-	{
-		stream.str("");
-		stream << "FloatingTextLabel";
-		stream << nr;
-			
-		label = win_mgr.getWindow(stream.str());
-		label->setVisible(false);
-	}
-}
-
-void MainWindow::updateChatContent()
-{
-	static Timer timer;
-	int windows = m_document->getGUIState()->m_shown_windows;
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	Player* pl = m_document->getLocalPlayer();
-	
-	CEGUI::Window* label;
-	label =  win_mgr.getWindow("ChatContent");
-	
-	// escape all the [ brackets
-	// CEGUI >= 0.7 uses [brackets] for markup
-	std::string rawtext = pl->getMessages();
-	size_t pos = 0;
-	while ((pos = rawtext.find('[',pos)) != std::string::npos)
-	{
-		rawtext.replace(pos,1,"\\[");
-		pos += 2;
-	}
-	
-	if (label->getText() != (CEGUI::utf8*) rawtext.c_str())
-	{
-		label->setText((CEGUI::utf8*) rawtext.c_str() );
-	}
-	
-	bool vis = true;
-	if (label->getText() == "" || ( windows & Document::PARTY || windows & Document::CHARINFO || windows & Document::QUEST_INFO))
-	{
-		vis = false;
-	}
-	else
-	{
-		// Fenster auf die richtige Groesse bringen
-		CEGUI::Font* fnt = label->getFont();
-		CEGUI::Size area(CEGUI::System::getSingleton().getRenderer()->getDisplaySize());
-
-        //TODO
-		CEGUI::String text = label->getText();
-
-		CEGUI::UVector2 vec = CEGUIUtility::getWindowSizeForText(text.c_str(), fnt);
-
-		float width = vec.asRelative(area).d_x;
-		float maxwidth = area.d_width * 0.43;
-		width += 10;
-		if (width > maxwidth)
-		{
-			width = maxwidth;
-		}
-		
-		CEGUI::Size larea = area;
-		larea.d_width = width;
-		//float height =  vec.asRelative(larea).d_y; 
-
-		//float relwidth = width / area.d_width;
-		//float relheight = (height+6) / area.d_height;
-		
-		if ( fabs(label->getArea().getWidth().d_scale - vec.d_x.d_scale) > 0.0001
-			|| fabs(label->getArea().getHeight().d_scale - vec.d_y.d_scale) > 0.0001)
-		{
-			label->setPosition(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.82f - vec.d_y.d_scale)));
-			//label->setSize(CEGUI::UVector2(cegui_reldim(relwidth), cegui_reldim(relheight)));
-			label->setSize(vec);
-			DEBUGX("old size %f %f",label->getArea().getWidth().d_scale, label->getArea().getHeight().d_scale);
-			DEBUGX("new size %f %f", vec.d_x.d_scale, vec.d_y.d_scale);
-		}
-		
-		pl->updateMessageTimer(timer.getTime());
-	}
-	
-	if (label->isVisible() != vis)
-	{
-		label->setVisible(vis);
-		
-	}
-	
-	timer.start();
-}
-
-void MainWindow::updateSound()
-{
-	// play all region sounds from the last updated
-	Player* player = m_document->getLocalPlayer();
-	if (player != 0)
-	{
-		Region* reg = player->getRegion();
-		if (reg != 0)
-		{
-			const std::list<PlayedSound*> sounds = reg->getPlayedSounds();
-			for (std::list<PlayedSound*>::const_iterator it = sounds.begin(); it != sounds.end(); ++it)
-			{
-				SoundSystem::playAmbientSound((*it)->m_soundname, (*it)->m_volume, &((*it)->m_position));
-			}
-		}
-	}
-	
-	SoundSystem::update();
-}
-
-void MainWindow::updateMusic()
-{
-
-	// laufende Musik nicht unterbrechen
-	if (MusicManager::instance().isPlaying())
-		return;
-	
-	std::string source;
-	if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU)
-	{
-		// Titlescreen
-		source ="main_title.ogg";
-	}
-	else if (m_document->getGUIState()->m_sheet ==  Document::GAME_SCREEN)
-	{
-		if (m_document->getLocalPlayer() == 0)
-			return;
-		
-		// zufaellig einen Track der Region auswaehlen
-		Region* reg = m_document->getLocalPlayer()->getRegion();
-		
-		if (reg != 0)
-		{
-			const std::list<MusicTrack> & tracks = reg->getMusicTracks();
-			std::list<MusicTrack>::const_iterator it;
-			
-			if (!tracks.empty())
-			{
-				// Auslosung
-				int nr = Random::randi(tracks.size());
-				it = tracks.begin();
-				while (nr > 0 )
-				{
-					++it;
-					--nr;
-				}
-				
-				source = *it;
-			}
-		}
-	}
-	
-	if (source.empty())
-		return;
-	
-	// Titelmusik laden
-	Ogre::FileInfoListPtr files;
-	Ogre::FileInfoList::iterator it;
-	files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("music",source);
-	
-	it = files->begin();
-	if (it != files->end())
-	{
-		std::string filename;
-		filename = it->archive->getName();
-		filename += "/";
-		filename += it->filename;
-		
-		MusicManager::instance().play(filename);
-		MusicManager::instance().update();
-	}
-}
-
-Vector MainWindow::getIngamePos(float screenx, float screeny, bool relative)
-{
-	// Position des Mausklicks relativ zum Viewport
-	Ogre::Viewport* viewport = m_scene->getViewport();
-	float relx,rely;
-	if (relative)
-	{
-		relx = screenx;
-		rely = screeny;
-	}
-	else
-	{
-		relx = screenx*1.0/(viewport->getActualWidth());
-		rely = screeny*1.0/(viewport->getActualHeight());
-	}
-	DEBUGX("relative Koordinaten %f %f",relx,rely);
-
-	// Strahl von der Kamera durch den angeklickten Punkt
-	Ogre::Camera* camera = m_scene->getCamera();
-	Ogre::Ray ray = camera->getCameraToViewportRay(relx,rely);
-
-	// Ursprung und Richtung des Strahles
-	const Ogre::Vector3& orig = ray.getOrigin();
-	DEBUGX("ray orig %f %f %f",orig.x,orig.y,orig.z);
-	const Ogre::Vector3& dir = ray.getDirection();
-	DEBUGX("ray dir %f %f %f",dir.x,dir.y,dir.z);
-
-	// Schnittpunkt mit der Ebene y=0 ausrechnen
-	
-	Vector ret;
-	float dy = dir.y;
-	if (dir.y>=0)
-	{
-		dy = -0.001;
-	}
-	
-	
-	// Durchstosspunkt durch die Ebene y=0
-	Ogre::Vector3 p = orig + dir*(orig.y/(-dy));
-	DEBUGX("schnittpunkt %f %f %f",p.x,p.y,p.z);
-
-	// Umrechnen in Spielkoordinaten
-	ret.m_x = p.x/GraphicManager::g_global_scale;
-	ret.m_y = p.z/GraphicManager::g_global_scale;
-	DEBUGX("Punkt in Spielkoordinaten %f %f",ret.m_x,ret.m_y);
-	
-	return ret;
-
-}
-
-// MouseListener
-bool MainWindow::mouseMoved(const OIS::MouseEvent &evt)
-{
-    //DEBUG("injection position %i %i",evt.state.X.abs,evt.state.Y.abs);
-    if(m_cegui_system->injectMouseWheelChange(evt.state.Z.rel))
-        m_document->onMouseMove(evt.state.X.rel, evt.state.Y.rel, 0);
-    else
-        m_document->onMouseMove(evt.state.X.rel, evt.state.Y.rel,evt.state.Z.rel);
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label = win_mgr.getWindow("CursorItemImage");
-	
-	int off = 0;
-	if (label->getID() == Item::BIG)
-		off = 24;
-	if (label->getID() == Item::MEDIUM)
-		off = 16;
-	if (label->getID() == Item::SMALL)
-		off = 12;
-	
-	
-	label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,MathHelper::Max(0,evt.state.X.abs-off)),CEGUI::UDim(0,MathHelper::Max(0,evt.state.Y.abs- off))));
-	
-	
-	return m_cegui_system->injectMousePosition(evt.state.X.abs,evt.state.Y.abs);
-}
-
-
-
-/**
-	React to a mouse button being pressed.
-	@note: Input is only supported for the first 3 mouse buttons (left, right, middle) for the time being.
-*/
-bool MainWindow::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
-{
-	m_gui_hit = false;
-
-	CEGUI::MouseButton button = CEGUI::NoButton;
-
-	if (btn == OIS::MB_Left)
-	{
-		button = CEGUI::LeftButton;
-	}
-	else if (btn == OIS::MB_Middle)
-	{
-		button = CEGUI::MiddleButton;
-	}
-	else if (btn == OIS::MB_Right)
-	{
-		button = CEGUI::RightButton;
-	}
-	else
-	{
-		// For the time being no input from more than 3 buttons is allowed.
-		return false;
-	}
-
-    bool ret = false; // CEGUI 0.7 changed its default behaviour a little bit and creates a invisible root window that always processes events
-
-    // if the returned window is anything else than "GameScreen" then CEGUI needs to process the input
-    if (!(m_cegui_system->getWindowContainingMouse()->getName() == "GameScreen")) 
-    {
-        ret = true; // set ret to false if the events where processed by the invisible window
-        m_cegui_system->injectMouseButtonDown(button);
-		/*
-		CEGUI::Window * win = 	m_cegui_system->getWindowContainingMouse();
-		if (win != 0)
-		{
-			DEBUG("clicked window %s",win->getName().c_str());
-		}
-		*/
-    }
-    
-	if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU && m_ready_to_start)
-	{
-		m_document->onStartScreenClicked();
-		return true;
-	}
-
-	// Koordinaten an denen der Mausklick stattfand
-	int x =evt.state.X.abs;
-	int y =evt.state.Y.abs;
-	DEBUGX("mouse coords %i %i",x,y);
-
-	Player* player = m_document->getLocalPlayer();
-	if (player!=0)
-	{
-		// Spiel ist mit Server verbunden
-		if (btn == OIS::MB_Middle)
-		{
-			m_document->getGUIState()->m_middle_mouse_pressed=true;
-		}
-
-		// Testet, dass man nicht auf die untere Steuerleiste geklickt hat
-		if (!ret)
-		{
-			if (player->getEquipement()->getItem(Equipement::CURSOR_ITEM)!=0)
-			{
-				// Spieler hat Item in der Hand, fallen lassen
-				m_document->dropCursorItem();
-			}
-			else
-			{
-
-				Vector pos = getIngamePos(x,y);
-
-				if (btn == OIS::MB_Left)
-				{
-					m_document->getGUIState()->m_left_mouse_pressed=true;
-					m_document->onLeftMouseButtonClick(pos);
-				}
-				else if (btn == OIS::MB_Right)
-				{
-					m_document->getGUIState()->m_right_mouse_pressed=true;
-					m_document->onRightMouseButtonClick(pos);
-				}
-			}
-		}
-
-	}
-
-	return ret;
-}
-
-
-/**
-	React to the mouse button being released.
-	@note: Input is only supported for the first 3 mouse buttons (left, right, middle) for the time being.
-*/
-bool MainWindow::mouseReleased (const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
-{
-	CEGUI::MouseButton button = CEGUI::NoButton;
-
-	// TODO: There are 2 separate if-else blocks; check if it makes sense to unite them,
-	// or the sequence of events is really necessary.
-	if (btn == OIS::MB_Left)
-	{
-		DEBUGX("Button release");
-		m_document->getGUIState ()->m_left_mouse_pressed=false;
-		m_document->getGUIState ()->m_clicked_object_id=0;
-	}
-	else if (btn == OIS::MB_Right)
-	{
-		DEBUGX("Right Button release");
-		m_document->getGUIState ()->m_right_mouse_pressed=false;
-		m_document->getGUIState ()->m_clicked_object_id=0;
-	}
-	else if (btn == OIS::MB_Middle)
-	{
-		m_document->getGUIState ()->m_middle_mouse_pressed=false;
-	}
-	else
-	{
-		// For the time being no input from more than 3 buttons is allowed.
-		return false;
-	}
-
-	if (btn == OIS::MB_Left)
-	{
-		button = CEGUI::LeftButton;
-	}
-	else if (btn == OIS::MB_Middle)
-	{
-		button = CEGUI::MiddleButton;
-	}
-	else if (btn == OIS::MB_Right)
-	{
-		button = CEGUI::RightButton;
-	}
-
-	return m_cegui_system->injectMouseButtonUp (button);
-}
-
-
-
-bool MainWindow::keyPressed(const OIS::KeyEvent &evt) {
-	unsigned int ch = evt.text;
-	
-	DEBUGX("keycode %i %s %x",evt.key,m_keyboard->getAsString(evt.key).c_str(), ch);
-	if (m_document->getGUIState()->m_shown_windows & Document::OPTIONS)
-	{
-		if (static_cast<OptionsWindow*>(m_sub_windows["Options"])->requestsForKey())
-		{
-			static_cast<OptionsWindow*>(m_sub_windows["Options"])->setKeyCode(evt.key);
-			return true;
-		}
-	}
-	
-	if (evt.key == OIS::KC_UNASSIGNED)
-	{
-		ch &= 0xff;
-		m_cegui_system->injectChar((CEGUI::utf32) ch);
-		return true;
-	}
-	
-    if (evt.key == OIS::KC_S)
-    {
-        //m_scene_manager->setShadowTextureSelfShadow(!m_scene_manager->getShadowTextureSelfShadow());
-    }
-	
-	bool ret =m_cegui_system->injectKeyDown(evt.key);
-	
-	ret |= m_cegui_system->injectChar(ch);
-	
-	if (ch != 0 &&  (m_document->getGUIState()->m_shown_windows & Document::CHAT))
-	{
-		m_key = ch;
-		m_key_repeat_timer.start();
-		m_key_repeat = false;
-	}
-	
-	
-	if (evt.key == OIS::KC_RSHIFT || evt.key == OIS::KC_LSHIFT)
-	{
-		m_document->getGUIState()->m_shift_hold = true;
-	}
-
-	// Test for copy paste operations.
-	if (evt.key == OIS::KC_C)
-	{
-		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
-		{
-			DEBUG ("MainWindow:: ctrl + c pressed!");
-			SWUtil::Clipboard::getSingletonPtr ()->copy ();
-		}
-	}
-	else if (evt.key == OIS::KC_X)
-	{
-		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
-		{
-			DEBUG ("MainWindow:: ctrl + X pressed!");
-			SWUtil::Clipboard::getSingletonPtr ()->cut ();
-		}
-	}
-	else if (evt.key == OIS::KC_V)
-	{
-		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
-		{
-			DEBUG ("MainWindow:: ctrl + V pressed!");
-			SWUtil::Clipboard::getSingletonPtr ()->paste ();
-		}
-	}
-	
-	if (!ret)
-	{
-		ret = m_document->onKeyPress(evt.key);
-	}
-	return ret;
-}
-
-bool MainWindow::keyReleased(const OIS::KeyEvent &evt)
-{
-
-	m_key =0;
-	m_key_repeat = false;
-	
-	bool ret = m_cegui_system->injectKeyUp(evt.key);
-	
-	if (evt.key == OIS::KC_RSHIFT || evt.key == OIS::KC_LSHIFT)
-	{
-		m_document->getGUIState()->m_shift_hold = false;
-	}
-
-	if (!ret)
-	{
-		ret = m_document->onKeyRelease(evt.key);
-	}
-
-	return ret;
-}
-
-bool MainWindow::onDropItemClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	DEBUGX("pick up item %i",id);
-	m_document->onDropItemClick(id);
-	return true;
-}
-
-
-
-
-bool MainWindow::consumeEvent(const CEGUI::EventArgs& evt)
-{
-	return true;
-}
-
-bool MainWindow::onPartyMemberClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	Player* pl = static_cast<Player*> (World::getWorld()->getLocalPlayer());
-	if (World::getWorld() ==0 || pl ==0 || pl->getRegion() ==0)
-		return true;
-	
-	// Spieler auf den die Aktion wirkt
-	WorldObject* pl2 = pl->getRegion()->getObject(id);
-	if (pl2 ==0)
-		return true;
-	
-	DEBUG("party member Click %i",id);
-	
-	m_document->getGUIState()->m_cursor_object_id = id;
-	if (we.button == CEGUI::LeftButton)
-	{
-		m_document->onLeftMouseButtonClick(pl2->getPosition());
-	}
-
-	if (we.button == CEGUI::RightButton)
-	{
-		m_document->onRightMouseButtonClick(pl2->getPosition());
-	}
-
-	return true;
-}
-
-void MainWindow::setReadyToStart(bool ready)
-{
-	m_ready_to_start = ready;
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "LoadRessourcesProgressBar"));
-	bar->setVisible(!ready);
-
-	// Also hide the background picture
-	if (win_mgr.isWindowPresent ("StartScreenImage"))
-	{
-		CEGUI::Window* backgroundPicture = win_mgr.getWindow ("StartScreenImage");
-		backgroundPicture->setVisible (false);
-		backgroundPicture->setMousePassThroughEnabled (true);
-	}
-	if (win_mgr.isWindowPresent ("StartScreenRoot"))
-	{
-		CEGUI::Window* backgroundPicture = win_mgr.getWindow ("StartScreenRoot");
-		backgroundPicture->setVisible (false);
-		backgroundPicture->setMousePassThroughEnabled (true);
-	}
-	
-	// we have finished loading so we will simulate the click to get straight in to the main menu
-	m_document->onStartScreenClicked();
-
-	
-}
-
-void MainWindow::setRessourceLoadingBar(float percent)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(win_mgr.getWindow( "LoadRessourcesProgressBar"));
-	bar->setProgress(percent);
-}
-
-
-
-
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mainwindow.h"
+
+#include <string>
+#include <sstream>
+
+#include "gettext.h"
+#include "player.h"
+#include "graphicmanager.h"
+
+#include "charinfo.h"
+#include "controlpanel.h"
+#include "inventory.h"
+#include "skilltree.h"
+#include "mainmenu.h"
+#include "savegamelist.h"
+#include "chatline.h"
+#include "partyinfo.h"
+#include "charcreate.h"
+#include "questinfo.h"
+#include "minimapwindow.h"
+#include "tradewindow.h"
+#include "optionswindow.h"
+#include "networkwindows.h"
+#include "worldmap.h"
+#include "messageboxes.h"
+#include "dialoguewindow.h"
+#include "creditswindow.h"
+//#include "music.h"
+#include "tooltipmanager.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+// Access the OS clipboard.
+#include "clipboard.h"
+
+// Allow the use of the sound manager.
+#include "gussound.h"
+
+
+#ifdef SUMWARS_BUILD_TOOLS
+#include "debugpanel.h"
+#include "contenteditor.h"
+#endif
+
+// Generic colour settings.
+#include "tooltipsettings.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+using gussound::SoundManager;
+
+
+MainWindow::MainWindow(Ogre::Root* ogreroot, CEGUI::System* ceguisystem,Ogre::RenderWindow* window,Document* doc)
+{
+	m_ogre_root = ogreroot;
+	m_cegui_system = ceguisystem;
+	m_window = window;
+	m_document = doc;
+	m_scene_manager = m_ogre_root->getSceneManager("DefaultSceneManager");
+
+	// Initialisieren
+	bool res = init();
+	if (res==false)
+	{
+		ERRORMSG("GUI erzeugen fehlgeschlagen");
+	}
+	
+	m_key =0;
+	m_highlight_id =0;
+	m_ready_to_start = false;
+}
+
+bool MainWindow::init()
+{
+	bool result = true;
+
+	m_ceguiSkinName = Options::getInstance ()->getCeguiSkin ();
+	SW_DEBUG ("Main Window (init): Cegui skin name found in options as: [%s]", m_ceguiSkinName.c_str ());
+
+	// Set-up the main menu.
+	SW_DEBUG ("Setting up the root window.");
+	result &= setupRootWindow();
+
+	// Initialize the input devices
+	SW_DEBUG ("Initializing input devices.");
+	result &= initInputs();
+
+	SW_DEBUG ("Initializing graphics.");
+	GraphicManager::init();
+
+	// Set-up the main menu.
+	SW_DEBUG ("Initializing main menu.");
+	result &= setupMainMenu();
+	CEGUIUtility::addChildWidget (m_root_window, m_main_menu);
+
+	// Once the main menu is created, set it as the root sheet. It shall be used in the game screen set-up.
+	CEGUIUtility::setRootSheet (CEGUI::System::getSingletonPtr(), m_root_window);
+
+	// Set-up the main game window/screen
+	SW_DEBUG ("Initializing main game screen.");
+	result &= setupGameScreen();
+	CEGUIUtility::addChildWidget (m_root_window, m_game_screen);
+
+	// Dump the contents to the log for later.
+	//CEGUIUtility::dumpFullWindowToLog (m_root_window);
+
+	return result;
+}
+
+
+MainWindow::~MainWindow()
+{
+	m_ois->destroyInputObject(m_mouse);
+	m_ois->destroyInputObject(m_keyboard);
+	OIS::InputManager::destroyInputSystem(m_ois);
+
+	// Dynamisch angelegte Objekte loeschen
+	delete m_scene;
+}
+
+bool MainWindow::initInputs()
+{
+	DEBUGX("init inputs");
+	OIS::ParamList pl;
+	// Handle fuer das aktuelle Fenster
+	unsigned long hWnd;
+	m_window->getCustomAttribute("WINDOW", &hWnd);
+	// OIS mitteilen fuer welches Fenster die Eingaben abgefangen werden sollen
+	pl.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
+
+	if(!Options::getInstance()->getGrabMouseInWindowedMode() && !m_window->isFullScreen())
+	{
+	#ifndef WIN32
+		pl.insert( std::make_pair(std::string("x11_mouse_grab"), std::string("false") ) );
+		pl.insert( std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
+	#else
+		pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
+		pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
+		pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
+		pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
+	#endif
+	}
+
+	m_ois = OIS::InputManager::createInputSystem( pl );
+
+	// Maus initialisieren
+	m_mouse = static_cast<OIS::Mouse*>(m_ois->createInputObject( OIS::OISMouse, true ));
+	m_mouse->setEventCallback(this);
+	m_mouse->getMouseState().width = (int) m_window->getWidth();
+	m_mouse->getMouseState().height = (int) m_window->getHeight();
+
+	// Tastatur initialisieren
+	m_keyboard = static_cast<OIS::Keyboard*>(m_ois->createInputObject( OIS::OISKeyboard, true));
+	m_keyboard->setEventCallback(this);
+	m_keyboard->setTextTranslation (OIS::Keyboard::Unicode);
+	return true;
+}
+
+
+bool MainWindow::setupRootWindow ()
+{
+	try
+	{
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+		// Oberstes Fenster der Hauptmenue Schicht
+		m_root_window = win_mgr.createWindow("DefaultWindow", "SW");
+		m_root_window->setMousePassThroughEnabled (true);
+	}
+	catch (CEGUI::Exception & e)
+	{
+		ERRORMSG("Error message: %s",e.getMessage().c_str());
+		return false;
+	}
+
+	return true;
+}
+
+
+bool MainWindow::setupMainMenu()
+{
+	try
+	{
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+		// Oberstes Fenster der Hauptmenue Schicht
+		m_main_menu = win_mgr.createWindow("DefaultWindow", "MainMenu");
+
+		std::string layoutFile ("startscreen.layout");
+		CEGUI::Window* start_screen_holder = CEGUIUtility::loadLayoutFromFile (layoutFile);
+
+		SW_DEBUG ("Loaded layout file [%s]", layoutFile.c_str ());
+
+		if (start_screen_holder)
+		{
+			CEGUIUtility::addChildWidget (m_main_menu, start_screen_holder);
+			std::string widgetName;
+			CEGUI::Window* item;
+
+			//widgetName (CEGUIUtility::getNameForWidget("MainMenu/StartScreenRoot"));
+			//item = CEGUIUtility::getWindowForLoadedLayoutEx (start_screen_holder, widgetName);
+			//item->setMousePassThroughEnabled (true);
+			
+			widgetName = CEGUIUtility::getNameForWidget("StartScreenImage");
+			item = CEGUIUtility::getWindowForLoadedLayoutEx (start_screen_holder, widgetName);
+			item->setMousePassThroughEnabled (true);
+
+			widgetName = CEGUIUtility::getNameForWidget("LoadRessourcesProgressBar");
+			item = CEGUIUtility::getWindowForLoadedLayoutEx (start_screen_holder, widgetName);
+			item->setMousePassThroughEnabled (true);
+		}
+		else
+		{
+            ERRORMSG ("WARNING: Failed to load [%s]", layoutFile.c_str ());
+		}
+
+		SW_DEBUG ("Creating credits window");
+
+		CreditsWindow* crd = new CreditsWindow (m_document, m_ceguiSkinName);
+		m_sub_windows["CreditsWindow"] = crd;
+		crd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_main_menu, crd->getCEGUIWindow());
+
+		SW_DEBUG ("Creating main menu");
+
+		Window * wnd = new MainMenu(m_document, m_ceguiSkinName);
+		m_sub_windows["MainMenu"] = wnd;
+		wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow());
+
+		SW_DEBUG ("Creating character screen");
+
+		wnd = new CharCreate (m_document, m_ceguiSkinName);
+		m_sub_windows["CharCreate"] = wnd;
+		wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow());
+		
+		SW_DEBUG ("Creating options window");
+
+		wnd = new OptionsWindow(m_document,m_keyboard, m_ceguiSkinName);
+		m_sub_windows["Options"] = wnd;
+		wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_root_window, wnd->getCEGUIWindow());
+		
+		SW_DEBUG ("Creating game hosting screen");
+
+		wnd = new HostGameWindow(m_document);
+		m_sub_windows["HostGame"] = wnd;
+		wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow());
+		
+		SW_DEBUG ("Creating game joining screen");
+
+		wnd = new JoinGameWindow(m_document);
+		m_sub_windows["JoinGame"] = wnd;
+		wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true);
+		CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow());
+		
+	// Verbinden mit dem Document
+	}
+	catch (CEGUI::Exception & e)
+	{
+		ERRORMSG("Error message: %s",e.getMessage().c_str());
+		return false;
+	}
+	return true;
+}
+
+void MainWindow::update(float time)
+{
+	// Eingaben abfangen
+	m_mouse->capture();
+	m_keyboard->capture();
+
+	TooltipManager::getSingleton().update(time);
+
+#ifdef SUMWARS_BUILD_TOOLS
+	DebugPanel::getSingleton().update(m_keyboard, m_mouse);
+	ContentEditor::getSingleton().update(m_keyboard, m_mouse);
+#endif
+
+	if (m_document->getGUIState()->m_left_mouse_pressed || m_document->getGUIState()->m_right_mouse_pressed)
+	{
+		Vector pos = getIngamePos(m_mouse->getMouseState().X.abs,m_mouse->getMouseState().Y.abs);
+		m_document->getGUIState()->m_clicked = pos;
+	}
+	
+	// Tastenwiederholung erzeugen
+	if (m_key !=0)
+	{
+		if (m_key_repeat)
+		{
+			if ( m_key_repeat_timer.getTime()>60)
+			{
+				m_key_repeat_timer.start();
+				CEGUIUtility::injectChar (m_cegui_system, m_key);
+				
+				// Sonderbehandlung fuer Backspace
+				if (m_key == 8)
+				{
+					CEGUIUtility::injectKeyDown (m_cegui_system, OIS::KC_BACK);
+				}
+			}
+		}
+		else
+		{
+			if ( m_key_repeat_timer.getTime()>400)
+			{
+				m_key_repeat_timer.start();
+				m_key_repeat = true;
+			}
+		}
+	}
+
+	
+	if (m_document->getModified() & Document::SAVEGAME_MODIFIED)
+	{
+		m_scene->updateCharacterView();
+		m_document->setModified(m_document->getModified() & (~Document::SAVEGAME_MODIFIED));
+	}
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	// Sprache anpassen
+	if (Gettext::getLocaleChanged())
+	{
+		DEBUGX("language changed");
+		std::map<std::string, Window*>::iterator it;
+		for (it= m_sub_windows.begin(); it != m_sub_windows.end(); ++it)
+		{
+			it->second->updateTranslation();
+		}
+	}
+	
+	// Flags, welche Fenster gezeigt werden
+	int wflags = m_document->getGUIState()->m_shown_windows;
+
+	
+	
+	// Testen ob die Anzeige der Fenster geaendert werden muss
+	if (m_document->getModified() & Document::GUISHEET_MODIFIED)
+	{
+		if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU)
+		{
+			updateMainMenu();
+			//CEGUIUtility::setRootSheet (m_cegui_system, m_main_menu);
+			m_main_menu->show ();
+			m_main_menu->activate ();
+			m_game_screen->hide ();
+
+			//MusicManager::instance().stop();
+			//SoundManager::getPtr ()->getMusicPlayer ()->stop ();
+		}
+
+		if (m_document->getGUIState()->m_sheet ==  Document::GAME_SCREEN)
+		{
+			//CEGUIUtility::setRootSheet (m_cegui_system, m_game_screen);
+			m_game_screen->show ();
+			m_game_screen->activate ();
+			m_main_menu->hide ();
+
+			//MusicManager::instance().stop();
+			//SoundManager::getPtr ()->getMusicPlayer ()->stop ();
+			
+			// one silent update of the belt
+			// to avoid silly sounds on startup
+			static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(true);
+			m_sub_windows["ControlPanel"]->update();
+			static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
+			
+		}
+		m_document->setModified(m_document->getModified() & (~Document::GUISHEET_MODIFIED));
+	}
+	
+	// Testen ob Anzeige der Subfenster geaendert werden muss
+	if (m_document->getModified() & Document::WINDOWS_MODIFIED)
+	{
+		DEBUGX("new shown windows %x",wflags);
+
+		/*// Auswahlliste Savegames  anzeigen wenn entsprechendes Flag gesetzt
+		CEGUI::FrameWindow* savelist = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("SavegameMenu");
+		if (wflags & Document::SAVEGAME_LIST)
+		{
+			
+			savelist->setVisible(true);
+			m_sub_windows["SavegameList"]->update();
+		}
+		else
+		{
+			savelist->setVisible(false);
+		}*/
+
+		// Menu Spielstart anzeigen wenn entsprechendes Flag gesetzt
+		CEGUI::String widgetName = CEGUIUtility::getNameForWidget("MainMenu/MainMenuRoot");
+		CEGUI::FrameWindow* start_menu = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::getWindow (widgetName));
+
+		MainMenu* main_menu = static_cast<MainMenu*>(m_sub_windows["MainMenu"]);
+		if (wflags & Document::START_MENU)
+		{
+			if (start_menu)
+			{
+				start_menu->setVisible (true);
+			}
+			if (main_menu)
+			{
+				main_menu->setSavegameListVisible (true);
+			}
+		}
+		else
+		{
+			if (wflags & Document::CHAR_CREATE)
+			{
+				if (start_menu)
+				{
+					start_menu->setVisible(true);
+				}
+				if (main_menu)
+				{
+					main_menu->setSavegameListVisible(false);
+				}
+			}
+			else
+			{
+				if (start_menu)
+				{
+					start_menu->setVisible(false);
+				}
+			}
+		}
+		
+		CEGUI::FrameWindow* credits = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("MainMenu/CreditsWindow_Holder");
+		if (wflags & Document::CREDITS)
+		{
+			credits->setVisible(true);
+		}
+		else
+		{
+			credits->setVisible(false);
+		}
+		
+		CEGUI::FrameWindow* host_game = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("MainMenu/HostGameWindow_Holder");
+		if (wflags & Document::HOST_GAME)
+		{
+			m_sub_windows["HostGame"]->update();
+			host_game->setVisible(true);
+		}
+		else
+		{
+			host_game->setVisible(false);
+		}
+		
+		CEGUI::FrameWindow* join_game = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("MainMenu/JoinGameWindow_Holder");
+		if (wflags & Document::JOIN_GAME)
+		{
+			m_sub_windows["JoinGame"]->update();
+			join_game->setVisible(true);
+		}
+		else
+		{
+			join_game->setVisible(false);
+		}
+		
+		CEGUI::FrameWindow* options = 0;
+		if (CEGUIUtility::isWindowPresent ("OptionsWindow_Holder"))
+		{
+			options = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("OptionsWindow_Holder");
+		}
+		else
+		{
+			options = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("OptionsWindow");
+		}
+		if (wflags & Document::OPTIONS)
+		{
+			static_cast<OptionsWindow*>(m_sub_windows["Options"])->reset();
+			options->setVisible(true);
+			options->activate ();
+		}
+		else
+		{
+			options->setVisible(false);
+		}
+		
+		
+		CEGUI::FrameWindow* char_create = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("MainMenu/CharCreate");
+		if (wflags & Document::CHAR_CREATE)
+		{
+			if (!char_create->isVisible())
+			{	
+				static_cast<CharCreate*>(m_sub_windows["CharCreate"])->updateClassList();
+			}
+			char_create->setVisible(true);
+			char_create->activate();
+		}
+		else
+		{
+			char_create->setVisible(false);
+		}
+        
+		CEGUI::FrameWindow* error_dialog = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("ErrorDialogWindow");
+        if (wflags & Document::MESSAGE)
+        {
+            m_sub_windows["errorDialog"]->update();
+            error_dialog->setVisible(true);
+			error_dialog->activate();
+            //error_dialog->setModalState(true);
+        }
+        else
+        {
+            error_dialog->setVisible(false);
+            //error_dialog->setModalState(false);
+        }
+
+		if (m_document->getGUIState()->m_sheet ==  Document::GAME_SCREEN)
+		{
+			// Charinfo anzeigen wenn entsprechendes Flag gesetzt
+			CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/CharInfo_Holder");
+			if (wflags & Document::CHARINFO)
+			{
+				char_info->setVisible(true);
+			}
+			else
+			{
+				char_info->setVisible(false);
+			}
+	
+			// Inventar anzeigen wenn entsprechendes Flag gesetzt
+			CEGUI::FrameWindow* inventory = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/Inventory_Holder");
+			if (wflags & Document::INVENTORY)
+			{
+				if (!inventory->isVisible())
+				{
+					inventory->setVisible(true);
+					// make one silent update to avoid that new inventory items play sounds
+					static_cast<ItemWindow*>(m_sub_windows["Inventory"])->setSilent(true);
+					m_sub_windows["Inventory"]->update();
+					static_cast<ItemWindow*>(m_sub_windows["Inventory"])->setSilent(false);
+				}
+			}
+			else
+			{
+				inventory->setVisible(false);
+				static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
+			}
+			
+			// show/hide control panel
+			CEGUI::FrameWindow* control_panel = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/ControlPanel_Holder");
+			if (wflags & Document::CONTROL_PANEL)
+			{
+				if (!control_panel->isVisible())
+				{
+					control_panel->setVisible(true);
+					
+					// one silent update of the belt
+					// to avoid silly sounds on startup
+					static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(true);
+					m_sub_windows["ControlPanel"]->update();
+					static_cast<ItemWindow*>(m_sub_windows["ControlPanel"])->setSilent(false);
+				}
+			}
+			else
+			{
+				control_panel->setVisible(false);
+			}
+			
+			// QuestInfo anzeigen wenn entsprechendes Flag gesetzt
+			CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/QuestInfo_Holder");
+			if (wflags & Document::QUEST_INFO)
+			{
+				quest_info->setVisible(true);
+				m_sub_windows["QuestInfo"]->update();
+			}
+			else
+			{
+				quest_info->setVisible(false);
+			}
+			
+			CEGUI::FrameWindow* minimap = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/MinimapWindow_Holder");
+			if (wflags & Document::MINIMAP)
+			{
+				minimap->setVisible(true);
+			}
+			else
+			{
+				minimap->setVisible(false);
+			}
+			
+			CEGUI::FrameWindow* trade = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/TradeWindow_Holder");
+			if (wflags & Document::TRADE)
+			{
+								
+				if (!trade->isVisible())
+				{
+					static_cast<TradeWindow*>(m_sub_windows["Trade"])->reset();
+					trade->setVisible(true);
+					
+					// make one silent update to avoid that new inventory items play sounds
+					static_cast<ItemWindow*>(m_sub_windows["Trade"])->setSilent(true);
+					m_sub_windows["Trade"]->update();
+					static_cast<ItemWindow*>(m_sub_windows["Trade"])->setSilent(false);
+				}
+			}
+			else
+			{
+				trade->setVisible(false);
+			}
+			
+			CEGUI::FrameWindow* worldmap = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/WorldmapWindow_Holder");
+			if (wflags & Document::WORLDMAP)
+			{
+				m_sub_windows["Worldmap"]->update();
+				worldmap->setVisible(true);
+			}
+			else
+			{
+				worldmap->setVisible(false);
+			}
+			
+			CEGUI::FrameWindow* save_exit = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/SaveExitWindow");
+			if (wflags & Document::SAVE_EXIT)
+			{
+				save_exit->setVisible(true);
+				save_exit->setModalState(true);
+			}
+			else
+			{
+				save_exit->setVisible(false);
+				save_exit->setModalState(false);
+			}
+			
+			// Chat Fenster anzeigen wenn entsprechendes Flag gesetzt
+			CEGUI::FrameWindow* chat_window = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/Chatline");
+			if (wflags & Document::CHAT)
+			{
+				// Fokus setzen, wenn das Fenster gerade geoeffnet wurde
+				if (!chat_window->isVisible())
+				{
+					CEGUI::Editbox* chatline;
+					chatline = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindow ("GameScreen/Chatline"));
+					chat_window->setVisible(true);
+					chatline->activate();
+				}
+				
+				chat_window->setVisible(true);
+			}
+			else
+			{
+				chat_window->setVisible(false);
+				// Chatzeile deaktivieren
+				CEGUI::Editbox* chatline;
+				chatline = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindow ("GameScreen/Chatline"));
+				chatline->deactivate();
+			}
+			
+			CEGUI::FrameWindow* party_info = (CEGUI::FrameWindow*) CEGUIUtility::getWindow ("GameScreen/PartyInfo");
+			if (wflags & Document::PARTY)
+			{
+				party_info->setVisible(true);
+			}
+			else
+			{
+				party_info->setVisible(false);
+			}
+	
+			if (m_document->getLocalPlayer()!=0)
+			{
+				// Skilltree anzeigen wenn entsprechendes Flag gesetzt
+				
+				CEGUI::TabControl* skilltree = (CEGUI::TabControl*) CEGUIUtility::getWindow ("GameScreen/Skilltree_Holder");
+				if (wflags & Document::SKILLTREE)
+				{
+					skilltree->setVisible(true);
+				}
+				else
+				{
+					skilltree->setVisible(false);
+				}
+				
+			}
+		}
+		
+		m_document->setModified(m_document->getModified() & ~Document::WINDOWS_MODIFIED);
+	}
+	
+	if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU)
+	{
+		updateMainMenu();
+	}
+	
+	m_sub_windows["CreditsWindow"]->update();
+	
+	if (wflags & Document::OPTIONS)
+	{
+		// Fenster Optionen aktualisieren
+		m_sub_windows["Options"]->update();
+	}
+
+	// Musik aktualisieren
+	updateSound();
+
+	// Objekte aus dem Dokument darstellen
+	if (m_document->getLocalPlayer()!=0 && m_document->getLocalPlayer()->getRegion()!=0)
+	{
+		// ObjectInfo aktualisieren
+		updateObjectInfo();
+		
+		updateItemInfo();
+
+		updateRegionInfo();
+		updateChatContent();
+
+		updateFloatingText();
+		
+		// Szene aktualisieren
+		m_scene->update(time);
+		
+		// Bild am Curso aktualisieren
+		updateCursorItemImage();
+		
+		// Informationen ueber Partymitglieder aktualisieren
+		updatePartyInfo();
+
+		if (wflags & Document::CHARINFO)
+		{
+			// Fenster CharacterInfo aktualisieren
+			m_sub_windows["CharInfo"]->update();
+		}
+
+		if (wflags & Document::CHAT)
+		{
+			// Fenster CharacterInfo aktualisieren
+			m_sub_windows["Chatline"]->update();
+		}
+
+		if (wflags & Document::MINIMAP)
+		{
+			// Fenster Minimap aktualisieren
+			m_sub_windows["Minimap"]->update();
+		}
+		
+		
+		// Steuerleiste aktualisieren
+		m_sub_windows["ControlPanel"]->update();
+
+
+		if (wflags & Document::INVENTORY)
+		{
+			// Fenster Inventar aktualisieren
+			m_sub_windows["Inventory"]->update();
+		}
+		if (wflags & Document::SKILLTREE)
+		{
+			// Skilltree aktualisieren
+			m_sub_windows["SkillTree"]->update();
+		}
+		
+		if (wflags & Document::PARTY)
+		{
+			// Skilltree aktualisieren
+			m_sub_windows["PartyInfo"]->update();
+		}
+		
+		if (wflags & Document::TRADE)
+		{
+			// Skilltree aktualisieren
+			m_sub_windows["Trade"]->update();
+		}
+		
+		m_sub_windows["DialogueWindow"]->update();
+		
+		// + Buttons fuer Levelup aktualisieren
+		bool vis = false;
+		CEGUI::PushButton* btn;
+		btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindow ("GameScreen/CharInfoUpgradeButton"));
+		if (!(wflags & Document::CHARINFO) && m_document->getLocalPlayer()->getAttributePoints() >0)
+		{
+			vis = true;
+		}
+		
+		if (btn->isVisible() != vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		vis = false;
+		btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindow ("GameScreen/SkillUpgradeButton"));
+		if (!(wflags & Document::SKILLTREE) && m_document->getLocalPlayer()->getSkillPoints() >0)
+		{
+			vis = true;
+		}
+		
+		if (btn->isVisible() != vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		/*
+		vis = false;
+		CEGUI::Window* label = CEGUIUtility::getWindow ("MinimapImage");
+		if (wflags & Document::MINIMAP)
+		{
+			vis = true;
+		}
+		if (label->isVisible() != vis)
+		{
+			if (vis)
+			{
+				label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("minimap", "minimap_img")); 
+			}
+			label->setVisible(vis);
+		}
+		*/
+	}
+}
+
+
+bool MainWindow::setupGameScreen()
+{
+	DEBUGX("setup game screen");
+	try
+	{
+		// Szene erzeugen
+		m_scene = new Scene(m_document,m_window);
+
+		// GUI Elemente erzeugen
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+		// Oberstes Fenster der Hauptmenue Schicht
+		m_game_screen =  win_mgr.createWindow("DefaultWindow", "GameScreen");
+        m_game_screen->setMousePassThroughEnabled(true);
+
+		// Kontrollleiste anlegen
+		setupControlPanel();
+
+		// Inventar Fenster anlegen
+		setupInventory();
+
+		// CharInfo Fenster anlegen
+		setupCharInfo();
+
+		// Skilltree Fenster anlegen
+		setupSkilltree();
+		
+		setupQuestInfo();
+
+		// Leiste fuer Item/Objekt-Info anlegen
+		setupObjectInfo();
+		
+		setupItemInfo();
+		setupRegionInfo();
+		setupSaveExitWindow();
+        setupErrorDialogWindow();
+		setupChatContent();
+		
+		// Chatfenster anlegen
+		setupChatWindow();
+		
+		// Fenster fuer Partyinfos
+		setupPartyInfo();
+		
+		// Bild fuer das Item am Cursor
+		setupCursorItemImage();
+		
+		setupMinimap();
+		
+		setupTrade();
+		
+		setupWorldmap();
+
+		setupDialogWindow ();
+		
+		CEGUI::Window* label;
+		CEGUI::Window* temporary_parent = CEGUIUtility::getWindow ("MainMenu/MainMenuRoot");
+		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "CharacterPreviewImage");
+		CEGUIUtility::addChildWidget (temporary_parent, label);
+
+		label->setProperty("FrameEnabled", "false");
+		label->setProperty("BackgroundEnabled", "false");
+		label->setPosition(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.15)));
+		CEGUIUtility::setWidgetSizeRel (label, 0.5f, 0.7f);
+		label->setMousePassThroughEnabled(true);
+		label->setInheritsAlpha(false);
+#ifdef CEGUI_07
+		label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("character", "character_img")); 
+#else
+		label->setProperty("Image", "character_img"); 
+#endif
+		label->setVisible(false);
+		
+		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "CharacterPreviewBackground");
+		CEGUIUtility::addChildWidget (temporary_parent, label);
+		label->setProperty("FrameEnabled", "false");
+		label->setProperty("BackgroundEnabled", "true");
+		label->setPosition(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.0)));
+		CEGUIUtility::setWidgetSizeRel (label, 0.5f, 1.0f);
+		label->setMousePassThroughEnabled(true);
+		label->setVisible(false);
+		label->moveToBack();
+	}
+	catch (CEGUI::Exception & e)
+	{
+		ERRORMSG("Error message: %s",e.getMessage().c_str());
+		return false;
+	}
+
+	return true;
+}
+
+void MainWindow::setupControlPanel()
+{
+	Window* wnd = new ControlPanel(m_document);
+	m_sub_windows["ControlPanel"] = wnd;
+	
+	
+	// Charakterinfo anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	
+	// zwei weitere Buttons die Skilltree bzw Charinfo oeffnen, wenn Punkte zu verteilen sind
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	
+	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), "CharInfoUpgradeButton"));
+	CEGUIUtility::addChildWidget (m_game_screen, btn);
+	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim( 0.65f)));
+	CEGUIUtility::setWidgetSizeRel (btn, 0.05f, 0.07f);
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonCharInfoClicked, static_cast<ControlPanel*>(wnd)));
+	btn->setVisible(false);
+	if (btn->isPropertyPresent ("NormalImage"))
+	{
+		btn->setProperty("NormalImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+	}
+	if (btn->isPropertyPresent ("DisabledImage"))
+	{
+		btn->setProperty("DisabledImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased")); 	 
+	}
+	if (btn->isPropertyPresent ("HoverImage"))
+	{
+		btn->setProperty("HoverImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased")); 	 
+	}
+	if (btn->isPropertyPresent ("PushedImage"))
+	{
+		btn->setProperty("PushedImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnPressed"));
+	}
+	
+	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), "SkillUpgradeButton"));
+	CEGUIUtility::addChildWidget (m_game_screen, btn);
+
+	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.92f), cegui_reldim( 0.65f)));
+	CEGUIUtility::setWidgetSizeRel (btn, 0.05f, 0.07f);
+	btn->setWantsMultiClickEvents(false);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ControlPanel::onButtonSkilltreeClicked, static_cast<ControlPanel*>(wnd)));
+	btn->setVisible(false);
+	
+	
+	if (btn->isPropertyPresent ("NormalImage"))
+	{
+		btn->setProperty("NormalImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+	}
+	if (btn->isPropertyPresent ("DisabledImage"))
+	{
+		btn->setProperty("DisabledImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+	}
+	if (btn->isPropertyPresent ("HoverImage"))
+	{
+		btn->setProperty("HoverImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+	}
+	if (btn->isPropertyPresent ("PushedImage"))
+	{
+		btn->setProperty("PushedImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnPressed"));
+	}
+
+}
+
+void MainWindow::setupCharInfo()
+{
+	Window* wnd = new CharInfo(m_document);
+	m_sub_windows["CharInfo"] = wnd;
+	
+	
+	// Charakterinfo anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+void MainWindow::setupDialogWindow()
+{
+	Window* wnd = new DialogueWindow(m_document, m_scene, m_ceguiSkinName);
+	m_sub_windows["DialogueWindow"] = wnd;
+
+	// Connect the new widget to the game screen.
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+void MainWindow::setupInventory()
+{
+	
+	Window* wnd = new Inventory(m_document);
+	m_sub_windows["Inventory"] = wnd;
+	
+	// Inventar anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+	
+
+}
+
+void MainWindow::setupQuestInfo()
+{
+	Window* wnd = new QuestInfo (m_document, m_ceguiSkinName);
+	m_sub_windows["QuestInfo"] = wnd;
+	
+	// anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+
+void MainWindow::setupSkilltree()
+{
+	SkillTree* wnd = new SkillTree (m_document ,m_keyboard, m_ceguiSkinName);
+	m_sub_windows["SkillTree"] = wnd;
+	
+	// Skilltree anfangs ausblenden
+
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+
+}
+
+void MainWindow::setupChatWindow()
+{
+	Window* wnd = new ChatLine(m_document, m_ceguiSkinName);
+	m_sub_windows["Chatline"] = wnd;
+	
+	
+	// Inventar anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+void MainWindow::setupCursorItemImage()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	m_custom_cursor = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), "CursorItemImage");
+	CEGUIUtility::addChildWidget (m_root_window, m_custom_cursor);
+
+	m_custom_cursor->setProperty("FrameEnabled", "false");
+	m_custom_cursor->setProperty("BackgroundEnabled", "false");
+	m_custom_cursor->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05)));
+	CEGUIUtility::setWidgetSizeRel (m_custom_cursor, 0.04f, 0.06f);
+
+	// Just use a default image.
+	m_custom_cursor->setProperty ("Image", "Portrait/Portrait");
+
+	m_custom_cursor->setVisible(false);
+	m_custom_cursor->setAlwaysOnTop(true);
+	m_custom_cursor->setMousePassThroughEnabled(true);
+	m_custom_cursor->setID(0);
+}
+
+void MainWindow::setupMinimap()
+{
+	Window* wnd = new MinimapWindow (m_document, m_ceguiSkinName);
+	m_sub_windows["Minimap"] = wnd;
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+}
+
+bool MainWindow::setupObjectInfo()
+{
+	DEBUGX("setup object info");
+
+	// Fenstermanager
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	// Leiste fuer Informationen
+	CEGUI::Window* monster_health_holder = CEGUIUtility::loadLayoutFromFile ("monsterhealthbar.layout");
+	if (monster_health_holder)
+	{
+		CEGUIUtility::addChildWidget (m_game_screen, monster_health_holder);
+	}
+	
+	return true;
+}
+
+bool MainWindow::setupItemInfo()
+{
+	DEBUGX("setup object info");
+
+	// Fenstermanager
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+
+	// Leiste fuer Informationen
+	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "ItemInfoLabel");
+	CEGUIUtility::addChildWidget (m_game_screen, label);
+	label->setProperty("FrameEnabled", "false");
+	label->setProperty("BackgroundEnabled", "true");
+	if (label->isPropertyPresent ("BackgroundColours"))
+	{
+		label->setProperty("BackgroundColours", "tl:77000000 tr:77000000 bl:77000000 br:77000000"); 
+	}
+	else if (label->isPropertyPresent ("BackgroundColour"))
+	{
+		label->setProperty("BackgroundColour", "B2000000"); 
+	}
+	label->setPosition(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.02f)));
+	CEGUIUtility::setWidgetSizeRel (label, 0.08f, 0.03f);
+	label->setText("");
+	label->setVisible(false);
+	label->setAlpha(0.9);
+	label->setProperty("MousePassThroughEnabled","true");
+
+	return true;
+}
+
+
+bool MainWindow::setupPartyInfo()
+{
+	
+	Window* wnd = new PartyInfo(m_document, m_ceguiSkinName);
+	m_sub_windows["PartyInfo"] = wnd;
+	
+	// PartyInfo anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::Window* img;
+	CEGUI::ProgressBar* bar;
+	
+	std::ostringstream stream;
+	
+	for (int i=0; i<7; i++)
+	{
+		stream.str("");
+		stream << "PartyMemberImage";
+		stream << i;
+		
+		img = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+		CEGUIUtility::addChildWidget (m_game_screen, img);
+		img->setProperty("FrameEnabled", "true");
+		img->setProperty("BackgroundEnabled", "true");
+		img->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f + 0.1f *i)));
+		CEGUIUtility::setWidgetSizeRel (img, 0.05f, 0.07f);
+		img->setID(i);
+		img->setVisible(false);
+		img->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&MainWindow::onPartyMemberClicked, this));
+		
+		stream.str("");
+		stream << "PartyMemberHealthBar";
+		stream << i;
+		
+		bar = static_cast<CEGUI::ProgressBar*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ProgressBar"), stream.str()));
+		CEGUIUtility::addChildWidget (m_game_screen, bar);
+		bar->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.08f+ 0.1f *i)));
+		CEGUIUtility::setWidgetSizeRel (bar, 0.05f, 0.02f);
+		bar->setProgress(1.0);
+		bar->setVisible(false);
+	}
+	
+	return true;
+}
+
+void MainWindow::setupTrade()
+{
+	Window* wnd = new TradeWindow(m_document, m_ceguiSkinName);
+	m_sub_windows["Trade"] = wnd;
+	
+	
+	// Inventar anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+
+void MainWindow::setupWorldmap()
+{
+	Window* wnd = new Worldmap (m_document, m_ceguiSkinName);
+	m_sub_windows["Worldmap"] = wnd;
+	
+	
+	// Inventar anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+void MainWindow::setupRegionInfo()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::Window* label;
+	label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "RegionInfoLabel");
+	CEGUIUtility::addChildWidget (m_game_screen, label);
+	label->setProperty("FrameEnabled", "false");
+	label->setProperty("BackgroundEnabled", "false");
+	label->setProperty("HorzFormatting", "HorzCentred");
+	label->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.05)));
+	CEGUIUtility::setWidgetSizeRel (label, 0.5f, 0.06f);
+	label->setVisible(false);
+	label->setAlwaysOnTop(true);
+	label->setMousePassThroughEnabled(true);
+	label->setID(0);
+}
+
+void MainWindow::setupSaveExitWindow()
+{
+	Window* wnd = new SaveExitWindow(m_document);
+	m_sub_windows["saveExit"] = wnd;
+	
+	// Inventar anfangs ausblenden
+	CEGUIUtility::addChildWidget (m_game_screen, wnd->getCEGUIWindow ());
+	wnd->getCEGUIWindow()->setVisible(false);
+}
+
+void MainWindow::setupErrorDialogWindow()
+{
+	Window* wnd = new ErrorDialogWindow (m_document);
+	m_sub_windows["errorDialog"] = wnd;
+	CEGUIUtility::addChildWidget (m_root_window, wnd->getCEGUIWindow ());
+	wnd->getCEGUIWindow()->setVisible(false);
+	
+	wnd = new WarningDialogWindow(m_document);
+	m_sub_windows["warningDialog"] = wnd;
+	CEGUIUtility::addChildWidget (m_root_window, wnd->getCEGUIWindow ());
+	wnd->getCEGUIWindow()->setVisible(false);
+
+#if 0
+	wnd = new MessageQuestionWindow (m_document);
+	m_sub_windows["questionDialog"] = wnd;
+	CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow());
+	wnd->getCEGUIWindow()->setVisible(false);
+#endif
+}
+
+void MainWindow::setupChatContent()
+{
+	SW_DEBUG ("Setting up chat content GUI window");
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::Window* label;
+	label = static_cast<CEGUI::MultiLineEditbox*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), "ChatContent"));
+	CEGUIUtility::addChildWidget (m_game_screen, label);
+	label->setProperty("FrameEnabled", "false");
+	//label->setProperty("BackgroundEnabled", "false");
+	label->setPosition(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.63f)));
+	CEGUIUtility::setWidgetSizeRel (label, 0.43f, 0.2f);
+	if (label->isPropertyPresent ("BackgroundColours"))
+	{
+		label->setProperty("BackgroundColours", "tl:44000000 tr:44000000 bl:44000000 br:44000000");
+	}
+	else if (label->isPropertyPresent ("BackgroundColour"))
+	{
+		label->setProperty("BackgroundColour", "B2000000");
+	}
+	label->setProperty("VertFormatting", "VertCentred");
+	label->setProperty("HorzFormatting", "WordWrapLeftAligned");
+	label->setText("");
+	label->setAlwaysOnTop(true);
+	label->setMousePassThroughEnabled(true);
+	label->setID(0);
+}
+
+void  MainWindow::setWindowExtents(int width, int height){
+	//Set Mouse Region.. if window resizes, we should alter this to reflect as well
+	const OIS::MouseState &ms = m_mouse->getMouseState();
+	ms.width = width;
+	ms.height = height;
+}
+
+
+void  MainWindow::updateMainMenu()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* img = 0;
+	if (CEGUIUtility::isWindowPresent ("MainMenu/StartScreenRoot"))
+	{
+		img  = CEGUIUtility::getWindow ("MainMenu/StartScreenRoot");
+		img->setMousePassThroughEnabled (true);
+	}
+	if (CEGUIUtility::isWindowPresent ("MainMenu/StartScreenRoot/StartScreenImage"))
+	{
+		img  = CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/StartScreenImage");
+		img->setMousePassThroughEnabled (true);
+	}
+	CEGUI::Window* label;
+	label = CEGUIUtility::getWindow ("MainMenu/MainMenuRoot/CharacterPreviewImage");
+	CEGUI::Window* label2;
+	label2 = CEGUIUtility::getWindow ("MainMenu/MainMenuRoot/CharacterPreviewBackground");
+	
+	if (0 != img)
+	{
+		int wflags = m_document->getGUIState()->m_shown_windows;
+		if (wflags & (Document::SAVEGAME_LIST | Document::CHAR_CREATE))
+		{
+			img->setVisible(false);
+		}
+		else
+		{
+			img->setVisible(true);
+		}
+	}
+	
+	m_sub_windows["MainMenu"]->update();
+}
+
+void  MainWindow::updateCharCreate()
+{
+	m_sub_windows["CharCreate"]->update();
+
+}
+
+
+void MainWindow::updateCursorItemImage()
+{
+	Player* player = m_document->getLocalPlayer();
+	Item* item = 0;
+	item = player->getEquipement()->getItem(Equipement::CURSOR_ITEM);
+	
+	
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label = CEGUIUtility::getWindowForLoadedLayoutEx (m_root_window, "CursorItemImage");
+	
+	if (item == 0)
+	{
+		// Kein Item mehr am Cursor
+		// Bild verstecken
+		
+		if (label->isVisible())
+		{
+			label->setVisible(false);
+		}
+	}
+	else
+	{
+		// Es befindet sich ein Item am Cursor
+		// Bild zeigen
+		
+		if (! label->isVisible())
+		{
+			label->setVisible(true);
+		}	
+		
+		// Groesse des Items am Cursor ermitteln
+		unsigned int size = item->m_size;
+
+			
+		if (size != label->getID())
+		{
+			// Groesse des Labels setzen
+			if (size == Item::BIG)
+			{
+				CEGUIUtility::setWidgetSizeRel (label, 0.060f, 0.075f);
+			}
+			else if (size == Item::MEDIUM)
+			{
+				CEGUIUtility::setWidgetSizeRel (label, 0.045f, 0.06f);
+			}
+			else if (size == Item::SMALL)
+			{
+				CEGUIUtility::setWidgetSizeRel (label, 0.033f, 0.043f);
+			}
+			
+			label->setID(size);
+		}
+		
+		std::ostringstream out_stream("");
+		out_stream<< ItemWindow::getItemImage(item->m_subtype);
+		
+		if (label->getProperty("Image")!=out_stream.str())
+		{
+			label->setProperty("Image", out_stream.str());
+			OIS::MouseEvent me(m_mouse,m_mouse->getMouseState ());
+			
+			mouseMoved(me);
+		}
+		
+	}
+}
+
+void MainWindow::updateObjectInfo()
+{
+	Player* player = m_document->getLocalPlayer();
+	Region* reg = player->getRegion();
+	if (reg ==0)
+		return;
+	
+	// Ogre Name des Objektes auf das der Mauszeiger zeigt
+	std::string objname = "";
+
+	// Fenstermanager
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label = CEGUIUtility::getWindow ("GameScreen/ObjectInfoRoot/ObjectInfoLabel");
+	CEGUI::Window* itmlabel = CEGUIUtility::getWindow ("GameScreen/ItemInfoLabel");
+	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("GameScreen/ObjectInfoRoot/MonsterHealthProgressBar"));
+	
+	
+	// Position der Maus
+	float x = m_mouse->getMouseState().X.abs;
+	float y = m_mouse->getMouseState().Y.abs;
+
+
+	// Position des Mausklicks relativ zum Viewport
+	Ogre::Viewport* viewport = m_scene->getViewport();
+	float relx = x*1.0/(viewport->getActualWidth());
+	float rely = y*1.0/(viewport->getActualHeight());
+
+	// Strahl von der Kamera durch den angeklickten Punkt
+	Ogre::Camera* camera = m_scene->getCamera();
+	Ogre::Ray ray = camera->getCameraToViewportRay(relx,rely);
+
+	// Query zum Anfragen auf getroffene Objekte
+	Ogre::RaySceneQuery * query = m_scene_manager->createRayQuery(ray);
+	query->setQueryTypeMask(Ogre::SceneManager::ENTITY_TYPE_MASK);
+	query->setSortByDistance (true);
+	query->setQueryMask(Scene::WORLDOBJECT | Scene::ITEM);
+	
+	// Anfrage ausfuehren
+	Ogre::RaySceneQueryResult& result = query->execute();
+	Ogre::RaySceneQueryResult::iterator it;
+	
+	int id=0;
+	int objid =0;
+	bool search_for_object = true;
+	
+	if (reg->getCutsceneMode () == true || player->getDialogue () != 0)
+	{
+		objid = 0;
+		search_for_object = false;
+	}
+	else if (m_mouse->getMouseState().buttons !=0)
+	{
+		// fokussiertes Objekt nicht wechseln, wenn Maustaste gedrueckt
+		if (m_document->getGUIState()->m_clicked_object_id != 0)
+		{
+			objid = m_document->getGUIState()->m_clicked_object_id;
+			GameObject* go = reg->getObject(objid);
+			search_for_object = false;
+			if (go == 0)
+			{
+				search_for_object = true;
+			}
+			else if (go->getState() != WorldObject::STATE_ACTIVE)
+			{
+				search_for_object = true;
+			}
+		}
+		else
+		{
+			search_for_object = false;
+		}
+	}
+	
+	if (search_for_object)
+	{
+
+		WorldObject* wo;
+		GameObject* go;
+		float dist, mindist = 100000;
+		for (it = result.begin(); it != result.end(); ++it)
+		{
+			dist = it->distance;
+			
+			// unsichtbare Objekte nicht fokussierbar
+			if (it->movable->getVisible() == false)
+			{
+				continue;
+			}
+			
+			try
+			{
+				id = Ogre::any_cast<int>(it->movable->getUserAny());
+			}
+			catch (Ogre::Exception&)
+			{
+				WARNING("Object %s has no ID",it->movable->getName().c_str());
+				continue;
+			}
+			DEBUGX("ray scene query dist %f obj %s mask %x id %i",it->distance, it->movable->getName().c_str(),it->movable->getQueryFlags(), id);
+			// nur aktive Objekte beruecksichtigen
+			go = reg->getGameObject(id);
+			if (go == 0)
+			{
+				continue;
+			}
+			if (go->getState() != WorldObject::STATE_ACTIVE)
+				continue;
+			
+			// verbuendete Einheiten bekommen einen Malus - dadurch selektiert man im Kampf bevorzugt Feinde
+			wo = dynamic_cast<WorldObject*>(go);
+			if (wo != 0)
+			{
+				if (wo->checkInteractionFlag(WorldObject::USABLE) == false)
+				{
+					continue;
+				}
+				
+				if (World::getWorld()->getRelation(m_document->getLocalPlayer()->getFraction(), wo->getFraction()) == Fraction::ALLIED)
+				{
+					dist *=10;
+				}
+			}
+			
+			// Pruefung gegen das Polygon
+			// get the entity to check
+			
+			Ogre::Entity *pentity = dynamic_cast<Ogre::Entity*>(it->movable);
+			bool rayhit = true;
+			if (((wo!=0 && wo->checkInteractionFlag(WorldObject::EXACT_MOUSE_PICKING)) || go->getType() == "DROPITEM")  && pentity != 0)
+			{
+				rayhit = false;
+				
+				// mesh data to retrieve
+				size_t vertex_count;
+				size_t index_count;
+				Ogre::Vector3 *vertices;
+				unsigned long *indices;
+	
+				// get the mesh information
+				Scene::getMeshInformation(pentity->getMesh(), vertex_count, vertices, index_count, indices,
+										pentity->getParentNode()->_getDerivedPosition(),
+										pentity->getParentNode()->_getDerivedOrientation(),
+										pentity->getParentNode()->_getDerivedScale());
+	
+				// test for hitting individual triangles on the mesh
+				for (int i = 0; i < static_cast<int>(index_count)-2; i += 3)
+				{
+					// check for a hit against this triangle
+					// I hope that volatile avoids that these variables are optimized out
+					volatile int index1 = indices[i];
+					volatile int index2 = indices[i+1];
+					volatile int index3 = indices[i+2];
+					if (index1 >=0 && index2>=0 && index3>=0
+						&& index1 < (int)vertex_count && index2 < (int)vertex_count &&  index3 < (int)vertex_count)
+					{
+					
+						std::pair<bool, Ogre::Real> hit = Ogre::Math::intersects(ray, vertices[index1],
+								vertices[index2], vertices[index3], true, false);
+		
+						// if it was a hit check if its the closest
+						if (hit.first)
+						{
+							if ( (hit.second < dist))
+							{
+								// this is the closest so far, save it off
+								dist = hit.second;
+							}
+							rayhit = true;
+						}
+					}
+					else
+					{
+						ERRORMSG("Invalid indices: %i %i %i",index1,index2,index3);
+					}
+				}
+	
+				// free the verticies and indicies memory
+				delete[] vertices;
+				delete[] indices;
+				
+				if (rayhit)
+				{
+					dist /=10;
+				}
+				
+				if (go->getType() == "DROPITEM")
+					rayhit = true;
+			}
+			
+			// Objekt wird vom Kamerastrahl geschnitten
+			// Distance zum Spieler ausrechnen
+			
+			if (dist<mindist && rayhit)
+			{
+				// Objekt ist das bisher naechste
+				objid = id;
+				mindist = dist;
+			}
+		}
+		m_document->getGUIState()->m_cursor_object=objname;
+
+	}
+	
+	if (objid==0)
+	{
+		// aktuell kein Objekt unterm Mauszeiger
+		m_document->getGUIState()->m_cursor_object_id =0;
+		m_document->getGUIState()->m_cursor_item_id =0;
+
+		label->setVisible(false);
+		bar->setVisible(false);
+		itmlabel->setVisible(false);
+			
+	}
+	
+	if (objid==player->getId())
+	{
+		label->setVisible(false);
+		bar->setVisible(false);
+		itmlabel->setVisible(false);
+		m_document->getGUIState()->m_cursor_object_id = objid;
+		objid=0;
+	}
+	
+	std::string highlightcol = "white";
+	std::string highlightmat = "_highlight_alpha_nodepth";
+	
+	std::string name;
+	std::ostringstream string_stream;
+	if (objid!=0)
+	{
+		// es gibt ein ein Objekt unterm Mauszeiger
+		// zur ID gehoerendes Objekt
+		GameObject* go = reg->getGameObject(objid);
+		if (go != 0)
+		{
+			DEBUGX("highlight object %i,",objid);
+			WorldObject* cwo = dynamic_cast<WorldObject*>(go);
+			Creature* cr;
+				
+			if (cwo !=0 && cwo->getState() == WorldObject::STATE_ACTIVE)
+			{
+				// Objekt existiert
+				m_document->getGUIState()->m_cursor_object_id = objid;
+				m_document->getGUIState()->m_cursor_item_id =0;
+				cr = dynamic_cast<Creature*>(cwo);
+				if (cr != 0)
+				{
+					if (!bar->isVisible())
+						bar->setVisible(true);
+					
+					// Objekt ist ein Lebewesen
+					// Lebenspunkte anfuegen
+					string_stream<< cr->getName().getTranslation();
+					float perc = cr->getDynAttr()->m_health / cr->getBaseAttrMod()->m_max_health;
+					if (bar->getProgress() != perc)
+					{
+						bar->setProgress(perc);
+					}
+				}
+				else
+				{
+					bar->setVisible(false);
+				}
+				
+				if (!label->isVisible())
+				{
+					label->setVisible(true);
+				}
+				name = string_stream.str();
+				if (label->getText() != (CEGUI::utf8*) name.c_str())
+				{
+					label->setText((CEGUI::utf8*) name.c_str());
+				}
+				
+				if (World::getWorld()->getRelation(cwo->getFraction(),player) == Fraction::HOSTILE)
+				{
+					highlightcol = Options::getInstance()->getEnemyHighlightColor();
+				}
+			}
+			else
+			{
+				label->setVisible(false);
+				bar->setVisible(false);
+			}
+			
+			DropItem* di = dynamic_cast<DropItem*>(go);
+			if (di != 0)
+			{
+				Item* itm = di->getItem();
+				m_document->getGUIState()->m_cursor_item_id = id;
+				m_document->getGUIState()->m_cursor_object_id =0;
+				
+				if (!m_document->getGUIState()->m_item_labels)
+				{
+					itmlabel->setVisible(true);
+				}
+				
+				name = itm->getName();
+				
+				float len = itmlabel->getArea().getWidth().d_scale;
+				
+				if (itmlabel->getText() != (CEGUI::utf8*) name.c_str())
+				{
+					const CEGUI::Font* font = itmlabel->getFont();
+					float width = font->getTextExtent((CEGUI::utf8*) name.c_str());
+					CEGUIUtility::Rectf rect = m_game_screen->getInnerRectClipper();
+					len = width / rect.getWidth();
+					
+					itmlabel->setText((CEGUI::utf8*) name.c_str());
+				}
+				
+				if (fabs( itmlabel->getArea().getWidth().d_scale - len) > 0.001)
+				{
+					DEBUGX("old value %f new value %f",itmlabel->getArea().getWidth().d_scale, len);
+					CEGUIUtility::setWidgetSizeRel (itmlabel, len, 0.03f);
+				}
+				
+				std::string propold = itmlabel->getProperty("TextColours").c_str();
+				std::string propnew = "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF";
+				if (itm->m_rarity == Item::MAGICAL)
+				{
+					std::string magicColour = TooltipSettings::getGroundItemMagicalHexColourCode ();
+					std::stringstream ssColour;
+					ssColour << "tl:" << magicColour << " tr:" << magicColour << " bl:" << magicColour << " br:" << magicColour;
+					propnew = ssColour.str ();
+					//propnew = "tl:FF8888FF tr:FF8888FF bl:FF8888FF br:FF8888FF";
+				}
+				if (propold != propnew)
+				{
+					itmlabel->setProperty("TextColours", propnew); 
+				}
+				
+				
+				std::pair<float,float> rpos = m_scene->getProjection(di->getPosition());
+				itmlabel->setPosition(CEGUI::UVector2(CEGUI::UDim(MathHelper::Max(0.0,rpos.first-0.03),0), CEGUI::UDim(MathHelper::Max(0.0,rpos.second-0.05),0)));
+			}
+			else
+			{
+				itmlabel->setVisible(false);
+			}
+		}
+		else
+		{
+			m_document->getGUIState()->m_cursor_object_id =0;
+			label->setVisible(false);
+			bar->setVisible(false);
+			objid = 0;
+		}
+	}
+
+	int hlid = objid;
+	if (hlid == player->getId())
+		hlid =0;
+	
+	if (m_highlight_id !=  hlid)
+	{
+		GraphicObject* grobj = m_scene->getGraphicObject(m_highlight_id);
+		if (grobj != 0)
+		{
+			grobj->setHighlight(false, highlightcol + highlightmat);
+		}
+		
+		if (objid != 0)
+		{
+			grobj = m_scene->getGraphicObject(hlid);
+			if (grobj != 0)
+			{
+				grobj->setHighlight(true, highlightcol + highlightmat);
+			}
+		}
+		m_highlight_id = hlid;
+	}
+
+}
+
+void MainWindow::updateItemInfo()
+{
+	// Zaehler wie viele Labels fuer Items existieren
+	static int lcount =0;
+	
+	// Fenstermanager
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label = CEGUIUtility::getWindow ("GameScreen/ItemInfoLabel");
+	
+	
+	
+	DropItem* di;
+	
+	Player* player = m_document->getLocalPlayer();
+	Vector plpos = player->getShape()->m_center;
+	
+	DropItemMap& itms = player->getRegion()->getDropItems();
+	DropItemMap::iterator it;
+	
+	if (m_document->getGUIState()->m_item_labels)
+	{
+		label->setVisible(false);
+		
+		// Alt gedrueckt
+		// fuer alle Items ein Label erstellen
+		std::ostringstream stream;
+		int nr =0;
+		std::string name;
+		std::pair<float,float> rpos;
+		
+		float height = 0.030;
+		int num = (int) (0.9/height);
+		// fuer jede 0.025 hohe Spalte ein Element des Vektors
+		// fuer jede Spalte eine Liste von Wertepaaren: Anfang, Ende
+		std::vector< std::list < std::pair<float,float> > > itempos(num);
+		
+		// Lokales Koordinatensystem fuer die Items herstellen
+		Vector pu,pl,pll,pmr,pml,ox,oy;
+		pu = getIngamePos(0.5,0.1,true);
+		pl = getIngamePos(0.5,0.9,true);
+		pll = getIngamePos(0,0.9,true);
+		pmr = getIngamePos(1.0,0.5,true);
+		pml = getIngamePos(0,0.5,true);
+		
+		oy = pu - pl;
+		ox = pmr - pml;
+		
+		Vector po = pll - pml;
+		po.projectOn(ox);
+		po = pll - po;
+		
+		// Abfangen numerischer Schwankungen
+		static Vector oldoy = Vector(0,-1);
+		
+		if (fabs(oldoy.angle(oy)) < 0.01 && fabs(oy.getLength() - oldoy.getLength())<0.01 )
+		{
+			oy = oldoy;
+		}
+		else
+		{
+			oldoy = oy;
+		}
+		DEBUGX("oy %f %f",oy.m_x, oy.m_y);
+		
+		// Skalierung der Achsen
+		float oxl = ox.getLength();
+		float oyl = oy.getLength();
+		
+		//float xscal = oxl;
+		float yscal = oyl*height/0.9;
+		
+		ox.normalize();
+		oy.normalize();
+
+		DEBUGX("scal %f %f",xscal,yscal);
+		
+		// Ursprung des neuen Koordinatensystems
+		Vector ypart = po;
+		float ylen = ypart*oy;
+		ypart.projectOn(oy);
+		Vector xpart = po - ypart;
+		
+		DEBUGX("xpart %f %f",xpart.m_x, xpart.m_y);
+		DEBUGX("ypart %f %f",ypart.m_x, ypart.m_y);
+		float yoffs = ylen/yscal - roundf(ylen/yscal);
+		
+		
+		Vector o = xpart + oy*(yscal*( roundf(ylen/yscal)));
+		
+		DEBUGX("pll %f %f %f",pll.m_x, pll.m_y,ylen);
+		DEBUGX("o %f %f ", o.m_x, o.m_y);
+		
+		
+		DEBUGX("\nitems\n");
+		
+		// Distanz zur wahren Position
+		float optdist,dist;
+		int optrow;
+		float optcol;
+		float len;
+		// Begrenzung fuer den Schriftzug
+		float lbound=0,rbound =1;
+		int app;
+		
+		std::string propnew, propold;
+		
+		Vector tpos,pos;
+		for (it = itms.begin(); it != itms.end();++it)
+		{
+			
+			di = it->second;
+			
+			
+			name = di->getItem()->getName();
+			DEBUGX(" ");
+			DEBUGX(" %s %i",name.c_str(), di->getId());
+			
+			tpos = di->getPosition();
+			tpos -= o;
+			
+			pos.m_x = tpos*ox;
+ 			pos.m_y = tpos*oy;
+			
+			DEBUGX("tpos %f %f  %f",(tpos+o).m_x, (tpos+o).m_y,yscal);
+			DEBUGX("test %f %f %f   oy %f %f",o*oy/yscal, (tpos+o)*oy/yscal, pos.m_y/yscal,oy.m_x, oy.m_y);
+			
+			// Position auf dem Bildschirm ermitteln
+			DEBUGX("pos %f %f  -- %f",pos.m_x, pos.m_y,pos.m_y/yscal);
+			rpos.first = pos.m_x / oxl;
+			rpos.second = 0.9-pos.m_y / oyl*0.9;
+			DEBUGX("rpos %f %f  - %f",rpos.first, rpos.second, rpos.second/height);
+			
+			// nur Items die wirklich sichtbar sind behandeln
+			if (rpos.first<0 || rpos.first>1 || rpos.second<0 || rpos.second>0.9)
+			{
+				continue;
+			}
+			
+			
+			DEBUGX("optpos %i %f",optrow,optcol);
+			
+			// Laenge des Schriftzugs
+			const CEGUI::Font* font = label->getFont();
+			float width = font->getTextExtent((CEGUI::utf8*) name.c_str());
+			CEGUIUtility::Rectf rect = m_game_screen->getInnerRectClipper();
+			len = width / rect.getWidth();
+			
+			// eine Laenge fuer die Darstellung (mit Rand), eine ohne
+			float reallen = len;
+			float margin = 0.004;
+			len +=2*margin;
+			
+			DEBUGX("length %f",len);
+			
+			std::list < std::pair<float,float> >::iterator jt, optjt;
+			// optimale Position ermitteln
+			// Distanz zur wahren Position
+			optdist = 1000000;
+			
+			// beste gefundene Platzierung
+			rpos.first -= len/2;
+			optrow= (int) (rpos.second/height);
+			optcol= rpos.first;
+			app = 1;
+			
+			
+			
+			// schleife ueber die Zeilen
+			int row, centerrow = optrow;
+			float col= rpos.second;
+			int i;
+			for (i=0; i<2*num; i++)
+			{
+				
+				lbound=0;
+				rbound =1;
+				
+				
+				
+				row = centerrow;
+				if (i%2 == 0)
+					row += (i+1)/2;
+				else
+					row -= (i+1)/2;
+				
+				if (row<0 || row >= num)
+					continue;
+				
+				// Zeilen ueberspringen die so weit wegliegen, dass garantiert schon eine bessere Platzierung gefunden ist
+				if ((rpos.second- row*height)*(rpos.second- row*height) > optdist)
+					continue;
+				
+				// iterieren ueber die Liste der Gegenstaende, die bisher in der Zeile liegen
+				// (genauer: die Luecken zwischen den Labels)
+				for (jt = itempos[row].begin(); jt != itempos[row].end(); ++jt)
+				{
+					rbound = jt->first;
+					
+					// Test ob das Label in die Luecke passt
+					if (rbound -lbound < len)
+					{
+						lbound = jt->second;
+						continue;
+					}
+					
+					// Optimale Platzierung des Labels in der Luecke ermitteln
+					if (rpos.first+len > rbound)
+					{
+						col = rbound-len;
+					}
+					else if (rpos.first<lbound)
+					{
+						col = lbound;
+					}
+					else
+						col = rpos.first;
+					
+					dist = (rpos.first-col)*(rpos.first-col) + (centerrow-row)*(centerrow-row)*height*height;
+					if (dist+0.0001 < optdist)
+					{
+						optdist = dist;
+						optcol = col;
+						optrow = row;
+						optjt = jt;
+						app = 0;
+						
+						DEBUGX("optdist %f pos %i %f ",optdist, row, col);
+						DEBUGX("lbound %f rbound %f",lbound,rbound);
+					}
+					
+					lbound = jt->second;
+				}
+				
+				// Option, das Label hinter dem letzten bestehenden Label einzufuegen
+				rbound = 1;
+				if (rbound-lbound >= len)
+				{
+					if (rpos.first<lbound)
+					{
+						col = lbound;
+					}
+					else
+						col = rpos.first;
+					
+					dist = (rpos.first-col)*(rpos.first-col) + (centerrow-row)*(centerrow-row)*height*height;
+					
+					if (dist+0.0001 < optdist)
+					{
+						app = 1;
+						optdist = dist;
+						optcol = col;
+						optrow = row;
+						
+						DEBUGX("optdist %f optrow %i pos %i %f  app %i",optdist, optrow, row, col,app);
+						DEBUGX("lbound %f rbound %f",lbound,rbound);
+					}
+					
+				}
+				
+				
+				
+			}
+			
+			if (optdist > 10000)
+				continue;
+			
+			DEBUGX("center %i rpos %f  %f",centerrow,rpos.second, rpos.second-centerrow*height);
+			
+			rpos.first=optcol;
+			rpos.second=(optrow + yoffs) *height;
+			
+			
+			
+			DEBUGX("optdist %f optrow %i pos ",optdist, optrow);
+			DEBUGX("final position %f %f",rpos.second, rpos.first);
+			
+			if (app == 1)
+			{
+				itempos[optrow].push_back(std::make_pair(rpos.first,rpos.first+len));
+			}
+			else
+			{
+				DEBUGX("insert before %f %f",optjt->first, optjt->second);
+				itempos[optrow].insert(optjt,std::make_pair(rpos.first,rpos.first+len));
+			}
+			
+			if (rpos.first<0 || rpos.first+len>1 || rpos.second<0 || rpos.second+height>0.9)
+				continue;
+			
+			if (nr >= lcount)
+			{
+				stream.str("");
+				stream << "ItemLabel" << nr;
+
+				lcount ++;
+				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+				CEGUIUtility::addChildWidget (m_game_screen, label);
+				label->setProperty("FrameEnabled", "false");
+				label->setProperty("BackgroundEnabled", "true");
+				if (label->isPropertyPresent ("BackgroundColours"))
+				{
+					label->setProperty("BackgroundColours", "tl:77000000 tr:77000000 bl:77000000 br:77000000"); 
+				}
+				else if (label->isPropertyPresent ("BackgroundColour"))
+				{
+					label->setProperty("BackgroundColour", "B2000000");
+				}
+				label->setPosition(CEGUI::UVector2(cegui_reldim(0.2f), cegui_reldim( 0.02f)));
+				CEGUIUtility::setWidgetSizeRel (label, reallen, 0.03f);
+				label->setText("");
+				label->setAlpha(0.9);
+				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&MainWindow::onDropItemClicked, this));
+				
+			}
+			else
+			{
+				stream.str("");
+				stream << "GameScreen/ItemLabel" << nr;
+				label = CEGUIUtility::getWindow (stream.str());
+				
+			}
+			label->setVisible(true);
+			
+			
+			if (label->getText() != (CEGUI::utf8*) name.c_str())
+			{
+	
+				label->setText((CEGUI::utf8*) name.c_str());
+			}
+			
+			if (fabs( label->getArea().getWidth().d_scale - reallen) > 0.001)
+			{
+				DEBUGX("old value %f new value %f",label->getArea().getWidth().d_scale, len);
+				CEGUIUtility::setWidgetSizeRel (label, reallen, 0.03f);
+			}
+			
+			label->setID(it->first);
+			
+			
+			label->setPosition(CEGUI::UVector2(CEGUI::UDim(MathHelper::Max(0.0f,rpos.first+margin),0), CEGUI::UDim(MathHelper::Max(0.0f,rpos.second),0)));
+			
+			propold = label->getProperty("TextColours").c_str();
+			propnew = "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF";
+			if (di->getItem()->m_rarity == Item::MAGICAL)
+			{
+				std::string magicColour = TooltipSettings::getGroundItemMagicalHexColourCode ();
+				std::stringstream ssColour;
+				ssColour << "tl:" << magicColour << " tr:" << magicColour << " bl:" << magicColour << " br:" << magicColour;
+				propnew = ssColour.str ();
+				//propnew = "tl:FF8888FF tr:FF8888FF bl:FF8888FF br:FF8888FF";
+			}
+			if (propold != propnew)
+			{
+				label->setProperty("TextColours", propnew); 
+			}
+			nr++;
+
+		}
+		
+		
+		for (; nr<lcount; nr++)
+		{
+			stream.str("");
+			stream << "GameScreen/ItemLabel" << nr;
+			
+			label = CEGUIUtility::getWindow (stream.str());
+			label->setVisible(false);
+		}
+		
+	}
+	else
+	{
+		std::ostringstream stream;
+		for (int i=0; i<lcount; i++)
+		{
+			stream.str("");
+			stream << "GameScreen/ItemLabel" << i;
+
+			label = CEGUIUtility::getWindow (stream.str());
+			label->setVisible(false);
+		}
+	}
+}
+
+
+void MainWindow::updatePartyInfo()
+{
+	int windows = m_document->getGUIState()->m_shown_windows;
+	if (windows & Document::PARTY)
+	{
+		// Fenster PartyInfo aktualisieren
+		m_sub_windows["PartyInfo"]->update();
+	}
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::Window* img;
+	CEGUI::ProgressBar* bar;
+	
+	std::ostringstream stream;
+	
+	int i=0;
+	if (!( windows & Document::PARTY || windows & Document::CHARINFO || windows & Document::QUEST_INFO)) 
+	{
+		float hperc;
+		Player* player = m_document->getLocalPlayer();
+		Player* pl;
+		Party* party = World::getWorld()->getParty(player->getFraction());
+		
+		std::set<int>::iterator it;
+		// Schleife ueber die Mitglieder der Party des Spielers
+		for (it =  party->getMembers().begin(); it!= party->getMembers().end(); ++it)
+		{
+			// eigenen Spieler ueberspringen
+			if (*it == player->getId())
+				continue;
+			
+			pl =  static_cast<Player*>(World::getWorld()->getPlayer(*it));
+			if (pl ==0)
+				continue;
+			
+			stream.str("");
+			stream << "GameScreen/";
+			stream << "PartyMemberImage";
+			stream << i;
+			img = CEGUIUtility::getWindow (stream.str());
+			img->setID(pl->getId());
+			
+			// Bild setzen und anzeigen
+			if (!img->isVisible())
+			{
+				img->setVisible(true);
+			}
+			std::string imagestr = pl->getEmotionImage(pl->getSpeakText().m_emotion);
+			if (img->getProperty("Image") != imagestr)
+			{
+				img->setProperty("Image",imagestr);
+			}
+			
+			if (img->getTooltipText() != (CEGUI::utf8*) pl->getName().getRawText().c_str())
+			{
+				img->setTooltipText((CEGUI::utf8*) pl->getName().getRawText().c_str());
+			}
+			
+			stream.str("");
+			stream << "GameScreen/";
+			stream << "PartyMemberHealthBar";
+			stream << i;
+			bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow (stream.str()));
+			
+			// Fortschrittsbalken setzen und anzeigen
+			hperc = pl->getDynAttr()->m_health / pl->getBaseAttrMod()->m_max_health;
+			if (bar->getProgress() != hperc)
+			{
+				bar->setProgress(hperc);
+			}
+			
+			stream.str("");
+			stream << (int) pl->getDynAttr()->m_health<<"/"<< (int) pl->getBaseAttrMod()->m_max_health;
+			if (bar->getTooltipText() != stream.str())
+			{
+				bar->setTooltipText(stream.str());
+			}
+			
+			if (!bar->isVisible())
+			{
+				bar->setVisible(true);
+			}
+			
+			i++;
+		}
+	}
+	
+	
+	// restliche Bilder verstecken
+	for (;i<7; i++)
+	{
+		stream.str("");
+		stream << "GameScreen/PartyMemberImage" << i;
+		img = CEGUIUtility::getWindow (stream.str());
+		if (img->isVisible())
+		{
+			img->setVisible(false);
+		}
+		
+		stream.str("");
+		stream << "GameScreen/PartyMemberHealthBar" << i;
+		bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow (stream.str()));
+		if (bar->isVisible())
+		{
+			bar->setVisible(false);
+		}
+
+	}
+}
+
+void MainWindow::updateRegionInfo()
+{
+	static int region = -1;
+	static int id = 0;
+	static Timer timer;
+	
+	bool refresh = false;
+	
+	Player* pl = m_document->getLocalPlayer();	
+	if (pl->getRegion() != 0)
+	{
+		// update, when a new player is set or when a new region is set.
+		if (pl->getId() != id)
+		{
+			refresh = true;
+			id = pl->getId();
+		}
+		
+		if (pl->getRegion()->getId() != region)
+		{
+			refresh = true;
+			region = pl->getRegion()->getId();
+			//MusicManager::instance().stop();
+			//SoundManager::getPtr ()->getMusicPlayer ()->stop ();
+		}
+		
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+		if (refresh)
+		{
+			SW_DEBUG ("*** main window expecting refresh for region [%s]", pl->getRegion ()->getName ().c_str ());
+			timer.start();
+
+			MinimapWindow* myMinimap = static_cast<MinimapWindow*> (m_sub_windows["Minimap"]);
+			myMinimap->reloadIconsOnNextUpdate ();
+
+			// Also change the playlist to the one for the new region.
+			try
+			{
+				SoundManager::getPtr ()->getMusicPlayer ()->switchToPlaylist (pl->getRegion ()->getName ());
+			}
+			catch (std::exception& e)
+			{
+				WARNING ("Caught exception: [%s]", e.what ());
+			}
+		}
+		
+		float time = timer.getTime();
+		
+		bool vis = false;
+		if (time > 500 &&  time < 3000)
+		{
+			vis = true;
+		}
+		
+	
+		CEGUI::Window* label;
+		label = CEGUIUtility::getWindow ("GameScreen/RegionInfoLabel");
+		
+		// Only show when the minimap is not opened.
+		int wflags = m_document->getGUIState()->m_shown_windows;
+		vis &= !(wflags & Document::MINIMAP);
+		
+		if (label->isVisible() != vis)
+		{
+			label->setVisible(vis);
+			
+			if (vis == true)
+			{
+				label->setText( (CEGUI::utf8*) dgettext("sumwars",pl->getRegion()->getName().c_str()));
+			}
+		}
+		
+	}
+}
+
+void MainWindow::updateFloatingText()
+{
+	// Zaehler wie viele Labels fuer Schaden existieren
+	static int lcount =0;
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+			
+	Player* player = m_document->getLocalPlayer();
+	Region* reg = player->getRegion();
+	std::map<int,FloatingText*>& dmgvis = reg->getFloatingTexts();
+	std::map<int,FloatingText*>::iterator it;
+	
+	int nr =0;
+	std::stringstream stream;
+	
+	std::pair<float,float> pos;
+	
+	float maxtime;
+	
+	for (it = dmgvis.begin(); it != dmgvis.end(); ++it)
+	{
+		FloatingText& dmgv = *(it->second);
+		
+		maxtime = dmgv.m_maxtime;
+		pos = m_scene->getProjection(dmgv.m_position,1.0f);
+		pos.second -= dmgv. m_float_offset *(maxtime -dmgv.m_time)/maxtime;
+		
+		
+		// nur Kreaturen behandeln, die wirklich zu sehen sind
+		if (pos.first <0 || pos.first >1 || pos.second <0 || pos.second >1)
+			continue;
+		
+		stream.str("");
+		stream << "FloatingTextLabel";
+		stream << nr;
+		
+		std::string col = dmgv.m_colour;
+		std::string colour = std::string("tl:") + col + " tr:" + col + " bl:" + col + " br:"+ col;
+		
+		if (nr >= lcount)
+		{
+			lcount ++;
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+			CEGUIUtility::addChildWidget (m_game_screen, label);
+			label->setProperty("FrameEnabled", "false");
+			label->setProperty("BackgroundEnabled", "false");
+			label->setText("");
+			label->setAlpha(0.9);
+			label->setFont("DejaVuSerif-12");
+			
+			label->setProperty("TextColours",colour ); 
+			label->	setMousePassThroughEnabled(true);
+		}
+		else
+		{
+			stream.str("");
+			stream << "GameScreen/FloatingTextLabel" << nr;
+			label = CEGUIUtility::getWindow (stream.str());
+		}
+		
+		if (label->getProperty("TextColours") != colour)
+		{
+			label->setProperty("TextColours",colour );
+		}
+		
+		const std::string& text =  dmgv.m_text.getTranslation();
+		
+		if (label->getText() != (CEGUI::utf8*) text.c_str())
+		{
+			label->setText((CEGUI::utf8*) text.c_str());
+		}
+		
+		std::string fontname = "DejaVuSerif-16";
+		if (dmgv.m_size == 1)
+		{
+			fontname = "DejaVuSerif-12";
+		}
+		if (label->getFont()->getProperty("Name") != fontname)
+		{
+			label->setFont(fontname);
+		}
+		
+		const CEGUI::Font* font = label->getFont();
+			
+		float width = font->getTextExtent((CEGUI::utf8*) text.c_str())+15;
+		float height = font->getFontHeight() +15;
+			
+		CEGUIUtility::setWidgetSizeAbs (label, width, height);
+		label->setPosition(CEGUI::UVector2(CEGUI::UDim(pos.first,-width/2), CEGUI::UDim(pos.second,-height)));
+		
+		float fadetime = 0.4* maxtime;
+		if (dmgv.m_time < fadetime)
+		{
+			label->setAlpha(0.9 * dmgv.m_time / fadetime);
+		}
+		else
+		{
+			label->setAlpha(0.9);
+		}
+		
+		label->setVisible(true);
+		nr ++;
+	}
+	
+	for (; nr<lcount; nr++)
+	{
+		stream.str("");
+		stream << "GameScreen/FloatingTextLabel" << nr;
+			
+		label = CEGUIUtility::getWindow (stream.str());
+		label->setVisible(false);
+	}
+}
+
+void MainWindow::updateChatContent()
+{
+	static Timer timer;
+	int windows = m_document->getGUIState()->m_shown_windows;
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	Player* pl = m_document->getLocalPlayer();
+	
+	CEGUI::Window* label;
+	label =  CEGUIUtility::getWindow ("GameScreen/ChatContent");
+	
+	// escape all the [ brackets
+	// CEGUI >= 0.7 uses [brackets] for markup
+	std::string rawtext = pl->getMessages();
+	size_t pos = 0;
+	while ((pos = rawtext.find('[',pos)) != std::string::npos)
+	{
+		rawtext.replace(pos,1,"\\[");
+		pos += 2;
+	}
+	
+	if (label->getText() != (CEGUI::utf8*) rawtext.c_str())
+	{
+		label->setText((CEGUI::utf8*) rawtext.c_str() );
+	}
+	
+	bool vis = true;
+	if (label->getText() == "" || ( windows & Document::PARTY || windows & Document::CHARINFO || windows & Document::QUEST_INFO))
+	{
+		vis = false;
+	}
+	else
+	{
+		// Fenster auf die richtige Groesse bringen
+		const CEGUI::Font* fnt = label->getFont();
+		CEGUIUtility::Size area(CEGUI::System::getSingleton().getRenderer()->getDisplaySize());
+
+		CEGUI::String text = label->getText();
+		CEGUI::UVector2 vec = CEGUIUtility::getWindowSizeForText(text.c_str(), fnt);
+		
+		float width = vec.d_x.d_scale;
+		float maxwidth = area.d_width * 0.43;
+		width += 10;
+		if (width > maxwidth)
+		{
+			width = maxwidth;
+		}
+		
+		CEGUIUtility::Size larea = area;
+		larea.d_width = width;
+		//float height =  vec.asRelative(larea).d_y; 
+
+		//float relwidth = width / area.d_width;
+		//float relheight = (height+6) / area.d_height;
+		
+		if ( fabs(label->getArea().getWidth().d_scale - vec.d_x.d_scale) > 0.0001
+			|| fabs(label->getArea().getHeight().d_scale - vec.d_y.d_scale) > 0.0001)
+		{
+			label->setPosition(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.82f - vec.d_y.d_scale)));
+			//label->setSize(CEGUI::UVector2(cegui_reldim(relwidth), cegui_reldim(relheight)));
+			CEGUIUtility::setWidgetSize (label, vec);
+			DEBUGX("old size %f %f",label->getArea().getWidth().d_scale, label->getArea().getHeight().d_scale);
+			DEBUGX("new size %f %f", vec.d_x.d_scale, vec.d_y.d_scale);
+		}
+		
+		pl->updateMessageTimer(timer.getTime());
+	}
+	
+	if (label->isVisible() != vis)
+	{
+		label->setVisible(vis);
+		
+	}
+	
+	timer.start();
+}
+
+void MainWindow::updateSound()
+{
+	// play all region sounds from the last updated
+	Player* player = m_document->getLocalPlayer();
+	if (player != 0)
+	{
+		Region* reg = player->getRegion();
+		if (reg != 0)
+		{
+			const std::list<PlayedSound*> sounds = reg->getPlayedSounds();
+			for (std::list<PlayedSound*>::const_iterator it = sounds.begin(); it != sounds.end(); ++it)
+			{
+				//SoundSystem::playAmbientSound((*it)->m_soundname, (*it)->m_volume, &((*it)->m_position));
+
+				// TODO:XXX: verify how sounds come from the region.
+				float posX = (*it)->m_position.m_x;
+				float posY = (*it)->m_position.m_y;
+				float posZ = 0.0;
+				SoundHelper::playSoundGroupAtPosition ((*it)->m_soundname, posX, posY, posZ);
+
+				//try
+				//{
+				//	DEBUG ("Will try to play sound group [%s]",  (*it)->m_soundname.c_str ());
+
+				//	std::string soundToPlay;
+				//	DEBUG ("Checking if valid");
+				//	soundToPlay = SoundManager::getPtr ()->getSoundGroup ((*it)->m_soundname)->getRandomSound ();
+				//	DEBUG ("Chosen sound file from group [%s]",  soundToPlay.c_str ());
+
+				//	SoundManager::getPtr ()->getRepository ()->getSound (soundToPlay)->play3D (posX, posY, posZ);
+				//}
+				//catch (std::exception& e)
+				//{
+				//	DEBUG ("Caught exception while trying to play sound group [%s]: %s", (*it)->m_soundname.c_str (), e.what ());
+				//}
+			}
+		}
+	}
+	
+	//SoundSystem::update();
+}
+
+
+Vector MainWindow::getIngamePos(float screenx, float screeny, bool relative)
+{
+	// Position des Mausklicks relativ zum Viewport
+	Ogre::Viewport* viewport = m_scene->getViewport();
+	float relx,rely;
+	if (relative)
+	{
+		relx = screenx;
+		rely = screeny;
+	}
+	else
+	{
+		relx = screenx*1.0/(viewport->getActualWidth());
+		rely = screeny*1.0/(viewport->getActualHeight());
+	}
+	DEBUGX("relative Koordinaten %f %f",relx,rely);
+
+	// Strahl von der Kamera durch den angeklickten Punkt
+	Ogre::Camera* camera = m_scene->getCamera();
+	Ogre::Ray ray = camera->getCameraToViewportRay(relx,rely);
+
+	// Ursprung und Richtung des Strahles
+	const Ogre::Vector3& orig = ray.getOrigin();
+	DEBUGX("ray orig %f %f %f",orig.x,orig.y,orig.z);
+	const Ogre::Vector3& dir = ray.getDirection();
+	DEBUGX("ray dir %f %f %f",dir.x,dir.y,dir.z);
+
+	// Schnittpunkt mit der Ebene y=0 ausrechnen
+	
+	Vector ret;
+	float dy = dir.y;
+	if (dir.y>=0)
+	{
+		dy = -0.001;
+	}
+	
+	
+	// Durchstosspunkt durch die Ebene y=0
+	Ogre::Vector3 p = orig + dir*(orig.y/(-dy));
+	DEBUGX("schnittpunkt %f %f %f",p.x,p.y,p.z);
+
+	// Umrechnen in Spielkoordinaten
+	ret.m_x = p.x/GraphicManager::g_global_scale;
+	ret.m_y = p.z/GraphicManager::g_global_scale;
+	DEBUGX("Punkt in Spielkoordinaten %f %f",ret.m_x,ret.m_y);
+	
+	return ret;
+
+}
+
+// MouseListener
+bool MainWindow::mouseMoved(const OIS::MouseEvent &evt)
+{
+    //DEBUG("injection position %i %i",evt.state.X.abs,evt.state.Y.abs);
+    if(CEGUIUtility::injectMouseWheelChange (m_cegui_system, evt.state.Z.rel))
+        m_document->onMouseMove(evt.state.X.rel, evt.state.Y.rel, 0);
+    else
+        m_document->onMouseMove(evt.state.X.rel, evt.state.Y.rel,evt.state.Z.rel);
+	
+	try
+	{
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+		CEGUI::Window* label = CEGUIUtility::getWindowForLoadedLayoutEx (m_root_window, "CursorItemImage");
+	
+		int off = 0;
+		if (label->getID() == Item::BIG)
+			off = 24;
+		if (label->getID() == Item::MEDIUM)
+			off = 16;
+		if (label->getID() == Item::SMALL)
+			off = 12;
+	
+	
+		label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,MathHelper::Max(0,evt.state.X.abs-off)),CEGUI::UDim(0,MathHelper::Max(0,evt.state.Y.abs- off))));
+	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Caught exception: [%s]", e.what ());
+	}
+	
+	return CEGUIUtility::injectMousePosition (m_cegui_system, evt.state.X.abs, evt.state.Y.abs);
+}
+
+
+
+/**
+	React to a mouse button being pressed.
+	@note: Input is only supported for the first 3 mouse buttons (left, right, middle) for the time being.
+*/
+bool MainWindow::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
+{
+	m_gui_hit = false;
+
+	CEGUI::MouseButton button = CEGUI::NoButton;
+
+	if (btn == OIS::MB_Left)
+	{
+		button = CEGUI::LeftButton;
+	}
+	else if (btn == OIS::MB_Middle)
+	{
+		button = CEGUI::MiddleButton;
+	}
+	else if (btn == OIS::MB_Right)
+	{
+		button = CEGUI::RightButton;
+	}
+	else
+	{
+		// For the time being no input from more than 3 buttons is allowed.
+		return false;
+	}
+
+    bool ret = false; // CEGUI 0.7 changed its default behaviour a little bit and creates a invisible root window that always processes events
+
+    // if the returned window is anything else than "GameScreen" then CEGUI needs to process the input
+	CEGUI::Window* mouseWindow = CEGUIUtility::getWindowContainingMouse (m_cegui_system);
+
+	SW_DEBUG ("Mouse Pressed. Mouse window is [%s]", mouseWindow->getName ().c_str ());
+	if (! (mouseWindow->getName () == "SW")) 
+    {
+        ret = true; // set ret to false if the events where processed by the invisible window
+		CEGUIUtility::injectMouseButtonDown (btn);
+    }
+    
+	if (m_document->getGUIState()->m_sheet ==  Document::MAIN_MENU && m_ready_to_start)
+	{
+		m_document->onStartScreenClicked();
+		return true;
+	}
+
+	// Koordinaten an denen der Mausklick stattfand
+	int x =evt.state.X.abs;
+	int y =evt.state.Y.abs;
+	DEBUGX("mouse coords %i %i",x,y);
+
+	Player* player = m_document->getLocalPlayer();
+	if (player!=0)
+	{
+		// Spiel ist mit Server verbunden
+		if (btn == OIS::MB_Middle)
+		{
+			m_document->getGUIState()->m_middle_mouse_pressed=true;
+		}
+
+		// Testet, dass man nicht auf die untere Steuerleiste geklickt hat
+		if (!ret)
+		{
+			if (player->getEquipement()->getItem(Equipement::CURSOR_ITEM)!=0)
+			{
+				// Spieler hat Item in der Hand, fallen lassen
+				m_document->dropCursorItem();
+			}
+			else
+			{
+
+				Vector pos = getIngamePos(x,y);
+
+				if (btn == OIS::MB_Left)
+				{
+					m_document->getGUIState()->m_left_mouse_pressed=true;
+					m_document->onLeftMouseButtonClick(pos);
+				}
+				else if (btn == OIS::MB_Right)
+				{
+					m_document->getGUIState()->m_right_mouse_pressed=true;
+					m_document->onRightMouseButtonClick(pos);
+				}
+			}
+		}
+
+	}
+
+	return ret;
+}
+
+
+/**
+	React to the mouse button being released.
+	@note: Input is only supported for the first 3 mouse buttons (left, right, middle) for the time being.
+*/
+bool MainWindow::mouseReleased (const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
+{
+	CEGUI::MouseButton button = CEGUI::NoButton;
+
+	// TODO: There are 2 separate if-else blocks; check if it makes sense to unite them,
+	// or the sequence of events is really necessary.
+	if (btn == OIS::MB_Left)
+	{
+		DEBUGX("Button release");
+		m_document->getGUIState ()->m_left_mouse_pressed=false;
+		m_document->getGUIState ()->m_clicked_object_id=0;
+	}
+	else if (btn == OIS::MB_Right)
+	{
+		DEBUGX("Right Button release");
+		m_document->getGUIState ()->m_right_mouse_pressed=false;
+		m_document->getGUIState ()->m_clicked_object_id=0;
+	}
+	else if (btn == OIS::MB_Middle)
+	{
+		m_document->getGUIState ()->m_middle_mouse_pressed=false;
+	}
+	else
+	{
+		// For the time being no input from more than 3 buttons is allowed.
+		return false;
+	}
+
+	return CEGUIUtility::injectMouseButtonUp (m_cegui_system, btn);
+}
+
+
+
+bool MainWindow::keyPressed(const OIS::KeyEvent &evt) {
+	unsigned int ch = evt.text;
+	
+	DEBUGX("keycode %i %s %x",evt.key,m_keyboard->getAsString(evt.key).c_str(), ch);
+	if (m_document->getGUIState()->m_shown_windows & Document::OPTIONS)
+	{
+		if (static_cast<OptionsWindow*>(m_sub_windows["Options"])->requestsForKey())
+		{
+			static_cast<OptionsWindow*>(m_sub_windows["Options"])->setKeyCode(evt.key);
+			return true;
+		}
+	}
+	
+	if (evt.key == OIS::KC_UNASSIGNED)
+	{
+		ch &= 0xff;
+		CEGUIUtility::injectChar (m_cegui_system, (CEGUI::utf32) ch);
+		return true;
+	}
+	
+    if (evt.key == OIS::KC_S)
+    {
+        //m_scene_manager->setShadowTextureSelfShadow(!m_scene_manager->getShadowTextureSelfShadow());
+    }
+	
+	bool ret = CEGUIUtility::injectKeyDown (m_cegui_system, evt.key);
+	
+	ret |= CEGUIUtility::injectChar (ch);
+	
+	if (ch != 0 &&  (m_document->getGUIState()->m_shown_windows & Document::CHAT))
+	{
+		m_key = ch;
+		m_key_repeat_timer.start();
+		m_key_repeat = false;
+	}
+	
+	
+	if (evt.key == OIS::KC_RSHIFT || evt.key == OIS::KC_LSHIFT)
+	{
+		m_document->getGUIState()->m_shift_hold = true;
+	}
+
+	// Test for copy paste operations.
+	if (evt.key == OIS::KC_C)
+	{
+		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
+		{
+			SW_DEBUG ("MainWindow:: ctrl + c pressed!");
+			SWUtil::Clipboard::getSingletonPtr ()->copy ();
+		}
+	}
+	else if (evt.key == OIS::KC_X)
+	{
+		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
+		{
+			SW_DEBUG ("MainWindow:: ctrl + X pressed!");
+			SWUtil::Clipboard::getSingletonPtr ()->cut ();
+		}
+	}
+	else if (evt.key == OIS::KC_V)
+	{
+		if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl))
+		{
+			SW_DEBUG ("MainWindow:: ctrl + V pressed!");
+			SWUtil::Clipboard::getSingletonPtr ()->paste ();
+		}
+	}
+	
+	if (!ret)
+	{
+		ret = m_document->onKeyPress(evt.key);
+	}
+	return ret;
+}
+
+bool MainWindow::keyReleased(const OIS::KeyEvent &evt)
+{
+
+	m_key =0;
+	m_key_repeat = false;
+	
+	bool ret = CEGUIUtility::injectKeyUp (m_cegui_system, evt.key);
+	
+	if (evt.key == OIS::KC_RSHIFT || evt.key == OIS::KC_LSHIFT)
+	{
+		m_document->getGUIState()->m_shift_hold = false;
+	}
+
+	if (!ret)
+	{
+		ret = m_document->onKeyRelease(evt.key);
+	}
+
+	return ret;
+}
+
+bool MainWindow::onDropItemClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	DEBUGX("pick up item %i",id);
+	m_document->onDropItemClick(id);
+	return true;
+}
+
+
+
+
+bool MainWindow::consumeEvent(const CEGUI::EventArgs& evt)
+{
+	return true;
+}
+
+bool MainWindow::onPartyMemberClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	Player* pl = static_cast<Player*> (World::getWorld()->getLocalPlayer());
+	if (World::getWorld() ==0 || pl ==0 || pl->getRegion() ==0)
+		return true;
+	
+	// Spieler auf den die Aktion wirkt
+	WorldObject* pl2 = pl->getRegion()->getObject(id);
+	if (pl2 ==0)
+		return true;
+	
+	SW_DEBUG("party member Click %i",id);
+	
+	m_document->getGUIState()->m_cursor_object_id = id;
+	if (we.button == CEGUI::LeftButton)
+	{
+		m_document->onLeftMouseButtonClick(pl2->getPosition());
+	}
+
+	if (we.button == CEGUI::RightButton)
+	{
+		m_document->onRightMouseButtonClick(pl2->getPosition());
+	}
+
+	return true;
+}
+
+void MainWindow::setReadyToStart(bool ready)
+{
+	m_ready_to_start = ready;
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/LoadRessourcesProgressBar"));
+	bar->setVisible(!ready);
+
+	// Also hide the background picture
+	if (CEGUIUtility::isWindowPresent ("MainMenu/StartScreenRoot/StartScreenImage"))
+	{
+		CEGUI::Window* backgroundPicture = CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/StartScreenImage");
+		backgroundPicture->setVisible (false);
+		backgroundPicture->setMousePassThroughEnabled (true);
+	}
+	if (CEGUIUtility::isWindowPresent ("MainMenu/StartScreenRoot"))
+	{
+		CEGUI::Window* backgroundPicture = CEGUIUtility::getWindow ("MainMenu/StartScreenRoot");
+		backgroundPicture->setVisible (false);
+		backgroundPicture->setMousePassThroughEnabled (true);
+	}
+	
+	// we have finished loading so we will simulate the click to get straight in to the main menu
+	m_document->onStartScreenClicked();
+
+	
+}
+
+void MainWindow::setRessourceLoadingBar(float percent)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::ProgressBar* bar = static_cast<CEGUI::ProgressBar*>(CEGUIUtility::getWindow ("MainMenu/StartScreenRoot/LoadRessourcesProgressBar"));
+	bar->setProgress(percent);
+}
+
+
+
+
+
--- a/src/gui/mainwindow.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/mainwindow.h	Thu Mar 20 19:04:28 2014 +0100
@@ -18,9 +18,15 @@
 #define __SUMWARS_GUI_MAINWINDOW_H__
 
 
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
 
 // needed to be able to create the CEGUI renderer interface
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
+#ifdef CEGUI_07
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
+#else
+#include "CEGUI/RendererModules/Ogre/Renderer.h"
+#endif
 
 // CEGUI includes
 
@@ -107,6 +113,12 @@
 	void setupCharInfo();
 
 	/**
+	 * \fn void setupDialogWindow()
+	 * \brief Create the generic dialog window
+	 */
+	void setupDialogWindow();
+
+	/**
 	 * \fn void setupSkilltree()
 	 * \brief Erzeugt das Fenster Skilltree
 	 */
@@ -131,6 +143,12 @@
 	 */
 	bool setupMainMenu();
 
+	/**
+	 * \fn bool setupRootWindow()
+	 * \brief Create the root window to serve as root element of the CEGUI interface
+	 * \return true, if successfull, false otherwise
+	 */
+	bool setupRootWindow ();
 
 	/**
 	 * \fn bool setupObjectInfo()
@@ -268,11 +286,6 @@
 	void updateChatContent();
 	
 	/**
-	 * \brief Aktualisiert die Musik
-	 */
-	void updateMusic();
-
-	/**
 	 * \brief Updates the sound system
 	 */
 	void updateSound();
@@ -416,12 +429,24 @@
 	CEGUI::Window* m_main_menu;
 
 	/**
+	 * \fn CEGUI::Window* m_root_window
+	 * \brief The root window
+	 */
+	CEGUI::Window* m_root_window;
+
+	/**
 	 * \var CEGUI::Window* m_game_screen
-	 * \brief Fenster, in dem das eigentliche Spiel laeuft
+	 * \brief The window in which the actual game is running in (this is excluding the menu).
 	 */
 	CEGUI::Window* m_game_screen;
 
 	/**
+	 * \var CEGUI::Window* m_custom_cursor
+	 * \brief A custom cursor window. Would be used typically to display items dragged by the user.
+	 */
+	CEGUI::Window* m_custom_cursor;
+
+	/**
 	 * \var Scene* m_scene
 	 * \brief Szene die dargestellt wird
 	 */
--- a/src/gui/messageboxes.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/messageboxes.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,267 +1,282 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "messageboxes.h"
-
-SaveExitWindow::SaveExitWindow (Document* doc)
-	:Window(doc)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	
-	CEGUI::FrameWindow* save_exit = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("saveexitwindow.layout");
-	m_window = save_exit;
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("GameExitConfirmButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow ::onExitGameConfirmed, this));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("GameExitAbortButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow ::onExitGameAborted, this));
-
-	// If the panel also has an auto-close button, connect it to the Cancel/Abort event.
-	if (win_mgr.isWindowPresent ("SaveExitWindow__auto_closebutton__"))
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "messageboxes.h"
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+
+SaveExitWindow::SaveExitWindow (Document* doc)
+	:Window(doc)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	
+	CEGUI::FrameWindow* save_exit = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("saveexitwindow.layout");
+	m_window = save_exit;
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "GameExitConfirmButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow ::onExitGameConfirmed, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SaveExitWindow::onGUIItemHover, this));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "GameExitAbortButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow ::onExitGameAborted, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SaveExitWindow::onGUIItemHover, this));
+
+	// The panel should also have an auto-close button; connect it to the Cancel/Abort event.
+	btn = static_cast<CEGUI::PushButton*>( CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "__auto_closebutton__"));
+	if (btn)
 	{
-		btn = static_cast<CEGUI::PushButton*>( win_mgr.getWindow ("SaveExitWindow__auto_closebutton__"));
-		if (btn)
-		{
-			btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow::onExitGameAborted, this));
-		}
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SaveExitWindow::onExitGameAborted, this));
+		btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SaveExitWindow::onGUIItemHover, this));
 	}
-	
-	updateTranslation();
-}
-
-void SaveExitWindow::update()
-{
-}
-
-void SaveExitWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "GameExitConfirmButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "GameExitAbortButton"));
-	btn->setText((CEGUI::utf8*) gettext("Abort"));
-	
-	if (win_mgr.isWindowPresent ("SaveExitLabel"))
-	{
-		label = win_mgr.getWindow("SaveExitLabel");
-		label->setText((CEGUI::utf8*) gettext("Save and Exit?"));
-	}
-	else if (win_mgr.isWindowPresent ("SaveExitWindow"))
-	{
-		label = win_mgr.getWindow ("SaveExitWindow");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Save and Exit?"));
-		}
-	}
-
-}
-
-
-bool SaveExitWindow::onExitGameConfirmed(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonSaveExitConfirm();
-	return true;
-}
-
-bool SaveExitWindow::onExitGameAborted(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonSaveExitAbort();
-	return true;
-}
-
-
-
-//
-// ----------------------------------------- Message Question Window (a window containing a question and two buttons) ----------------------------------------------
-//
-
-
-MessageQuestionWindow::MessageQuestionWindow (Document* doc
-							, const std::string& layoutName
-							, const std::string& question
-							, const std::string& button1Text
-							, CEGUI::Event::Subscriber subscriberButton1Callback
-							, const std::string& button2Text
-							, CEGUI::Event::Subscriber subscriberButton2Callback)
-	: Window (doc)
-	, m_button1 (button1Text)
-	, m_button2 (button2Text)
-	, m_layoutName (layoutName)
-{
-	m_question = question;
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	
-	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout(layoutName.c_str ());
-	m_window = message;
-
-	if (win_mgr.isWindowPresent ("QuestionAnswerButton1"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("QuestionAnswerButton1"));
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, subscriberButton1Callback);
-	}
-	if (win_mgr.isWindowPresent ("QuestionAnswerButton2"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("QuestionAnswerButton2"));
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, subscriberButton2Callback);
-	}
+	
+	updateTranslation();
+}
+
+void SaveExitWindow::update()
+{
+}
+
+void SaveExitWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "GameExitConfirmButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "GameExitAbortButton"));
+	btn->setText((CEGUI::utf8*) gettext("Abort"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "SaveExitWindow");
+	if (label->isPropertyPresent ("Text"))
+	{
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Save and Exit?"));
+	}
+}
+
+
+bool SaveExitWindow::onExitGameConfirmed(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonSaveExitConfirm();
+	return true;
+}
+
+bool SaveExitWindow::onExitGameAborted(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonSaveExitAbort();
+	return true;
+}
+
+
+/**
+ * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+ * \brief Handle the hovering of gui items.
+ */
+bool SaveExitWindow::onGUIItemHover (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
+
+
+
+//
+// ----------------------------------------- Message Question Window (a window containing a question and two buttons) ----------------------------------------------
+//
+
+
+MessageQuestionWindow::MessageQuestionWindow (Document* doc
+							, const std::string& layoutName
+							, const std::string& question
+							, const std::string& button1Text
+							, CEGUI::Event::Subscriber subscriberButton1Callback
+							, const std::string& button2Text
+							, CEGUI::Event::Subscriber subscriberButton2Callback)
+	: Window (doc)
+	, m_button1 (button1Text)
+	, m_button2 (button2Text)
+	, m_layoutName (layoutName)
+{
+	m_question = question;
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	
+	CEGUI::FrameWindow* message = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile (layoutName.c_str ());
+	m_window = message;
+
+	CEGUI::String widgetName (CEGUIUtility::getNameForWidget("QuestionAnswerButton1"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, subscriberButton1Callback);
+	}
+
+	widgetName = CEGUIUtility::getNameForWidget("QuestionAnswerButton2");
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
+	if (btn)
+	{
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, subscriberButton2Callback);
+	}
 
-	updateTranslation ();
-}
-
-
-MessageQuestionWindow::~MessageQuestionWindow ()
-{
-}
-
-
-void MessageQuestionWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* widget;
-
-	if (win_mgr.isWindowPresent ("QuestionAnswerButton1"))
-	{
-		widget = win_mgr.getWindow("QuestionAnswerButton1");
-		widget->setText ((CEGUI::utf8*) m_button1.c_str ());
-	}
-	if (win_mgr.isWindowPresent ("QuestionAnswerButton2"))
-	{
-		widget = win_mgr.getWindow("QuestionAnswerButton2");
-		widget->setText ((CEGUI::utf8*) m_button2.c_str ());
-	}
-	if (win_mgr.isWindowPresent ("QuestionInfoLabel"))
-	{
-		widget = win_mgr.getWindow("QuestionInfoLabel");
-		widget->setText ((CEGUI::utf8*) m_question.c_str ());
-	}
-}
-
-void MessageQuestionWindow::setQuestion(std::string question)
-{
-	m_question = question;
-	updateTranslation();
-}
-
-
-//
-// ----------------------------------------- Warning Window (a window containing a notification and a button) ----------------------------------------------
-//
-
-
-WarningDialogWindow::WarningDialogWindow (Document* doc)
-:Window(doc)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	
-	CEGUI::FrameWindow* warning_dialog = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("warningdialogwindow.layout");
-	m_window = warning_dialog;
-	m_warning = "";
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("WarningDialogConfirmButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&WarningDialogWindow ::onConfirmed, this));
-	
-	updateTranslation();
-}
-
-void WarningDialogWindow::update()
-{
-}
-
-void WarningDialogWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "WarningDialogConfirmButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-	
-	label = win_mgr.getWindow("WarningDialogLabel");
-	label->setText((CEGUI::utf8*) gettext(m_warning.c_str()));
-}
-
-
-bool WarningDialogWindow::onConfirmed(const CEGUI::EventArgs& evt)
-{
-	m_document->hideWarning ();
-	return true;
-}
-
-void WarningDialogWindow::setWarning(std::string warning)
-{
-	m_warning = warning;
-	updateTranslation();
-}
-
-
-
-//
-// ----------------------------------------- Error Dialog Window (a window containing a notification and a button) ----------------------------------------------
-//
-
-
-ErrorDialogWindow::ErrorDialogWindow (Document* doc)
-:Window(doc)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-
-	CEGUI::FrameWindow* error_dialog = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("errordialogwindow.layout");
-	m_window = error_dialog;
-	m_error = "Network connection timed out";
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ErrorDialogConfirmButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ErrorDialogWindow ::onConfirmed, this));
-	
-	updateTranslation();
-}
-
-void ErrorDialogWindow::update()
-{
-}
-
-void ErrorDialogWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "ErrorDialogConfirmButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-	
-	label = win_mgr.getWindow("ErrorDialogLabel");
-	label->setText((CEGUI::utf8*) gettext(m_error.c_str()));
-}
-
-
-bool ErrorDialogWindow::onConfirmed(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonErrorDialogConfirm();
-	return true;
-}
-
-void ErrorDialogWindow::setError(std::string error)
-{
-	m_error = error;
-	updateTranslation();
-}
-
+	updateTranslation ();
+}
+
+
+MessageQuestionWindow::~MessageQuestionWindow ()
+{
+}
+
+
+void MessageQuestionWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* widget;
+
+	CEGUI::String widgetName (CEGUIUtility::getNameForWidget("QuestionAnswerButton1"));
+	widget = CEGUIUtility::getWindowForLoadedLayout(m_window, widgetName);
+	if (widget)
+	{
+		widget->setText ((CEGUI::utf8*) m_button1.c_str ());
+	}
+	widgetName = CEGUIUtility::getNameForWidget("QuestionAnswerButton2");
+	widget = CEGUIUtility::getWindowForLoadedLayout(m_window, widgetName);
+	if (widget)
+	{
+		widget->setText ((CEGUI::utf8*) m_button2.c_str ());
+	}
+	widgetName = CEGUIUtility::getNameForWidget("QuestionInfoLabel");
+	widget = CEGUIUtility::getWindowForLoadedLayout(m_window, widgetName);
+	if (widget)
+	{
+		widget->setText ((CEGUI::utf8*) m_question.c_str ());
+	}
+}
+
+void MessageQuestionWindow::setQuestion(std::string question)
+{
+	m_question = question;
+	updateTranslation();
+}
+
+
+//
+// ----------------------------------------- Warning Window (a window containing a notification and a button) ----------------------------------------------
+//
+
+
+WarningDialogWindow::WarningDialogWindow (Document* doc)
+:Window(doc)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	
+	CEGUI::FrameWindow* warning_dialog = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile("warningdialogwindow.layout");
+	m_window = warning_dialog;
+	m_warning = "";
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "WarningDialogConfirmButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&WarningDialogWindow ::onConfirmed, this));
+	
+	updateTranslation();
+}
+
+void WarningDialogWindow::update()
+{
+}
+
+void WarningDialogWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "WarningDialogConfirmButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "WarningDialogLabel");
+	label->setText((CEGUI::utf8*) gettext(m_warning.c_str()));
+}
+
+
+bool WarningDialogWindow::onConfirmed(const CEGUI::EventArgs& evt)
+{
+	m_document->hideWarning ();
+	return true;
+}
+
+void WarningDialogWindow::setWarning(std::string warning)
+{
+	m_warning = warning;
+	updateTranslation();
+}
+
+
+
+//
+// ----------------------------------------- Error Dialog Window (a window containing a notification and a button) ----------------------------------------------
+//
+
+
+ErrorDialogWindow::ErrorDialogWindow (Document* doc)
+:Window(doc)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+
+	CEGUI::FrameWindow* error_dialog = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("errordialogwindow.layout");
+	m_window = error_dialog;
+	m_error = "Network connection timed out";
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ErrorDialogConfirmButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&ErrorDialogWindow ::onConfirmed, this));
+	
+	updateTranslation();
+}
+
+void ErrorDialogWindow::update()
+{
+}
+
+void ErrorDialogWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ErrorDialogConfirmButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "ErrorDialogLabel");
+	label->setText((CEGUI::utf8*) gettext(m_error.c_str()));
+}
+
+
+bool ErrorDialogWindow::onConfirmed(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonErrorDialogConfirm();
+	return true;
+}
+
+void ErrorDialogWindow::setError(std::string error)
+{
+	m_error = error;
+	updateTranslation();
+}
+
--- a/src/gui/messageboxes.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/messageboxes.h	Thu Mar 20 19:04:28 2014 +0100
@@ -46,6 +46,12 @@
 		virtual void updateTranslation();
 	
 	private:
+		/**
+		 * \fn bool onGUIItemHover(const CEGUI::EventArgs& evt)
+		 * \brief Handle the hovering of gui items.
+		 */
+		bool onGUIItemHover (const CEGUI::EventArgs& evt);
+
 		/**
 		 * \fn bool onExitGameConfirmed(const CEGUI::EventArgs& evt)
 		 * \brief Behandelt Klick auf Button Spiel beenden
--- a/src/gui/minimapwindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/minimapwindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,242 +1,264 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreTexture.h"
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreResourceProvider.h"
-#include "scene.h"
-
-#include "minimapwindow.h"
-#include "ceguiutility.h"
-#include "OgreResource.h"
-
-MinimapWindow::MinimapWindow (Document* doc, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-	, m_reloadIconsOnNextUpdate (true)
-{
-	m_region_id = -1;
-	DEBUGX("setup main menu");
-
-	// Create GUI Items.
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	CEGUI::Window* minimapWnd = win_mgr.loadWindowLayout("minimapwindow.layout");
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+// needed to be able to create the CEGUI renderer interface
+#ifdef CEGUI_07
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreTexture.h"
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreResourceProvider.h"
+#else
+#include "CEGUI/RendererModules/Ogre/Renderer.h"
+#include "CEGUI/RendererModules/Ogre/Texture.h"
+#include "CEGUI/RendererModules/Ogre/ResourceProvider.h"
+#endif
+
+#include "scene.h"
+
+#include "minimapwindow.h"
+
+#include "OgreResource.h"
+
+MinimapWindow::MinimapWindow (Document* doc, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+	, m_reloadIconsOnNextUpdate (true)
+{
+	m_region_id = -1;
+	DEBUGX("setup main menu");
+
+	// Create GUI Items.
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	CEGUI::Window* minimapWnd = CEGUIUtility::loadLayoutFromFile ("minimapwindow.layout");
 	if (!minimapWnd)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "minimapwindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "minimapwindow.layout");
 	}
 
-	CEGUI::Window* minimapWnd_holder = win_mgr.loadWindowLayout( "minimapwindow_holder.layout" );
+	CEGUI::Window* minimapWnd_holder = CEGUIUtility::loadLayoutFromFile ("minimapwindow_holder.layout");
 	if (!minimapWnd_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "minimapwindow_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "minimapwindow_holder.layout");
 	}
 
-	DEBUG ("Placing layout into holder");
+	SW_DEBUG ("Placing layout into holder");
 	minimapWnd->setVisible (true);
 	minimapWnd_holder->setVisible (true);
 
-	CEGUI::Window* wndHolder = win_mgr.getWindow("MinimapWindow_Holder");
-	CEGUI::Window* wndHeld = win_mgr.getWindow("MinimapWindow");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (minimapWnd_holder, "MinimapWindow_Holder");
+	CEGUI::Window* wndHeld = CEGUIUtility::getWindowForLoadedLayoutEx (minimapWnd, "MinimapWindow");
 	if (wndHolder && wndHeld)
 	{
-		wndHolder->addChildWindow (wndHeld);
+		CEGUIUtility::addChildWidget (wndHolder, wndHeld);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for inventory.");
-		if (!wndHeld) DEBUG ("ERROR: Unable to get the window for inventory.");
-	}
-	m_window = minimapWnd_holder;
-
-	/*
-	Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("RttMat", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
-	Ogre::Technique *technique = material->createTechnique();
-	technique->createPass();
-	material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
-	material->getTechnique(0)->getPass(0)->createTextureUnitState("minimap_tex");
-	
-	Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("minimapOverlay");
-	Ogre::OverlayContainer* container = (Ogre::OverlayContainer*) Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "minimapContainer");
-	overlay->add2D(container);
-	container->setMaterialName("RttMat");
-	container->setDimensions(0.8, 0.8);
-	//textArea->setMetricsMode(GMM_PIXELS);
-	container->setPosition(0.1, 0.1);
-	overlay->show();
-	*/
-}
-
-
-/**
- * \fn virtual void reloadIconsOnNextUpdate ()
- * \brief Makes sure that at the next update, minimap icons are reloaded.
- */
-void MinimapWindow::reloadIconsOnNextUpdate ()
-{
-	m_reloadIconsOnNextUpdate = true;
-}
-
-
-
-void MinimapWindow::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::FrameWindow* minimap = (CEGUI::FrameWindow*) win_mgr.getWindow("MinimapWindow");
-
-	Player* player = m_document->getLocalPlayer();
-	if (player ==0)
-		return;
-	
-	Region* region = player->getRegion();
-	if (region ==0)
-		return;
-	
-	const WorldObjectMap& players = region->getPlayers();
-	WorldObjectMap::const_iterator it;
-	WorldObject* pl;
-
-	// Window counter
-	static int ncount =0;
-	
-	CEGUI::Window* label;
-	std::ostringstream stream;
-	
-	int cnt =0;
-	float relx, rely;
-	float alpha;
-	for (it = players.begin(); it != players.end(); ++it)
-	{
-		pl = it->second;
-		stream.str("");
-		stream << "PlayerMinimapImage"<<cnt;
-		
-		if (cnt >= ncount)
-		{
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-			minimap->addChildWindow(label);
-			label->setProperty("BackgroundEnabled", "true");
-			
-			if (label->isPropertyPresent ("BackgroundColours"))
-			{
-				label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
-			}
-			else if (label->isPropertyPresent ("BackgroundColour"))
-			{
-				label->setProperty("BackgroundColour", "00000000");
-			}
-
-			// Not yet sure whether it looks nicer with a frame or without it...
-			// If a frame is used, a larger image size needs to be specified.
-#if 1
-			label->setProperty("FrameEnabled", "true");
-			label->setSize(CEGUI::UVector2(cegui_reldim(0.038f), cegui_reldim( 0.038f)));
-#else
-			label->setProperty("FrameEnabled", "false");
-			label->setSize(CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim( 0.03f)));
-#endif
-			label->setMousePassThroughEnabled(true);
-			Player* playerPtr = static_cast<Player*> (pl);
-			if (playerPtr)
-			{
-				std::string playerScreenImage = playerPtr->getEmotionImage("normal");
-				label->setProperty ("Image", playerScreenImage.c_str ()); 
-			}
-
-			label->setInheritsAlpha (false);
-			label->setAlwaysOnTop(true);
-			
-			DEBUG("creating Window!");
-			
-			ncount ++;
-		}
-		else
-		{
-			label = win_mgr.getWindow(stream.str());
-		}
-
-		if (m_reloadIconsOnNextUpdate)
-		{
-			if (win_mgr.isWindowPresent (stream.str ().c_str ()))
-			{
-				label = win_mgr.getWindow (stream.str ().c_str ());
-				Player* playerPtr = static_cast<Player*> (pl);
-				if (playerPtr)
-				{
-					std::string playerScreenImage = playerPtr->getEmotionImage ("normal");
-					label->setProperty ("Image", playerScreenImage.c_str ()); 
-				}
-			}
-			m_reloadIconsOnNextUpdate = false;
-		}
-
-		alpha = 0.5;
-		if (pl == player)
-		{
-			alpha = 1.0;
-		}
-		if (label->getAlpha() != alpha)
-		{
-			label->setAlpha(alpha);
-		}
-		
-		if (region->getDimX()>region->getDimY())
-		{
-			relx =pl->getShape()->m_center.m_x/ region->getDimX()/4.0f - 0.015;
-			rely =(pl->getShape()->m_center.m_y +2*(region->getDimX()-region->getDimY()))/ region->getDimX()/4.0f - 0.015;
-		}
-		else
-		{
-			relx =(pl->getShape()->m_center.m_x +2*(region->getDimY()-region->getDimX()))/ region->getDimY()/4 - 0.015;
-			rely =pl->getShape()->m_center.m_y/ region->getDimY()/4 - 0.015;
-		}
-		
-		DEBUGX("relx %f  rely %f",relx,rely);
-		
-		label->setPosition(CEGUI::UVector2(cegui_reldim(relx), cegui_reldim(rely)));
-		label->setVisible(true);
-		cnt++;
-	}
-	
-	// Hide the rest of the labels.
-	for (; cnt <ncount; cnt++)
-	{
-		stream.str("");
-		stream << "PlayerMinimapImage";
-		stream << cnt;
-			
-		label = win_mgr.getWindow(stream.str());
-		label->setVisible(false);
-	}
-	
-	// Check to see whether the label displaying the region name needs to be updated.
-	label = win_mgr.getWindow("RegionNameLabel");
-	
-	std::string regionName (region->getName ());
-	DEBUGX ("Got region name as: [%s]", regionName.c_str ());
-
-	CEGUI::String actualRegionName = (CEGUI::utf8*) dgettext("sumwars",regionName.c_str());
-	DEBUGX ("Got actual region name as: [%s]", actualRegionName.c_str ());
-
-	if (actualRegionName != label->getText())
-	{
-		DEBUGX ("Region name update; old vs new [%s] - [%s]", label->getText().c_str (), actualRegionName.c_str ());
-		label->setText (actualRegionName);
-	}
-	
-}
-
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for inventory.");
+		if (!wndHeld) SW_DEBUG ("ERROR: Unable to get the window for inventory.");
+	}
+	m_window = minimapWnd_holder;
+
+	/*
+	Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("RttMat", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+	Ogre::Technique *technique = material->createTechnique();
+	technique->createPass();
+	material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
+	material->getTechnique(0)->getPass(0)->createTextureUnitState("minimap_tex");
+	
+	Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("minimapOverlay");
+	Ogre::OverlayContainer* container = (Ogre::OverlayContainer*) Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "minimapContainer");
+	overlay->add2D(container);
+	container->setMaterialName("RttMat");
+	container->setDimensions(0.8, 0.8);
+	//textArea->setMetricsMode(GMM_PIXELS);
+	container->setPosition(0.1, 0.1);
+	overlay->show();
+	*/
+}
+
+
+/**
+ * \fn virtual void reloadIconsOnNextUpdate ()
+ * \brief Makes sure that at the next update, minimap icons are reloaded.
+ */
+void MinimapWindow::reloadIconsOnNextUpdate ()
+{
+	m_reloadIconsOnNextUpdate = true;
+}
+
+
+
+void MinimapWindow::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::FrameWindow* minimap = (CEGUI::FrameWindow*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "MinimapWindow");
+
+	Player* player = m_document->getLocalPlayer();
+	if (player ==0)
+		return;
+	
+	Region* region = player->getRegion();
+	if (region ==0)
+		return;
+	
+	const WorldObjectMap& players = region->getPlayers();
+	WorldObjectMap::const_iterator it;
+	WorldObject* pl;
+
+	// Window counter
+	static int ncount =0;
+	
+	CEGUI::Window* label;
+	std::ostringstream stream;
+	
+	int cnt =0;
+	float relx, rely;
+	float alpha;
+	for (it = players.begin(); it != players.end(); ++it)
+	{
+		pl = it->second;
+		stream.str("");
+		stream << "PlayerMinimapImage"<<cnt;
+		
+		if (cnt >= ncount)
+		{
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+			CEGUIUtility::addChildWidget (minimap, label);
+
+			label->setProperty("BackgroundEnabled", "true");
+			
+			if (label->isPropertyPresent ("BackgroundColours"))
+			{
+				label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
+			}
+			else if (label->isPropertyPresent ("BackgroundColour"))
+			{
+				label->setProperty("BackgroundColour", "00000000");
+			}
+
+			// Not yet sure whether it looks nicer with a frame or without it...
+			// If a frame is used, a larger image size needs to be specified.
+
+#if 1
+			std::string propertyValue ("true");
+#else
+			std::string propertyValue ("false");
+#endif
+
+			label->setProperty("FrameEnabled", propertyValue);
+			CEGUIUtility::setWidgetSizeRel (label, 0.038f, 0.038f);
+
+			label->setMousePassThroughEnabled(true);
+			Player* playerPtr = static_cast<Player*> (pl);
+			if (playerPtr)
+			{
+				std::string playerScreenImage = playerPtr->getEmotionImage("normal");
+				label->setProperty ("Image", playerScreenImage.c_str ()); 
+			}
+
+			label->setInheritsAlpha (false);
+			label->setAlwaysOnTop(true);
+			
+			SW_DEBUG("creating Window!");
+			
+			ncount ++;
+		}
+		else
+		{
+			stream.str ("");
+			stream << "MinimapWindow/PlayerMinimapImage";
+			stream << cnt;
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		}
+
+		if (m_reloadIconsOnNextUpdate)
+		{
+			stream.str ("");
+			stream << "MinimapWindow/PlayerMinimapImage";
+			stream << cnt;
+
+			if (CEGUIUtility::isWindowPresent (stream.str ().c_str ()))
+			{
+				label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str ().c_str ());
+				Player* playerPtr = static_cast<Player*> (pl);
+				if (playerPtr)
+				{
+					std::string playerScreenImage = playerPtr->getEmotionImage ("normal");
+					label->setProperty ("Image", playerScreenImage.c_str ()); 
+				}
+			}
+			m_reloadIconsOnNextUpdate = false;
+		}
+
+		alpha = 0.5;
+		if (pl == player)
+		{
+			alpha = 1.0;
+		}
+		if (label->getAlpha() != alpha)
+		{
+			label->setAlpha(alpha);
+		}
+		
+		if (region->getDimX()>region->getDimY())
+		{
+			relx =pl->getShape()->m_center.m_x/ region->getDimX()/4.0f - 0.015;
+			rely =(pl->getShape()->m_center.m_y +2*(region->getDimX()-region->getDimY()))/ region->getDimX()/4.0f - 0.015;
+		}
+		else
+		{
+			relx =(pl->getShape()->m_center.m_x +2*(region->getDimY()-region->getDimX()))/ region->getDimY()/4 - 0.015;
+			rely =pl->getShape()->m_center.m_y/ region->getDimY()/4 - 0.015;
+		}
+		
+		DEBUGX("relx %f  rely %f",relx,rely);
+		
+		label->setPosition(CEGUI::UVector2(cegui_reldim(relx), cegui_reldim(rely)));
+		label->setVisible(true);
+		cnt++;
+	}
+	
+	// Hide the rest of the labels.
+	for (; cnt <ncount; cnt++)
+	{
+		stream.str("");
+		stream << "MinimapWindow/PlayerMinimapImage";
+		stream << cnt;
+			
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		label->setVisible(false);
+	}
+	
+	// Check to see whether the label displaying the region name needs to be updated.
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "MinimapWindow/RegionNameLabel");
+	
+	std::string regionName (region->getName ());
+	DEBUGX ("Got region name as: [%s]", regionName.c_str ());
+
+	CEGUI::String actualRegionName = (CEGUI::utf8*) dgettext("sumwars",regionName.c_str());
+	DEBUGX ("Got actual region name as: [%s]", actualRegionName.c_str ());
+
+	if (actualRegionName != label->getText())
+	{
+		DEBUGX ("Region name update; old vs new [%s] - [%s]", label->getText().c_str (), actualRegionName.c_str ());
+		label->setText (actualRegionName);
+	}
+	
+}
+
--- a/src/gui/music.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "music.h"
-
-#include <iostream>
-#include "debug.h"
-
-void MusicManager::play(std::string file)
-{
-	try
-	{
-		m_ogg_stream.open(file);
-		if(!m_ogg_stream.playback())
-		{
-			ERRORMSG("Ogg refused to play file %s.",file.c_str());
-			return;
-		}
-		
-		m_musicfile = file;
-		m_is_playing = true;
-	}
-	catch (std::string & error)
-	{
-		ERRORMSG("Ogg errormessage: %s",error.c_str());
-	}
-}
-
-void MusicManager::update()
-{
-	if (!m_is_playing)
-		return;
-	
-	bool active = m_ogg_stream.update();
-			
-	if (active)
-	{
-		if(!m_ogg_stream.playing())
-		{
-			if(!m_ogg_stream.playback())
-			{
-				stop();
-				ERRORMSG("Ogg abruptly stopped playing file %s",m_musicfile.c_str());
-			}
-			else
-			{
-				stop();
-				ERRORMSG("Ogg stream playing file %s was interrupted",m_musicfile.c_str());
-			}
-		}
-	}
-	
-	if (!active && m_musicfile != "")
-	{
-		stop();
-	}
-	
-}
-
-void MusicManager::stop()
-{
-	if (!m_is_playing)
-		return;
-	
-	try
-	{
-		m_is_playing = false;
-		m_ogg_stream.release();
-	}
-	catch (std::string & msg)
-	{
-		
-	}
-}
--- a/src/gui/music.h	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __SUMWARS_GUI_MUSIC_H__
-#define __SUMWARS_GUI_MUSIC_H__
-
-#include <string>
-
-#include "ogg.h"
-
-class MusicManager
-{
-	public:
-		/**
-		 * \brief Konstruktor
-		 */
-		MusicManager()
-		{
-			m_musicfile = "";
-			m_is_playing = false;
-			m_music_volume = 1;
-		}
-		
-		/**
-		 * \brief Destruktor
-		 */
-		~MusicManager()
-		{
-			if (m_is_playing)
-			{
-				stop();
-			}
-		}
-		
-		/**
-		 * \brief Spielt eine Musikdatei im .ogg Format ab
-		 * \param file Musikdatei
-		 * Spielt eine Musikdatei im .ogg Format ab. Die evtl zuvor laufende Musik wird gestoppt
-		 */
-		void play(std::string file);
-		
-		/**
-		 * \brief Stoppt das Abspielen der Musik
-		 */
-		void stop();
-		
-		
-		/**
-		 * \brief Aktualisierung, muss regelmaessig aufgerufen werden
-		 */
-		void update();
-			
-		/**
-		 * \brief Gibt die einzige Instanz der Klasse aus
-		 */
-		static MusicManager& instance()
-		{
-			static MusicManager inst;
-			return inst;
-		}
-		
-		/**
-		 * \brief Gibt aus, ob gerade Musik gespielt wird
-		 */
-		bool isPlaying()
-		{
-			return m_is_playing;
-		}
-		
-		/**
-		 * \fn void setMusicVolume(float vol)
-		 * \brief Stellt die Lautstaerke ein
-		 * \param vol Lautstaerke (0-1)
-		 */
-		void setMusicVolume(float vol)
-		{
-			m_music_volume = vol;
-			m_ogg_stream.setVolume(vol);
-		}
-
-		/**
-		 * \fn float getMusicVolume()
-		 * \brief Gibt die Lautstaerke des Sounds aus
-		 */
-		float getMusicVolume()
-		{
-			return m_music_volume;
-		}
-		
-	private:
-		
-		/**
-		 * \brief aktuell abgespielete Musikdatei
-		 */
-		std::string m_musicfile;
-		
-		/**
-		 * \brief Gibt an, ob gerade eine Datei abgespielt wird
-		 */
-		bool m_is_playing;
-		
-		/**
-		 * \brief Hilfsklasse fuer das Abspielen von ogg Dateien
-		 */
-		ogg_stream m_ogg_stream;
-		
-		/**
-		 * \brief Lautstaerke
-		 */
-		float m_music_volume;
-	
-};
-
-#endif // __SUMWARS_GUI_MUSIC_H__
--- a/src/gui/networkwindows.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/networkwindows.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,352 +1,321 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "networkwindows.h"
-
-HostGameWindow::HostGameWindow (Document* doc)
-	:Window(doc)
-{
-	DEBUG ("HostGameWindow being created");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	CEGUI::Editbox* box;
-
-	// The host game window and holder
-	CEGUI::FrameWindow* host_game = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("hostgamewindow.layout");
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "networkwindows.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+HostGameWindow::HostGameWindow (Document* doc)
+	:Window(doc)
+{
+	SW_DEBUG ("HostGameWindow being created");
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	CEGUI::Editbox* box;
+
+	// The host game window and holder
+	CEGUI::FrameWindow* host_game = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("hostgamewindow.layout");
 	if (!host_game)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow.layout");
 	}
 
-	CEGUI::Window* host_game_holder = win_mgr.loadWindowLayout( "hostgamewindow_holder.layout" );
+	CEGUI::Window* host_game_holder = CEGUIUtility::loadLayoutFromFile ("hostgamewindow_holder.layout");
 	if (!host_game_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow_holder.layout");
 	}
 	
-	CEGUI::Window* wndHolder = win_mgr.getWindow("HostGameWindow_Holder");
-	CEGUI::Window* wndCharInfo = win_mgr.getWindow("HostGameWindow");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (host_game_holder, "HostGameWindow_Holder");
+	CEGUI::Window* wndCharInfo = CEGUIUtility::getWindowForLoadedLayoutEx (host_game, "HostGameWindow");
 	if (wndHolder && wndCharInfo)
 	{
-		wndHolder->addChildWindow (wndCharInfo);
+		CEGUIUtility::addChildWidget (wndHolder, wndCharInfo);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen.");
+	}
+
+	m_window = host_game_holder;
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostGameStartButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&HostGameWindow ::onStartHostGame, this));
+		
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/PlayerNumberBox"));
+	box->setWantsMultiClickEvents(false);
+	box->setMaxTextLength(31);
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostPortBox"));
+	box->setWantsMultiClickEvents(false);
+	box->setMaxTextLength(31);
+	
+	// Connect the Cancel button to the cancel event.
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostGameCancelButton"));
+	btn->setID(5);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&HostGameWindow::onCancelHostGame, this));
+
+	// Connect the window close button to the cancel event.
+	CEGUI::Window* autoCloseButton;
+	autoCloseButton = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/__auto_closebutton__");
+	if (autoCloseButton)
+	{
+		autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&HostGameWindow::onCancelHostGame, this));
 	}
-
-	m_window = host_game_holder;
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("HostGameStartButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&HostGameWindow ::onStartHostGame, this));
-		
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PlayerNumberBox"));
-	box->setWantsMultiClickEvents(false);
-	box->setMaxTextLength(31);
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostPortBox"));
-	box->setWantsMultiClickEvents(false);
-	box->setMaxTextLength(31);
-	
-	// Connect the Cancel button to the cancel event.
-	if (win_mgr.isWindowPresent ("HostGameCancelButton"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("HostGameCancelButton"));
-		btn->setID(5);
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&HostGameWindow::onCancelHostGame, this));
-	}
-
-	// Connect the window close button to the cancel event.
-	if (win_mgr.isWindowPresent ("HostGameWindow__auto_closebutton__"))
+
+	updateTranslation();
+}
+
+void HostGameWindow::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* box;
+	
+	Options* options = Options::getInstance();
+	
+	int port = options->getPort();
+	int max_nr = options->getMaxNumberPlayers();
+	
+	std::ostringstream stream;
+	stream.str("");
+	stream << max_nr;
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/PlayerNumberBox"));
+	if (box->getText() != stream.str())
+	{
+		box->setText(stream.str());
+	}
+	
+	stream.str("");
+	stream << port;
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostPortBox"));
+	if (box->getText() != stream.str())
 	{
-		CEGUI::Window* autoCloseButton;
-		autoCloseButton = win_mgr.getWindow ("HostGameWindow__auto_closebutton__");
-		if (autoCloseButton)
-		{
-			autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&HostGameWindow::onCancelHostGame, this));
-		}
-	}
-
-	updateTranslation();
-}
-
-void HostGameWindow::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* box;
-	
-	Options* options = Options::getInstance();
-	
-	int port = options->getPort();
-	int max_nr = options->getMaxNumberPlayers();
-	
-	std::ostringstream stream;
-	stream.str("");
-	stream << max_nr;
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PlayerNumberBox"));
-	if (box->getText() != stream.str())
-	{
-		box->setText(stream.str());
-	}
-	
-	stream.str("");
-	stream << port;
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostPortBox"));
-	if (box->getText() != stream.str())
-	{
-		box->setText(stream.str());
-	}
-
-}
-
-void HostGameWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "HostGameStartButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-
-	if (win_mgr.isWindowPresent ("HostGameCancelButton"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "HostGameCancelButton"));
-		btn->setText((CEGUI::utf8*) gettext("Cancel"));
-	}
-
-	if (win_mgr.isWindowPresent ("HostWindowTitle"))
-	{
-		// Old style host window title.
-		label = win_mgr.getWindow("HostWindowTitle");
-		label->setText((CEGUI::utf8*) gettext("Host_game"));
-	}
-	else if (win_mgr.isWindowPresent ("HostGameWindow"))
-	{
-		label = win_mgr.getWindow("HostGameWindow");
-		label->setText((CEGUI::utf8*) gettext("Host_game"));
-	}
-	
-	label = win_mgr.getWindow("PlayerNumberLabel");
-	label->setText((CEGUI::utf8*) gettext("Max. number of players"));
-	
-	label = win_mgr.getWindow("HostPortLabel");
-	label->setText((CEGUI::utf8*) gettext("Port"));
-}
-
-
-bool HostGameWindow::onStartHostGame(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* box;
-	
-	Options* options = Options::getInstance();
-	
-	int port = options->getPort();
-	int max_nr = options->getMaxNumberPlayers();
-	
-	std::stringstream stream,stream2;
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostPortBox"));
-	stream.str(box->getText().c_str());
-	stream >> port;
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PlayerNumberBox"));
-	stream2.str(box->getText().c_str());
-	stream2 >> max_nr;
-	
-	options->setPort(port);
-	options->setMaxNumberPlayers(max_nr);
-	
-	m_document->onButtonStartHostGame();
-	return true;
-}
-
-
-bool HostGameWindow::onCancelHostGame (const CEGUI::EventArgs& evt)
-{
-	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
-	m_document->setModified(Document::WINDOWS_MODIFIED);
-
-	return true;
-}
-
-
-
-JoinGameWindow::JoinGameWindow (Document* doc)
-	:Window(doc)
-{
-	DEBUG ("JoinGameWindow being created");
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	CEGUI::Editbox* box;
-
-	// The join game window and holder.
-	CEGUI::FrameWindow* join_game = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("joingamewindow.layout");
+		box->setText(stream.str());
+	}
+
+}
+
+void HostGameWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostGameStartButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostGameCancelButton"));
+	btn->setText((CEGUI::utf8*) gettext("Cancel"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow");
+	label->setText((CEGUI::utf8*) gettext("Host_game"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/PlayerNumberLabel");
+	label->setText((CEGUI::utf8*) gettext("Max. number of players"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostPortLabel");
+	label->setText((CEGUI::utf8*) gettext("Port"));
+}
+
+
+bool HostGameWindow::onStartHostGame(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* box;
+	
+	Options* options = Options::getInstance();
+	
+	int port = options->getPort();
+	int max_nr = options->getMaxNumberPlayers();
+	
+	std::stringstream stream,stream2;
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/HostPortBox"));
+	stream.str(box->getText().c_str());
+	stream >> port;
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "HostGameWindow/PlayerNumberBox"));
+	stream2.str(box->getText().c_str());
+	stream2 >> max_nr;
+	
+	options->setPort(port);
+	options->setMaxNumberPlayers(max_nr);
+	
+	m_document->onButtonStartHostGame();
+	return true;
+}
+
+
+bool HostGameWindow::onCancelHostGame (const CEGUI::EventArgs& evt)
+{
+	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
+	m_document->setModified(Document::WINDOWS_MODIFIED);
+
+	return true;
+}
+
+
+
+JoinGameWindow::JoinGameWindow (Document* doc)
+	:Window(doc)
+{
+	SW_DEBUG ("JoinGameWindow being created");
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	CEGUI::Editbox* box;
+
+	// The join game window and holder.
+	CEGUI::FrameWindow* join_game = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("joingamewindow.layout");
 	if (!join_game)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "joingamewindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "joingamewindow.layout");
 	}
 
-	CEGUI::Window* join_game_holder = win_mgr.loadWindowLayout( "joingamewindow_holder.layout" );
+	CEGUI::Window* join_game_holder = CEGUIUtility::loadLayoutFromFile ("joingamewindow_holder.layout");
 	if (!join_game_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "joingamewindow_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "joingamewindow_holder.layout");
 	}
 	
-	CEGUI::Window* wndHolder = win_mgr.getWindow("JoinGameWindow_Holder");
-	CEGUI::Window* wndCharInfo = win_mgr.getWindow("JoinGameWindow");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (join_game_holder, "JoinGameWindow_Holder");
+	CEGUI::Window* wndCharInfo = CEGUIUtility::getWindowForLoadedLayoutEx (join_game, "JoinGameWindow");
 	if (wndHolder && wndCharInfo)
 	{
-		wndHolder->addChildWindow (wndCharInfo);
+		CEGUIUtility::addChildWidget (wndHolder, wndCharInfo);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+		if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen.");
 	}
-
-	m_window = join_game_holder;
-		
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("JoinGameStartButton"));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&JoinGameWindow ::onStartJoinGame, this));
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostnameBox"));
-	box->setWantsMultiClickEvents(false);
-	box->setMaxTextLength(31);
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PortBox"));
-	box->setWantsMultiClickEvents(false);
-	box->setMaxTextLength(31);
-
-	// Connect the Cancel button to the cancel event.
-	if (win_mgr.isWindowPresent ("JoinGameCancelButton"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("JoinGameCancelButton"));
-		btn->setID(5);
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&JoinGameWindow::onCancelJoinGame, this));
-	}
-
-	// Connect the window close button to the cancel event.
-	if (win_mgr.isWindowPresent ("JoinGameWindow__auto_closebutton__"))
+
+	m_window = join_game_holder;
+		
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/JoinGameStartButton"));
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&JoinGameWindow ::onStartJoinGame, this));
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/HostnameBox"));
+	box->setWantsMultiClickEvents(false);
+	box->setMaxTextLength(31);
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/PortBox"));
+	box->setWantsMultiClickEvents(false);
+	box->setMaxTextLength(31);
+
+	// Connect the Cancel button to the cancel event.
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/JoinGameCancelButton"));
+	btn->setID(5);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&JoinGameWindow::onCancelJoinGame, this));
+
+	// Connect the window close button to the cancel event.
+	CEGUI::Window* autoCloseButton;
+	autoCloseButton = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/__auto_closebutton__");
+	if (autoCloseButton)
+	{
+		autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&JoinGameWindow::onCancelJoinGame, this));
+	}
+	
+	updateTranslation();
+}
+
+void JoinGameWindow::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* box;
+	
+	Options* options = Options::getInstance();
+	
+	int port = options->getPort();
+	std::ostringstream stream;
+	std::string hostname = options->getServerHost();
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/HostnameBox"));
+	if (box->getText() != hostname)
+	{
+		box->setText(hostname);
+	}
+	
+	stream.str("");
+	stream << port;
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/PortBox"));
+	if (box->getText() != stream.str())
 	{
-		CEGUI::Window* autoCloseButton;
-		autoCloseButton = win_mgr.getWindow ("JoinGameWindow__auto_closebutton__");
-		if (autoCloseButton)
-		{
-			autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&JoinGameWindow::onCancelJoinGame, this));
-		}
-	}
-	
-	updateTranslation();
-}
-
-void JoinGameWindow::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* box;
-	
-	Options* options = Options::getInstance();
-	
-	int port = options->getPort();
-	std::ostringstream stream;
-	std::string hostname = options->getServerHost();
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostnameBox"));
-	if (box->getText() != hostname)
-	{
-		box->setText(hostname);
-	}
-	
-	stream.str("");
-	stream << port;
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PortBox"));
-	if (box->getText() != stream.str())
-	{
-		box->setText(stream.str());
-	}
-
-}
-
-void JoinGameWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "JoinGameStartButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-	
-	if (win_mgr.isWindowPresent ("JoinGameCancelButton"))
-	{
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "JoinGameCancelButton"));
-		btn->setText((CEGUI::utf8*) gettext("Cancel"));
-	}
-
-	if (win_mgr.isWindowPresent ("JoinWindowTitle"))
-	{
-		label = win_mgr.getWindow("JoinWindowTitle");
-		label->setText((CEGUI::utf8*) gettext("Join_game"));
-	}
-	else if (win_mgr.isWindowPresent ("JoinGameWindow"))
-	{
-		label = win_mgr.getWindow("JoinGameWindow");
-		label->setText((CEGUI::utf8*) gettext("Join_game"));
-	}
-	
-	label = win_mgr.getWindow("HostnameLabel");
-	label->setText((CEGUI::utf8*) gettext("Host"));
-	
-	label = win_mgr.getWindow("PortLabel");
-	label->setText((CEGUI::utf8*) gettext("Port"));
-}
-
-
-bool JoinGameWindow::onStartJoinGame(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Editbox* box;
-	
-	Options* options = Options::getInstance();
-	
-	int port = options->getPort();
-	std::stringstream stream;
-	std::string hostname = options->getServerHost();
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("HostnameBox"));
-	hostname = box->getText().c_str();
-	
-	box = static_cast<CEGUI::Editbox*>(win_mgr.getWindow("PortBox"));
-	stream.str(box->getText().c_str());
-	stream >> port;
-	
-	DEBUG("join game %i %s",port,hostname.c_str());
-	options->setPort(port);
-	options->setServerHost(hostname);
-	
-	m_document->onButtonStartJoinGame();
-	return true;
-}
-
-
-bool JoinGameWindow::onCancelJoinGame (const CEGUI::EventArgs& evt)
-{
-	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
-	m_document->setModified(Document::WINDOWS_MODIFIED);
-
-	return true;
-}
-
+		box->setText(stream.str());
+	}
+
+}
+
+void JoinGameWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/JoinGameStartButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/JoinGameCancelButton"));
+	btn->setText((CEGUI::utf8*) gettext("Cancel"));
+
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow");
+	label->setText((CEGUI::utf8*) gettext("Join_game"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/HostnameLabel");
+	label->setText((CEGUI::utf8*) gettext("Host"));
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/PortLabel");
+	label->setText((CEGUI::utf8*) gettext("Port"));
+}
+
+
+bool JoinGameWindow::onStartJoinGame(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Editbox* box;
+	
+	Options* options = Options::getInstance();
+	
+	int port = options->getPort();
+	std::stringstream stream;
+	std::string hostname = options->getServerHost();
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/HostnameBox"));
+	hostname = box->getText().c_str();
+	
+	box = static_cast<CEGUI::Editbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "JoinGameWindow/PortBox"));
+	stream.str(box->getText().c_str());
+	stream >> port;
+	
+	SW_DEBUG("join game %i %s",port,hostname.c_str());
+	options->setPort(port);
+	options->setServerHost(hostname);
+	
+	m_document->onButtonStartJoinGame();
+	return true;
+}
+
+
+bool JoinGameWindow::onCancelJoinGame (const CEGUI::EventArgs& evt)
+{
+	m_document->getGUIState()->m_shown_windows = Document::START_MENU;
+    m_document->setState(Document::INACTIVE);
+	m_document->setModified(Document::WINDOWS_MODIFIED);
+
+	return true;
+}
+
--- a/src/gui/ogg.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ogg.h"
-#include "debug.h"
-
-using namespace std;
-
-void ogg_stream::open(string path)
-{
-	if (!m_initialized)
-	{
-		alGenSources(1, &source);
-		int error = alGetError();
-
-		if(error != AL_NO_ERROR)
-		{
-			return;
-		}
-		m_initialized = true;
-	}
-    int result;
-    
-    if(!(oggFile = fopen(path.c_str(), "rb")))
-        throw string("Could not open Ogg file.");
-
-    if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
-    {
-        fclose(oggFile);
-        
-        throw string("Could not open Ogg stream. ") + errorString(result);
-    }
-	
-	vorbisInfo = ov_info(&oggStream, -1);
-    vorbisComment = ov_comment(&oggStream, -1);
-
-    if(vorbisInfo->channels == 1)
-        format = AL_FORMAT_MONO16;
-    else
-        format = AL_FORMAT_STEREO16;
-        
-    alGenBuffers(2, buffers);
-	oggcheck();
-    alSource3f(source, AL_POSITION,        0.0, 0.0, 0.0);
-    alSource3f(source, AL_VELOCITY,        0.0, 0.0, 0.0);
-    alSource3f(source, AL_DIRECTION,       0.0, 0.0, 0.0);
-    alSourcef (source, AL_ROLLOFF_FACTOR,  0.0          );
-    alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );
-	alSourcef (source, AL_GAIN,m_volume);
-	
-}
-
-
-
-
-void ogg_stream::release()
-{
-    alSourceStop(source);
-    empty();
-    alDeleteBuffers(2, buffers);
-    oggcheck();
-
-    ov_clear(&oggStream);
-}
-
-
-
-
-void ogg_stream::display()
-{
-    cout
-        << "version         " << vorbisInfo->version         << "\n"
-        << "channels        " << vorbisInfo->channels        << "\n"
-        << "rate (hz)       " << vorbisInfo->rate            << "\n"
-        << "bitrate upper   " << vorbisInfo->bitrate_upper   << "\n"
-        << "bitrate nominal " << vorbisInfo->bitrate_nominal << "\n"
-        << "bitrate lower   " << vorbisInfo->bitrate_lower   << "\n"
-        << "bitrate window  " << vorbisInfo->bitrate_window  << "\n"
-        << "\n"
-        << "vendor " << vorbisComment->vendor << "\n";
-        
-    for(int i = 0; i < vorbisComment->comments; i++)
-        cout << "   " << vorbisComment->user_comments[i] << "\n";
-        
-    cout << endl;
-}
-
-
-
-
-bool ogg_stream::playback()
-{
-    if(playing())
-        return true;
-        
-    if(!stream(buffers[0]))
-        return false;
-        
-    if(!stream(buffers[1]))
-        return false;
-    
-    alSourceQueueBuffers(source, 2, buffers);
-    alSourcePlay(source);
-    
-    return true;
-}
-
-
-
-
-bool ogg_stream::playing()
-{
-    ALenum state;
-    
-    alGetSourcei(source, AL_SOURCE_STATE, &state);
-    
-    return (state == AL_PLAYING);
-}
-
-
-
-
-bool ogg_stream::update()
-{
-    int processed;
-    bool active = true;
-
-    alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
-	oggcheck();
-	while(processed>0)
-    {
-		processed--;
-		DEBUGX("processed %i",processed+1);
-        ALuint buffer;
-        
-        alSourceUnqueueBuffers(source, 1, &buffer);
-		DEBUGX("unqueued buffer %i", buffer);
-        oggcheck();
-
-        active = stream(buffer);
-
-        alSourceQueueBuffers(source, 1, &buffer);
-        oggcheck();
-    }
-
-	if (active && !playing())
-	{
-		alSourcePlay(source);
-	}
-
-    return active;
-}
-
-
-
-
-bool ogg_stream::stream(ALuint buffer)
-{
-	DEBUGX("streaming buffer %i",buffer);
-	char pcm[BUFFER_SIZE];
-    int  size = 0;
-    int  section;
-    int  result;
-
-    while(size < BUFFER_SIZE)
-    {
-        result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
-    
-        if(result > 0)
-            size += result;
-        else
-            if(result < 0)
-                throw errorString(result);
-            else
-                break;
-    }
-    
-    if(size == 0)
-	{
-		return false;
-	}
-    
-	if (!alIsBuffer(buffer))
-	{
-		DEBUG("specified number is not a buffer");
-	}
-    alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
-    oggcheck();
-    
-    return true;
-}
-
-
-
-
-void ogg_stream::empty()
-{
-    int queued;
-    
-    alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
-    
-    while(queued--)
-    {
-        ALuint buffer;
-    
-        alSourceUnqueueBuffers(source, 1, &buffer);
-        oggcheck();
-    }
-}
-
-
-
-
-void ogg_stream::oggcheck()
-{
-	int error = alGetError();
-
-	if(error != AL_NO_ERROR)
-	{
-		ERRORMSG("AL error message %s",alGetString(error));
-	}
-}
-
-
-
-string ogg_stream::errorString(int code)
-{
-    switch(code)
-    {
-        case OV_EREAD:
-            return string("Read from media.");
-        case OV_ENOTVORBIS:
-            return string("Not Vorbis data.");
-        case OV_EVERSION:
-            return string("Vorbis version mismatch.");
-        case OV_EBADHEADER:
-            return string("Invalid Vorbis header.");
-        case OV_EFAULT:
-            return string("Internal logic fault (bug or heap/stack corruption.");
-        default:
-            return string("Unknown Ogg error.");
-    }
-}
--- a/src/gui/ogg.h	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __SUMWARS_GUI_OGG_H__
-#define __SUMWARS_GUI_OGG_H__
-
-#include <string>
-#include <iostream>
-
-#ifdef WIN32
-	#include <al.h>
-#else
-	#include <AL/al.h>
-#endif
-
-#include <ogg/ogg.h>
-#include <vorbis/vorbisfile.h>
-
-
-
-#define BUFFER_SIZE (4096 * 16)
-
-
-
-class ogg_stream
-{
-public:
-	ogg_stream():
-		oggFile(0),
-		vorbisInfo(0),
-		vorbisComment(0),
-
-		source(0),
-
-		m_volume(1.0f),
-		m_initialized(false)
-	{}
-	
-	~ogg_stream()
-	{ 
-		if (m_initialized)
-		{
-			alDeleteSources(1, &source);
-			oggcheck();
-		}
-	}
-    
-        void open(std::string path);
-        void release();
-        void display();
-        bool playback();
-        bool playing();
-        bool update();
-		
-		void setVolume(float volume)
-		{
-			if (playing())
-			{
-				alSourcef (source, AL_GAIN,volume);
-			}
-			m_volume = volume;
-		}
-
-    protected:
-
-        bool stream(ALuint buffer);
-        void empty();
-        void oggcheck();
-        std::string errorString(int code);
-
-    private:
-
-        FILE*           oggFile;
-        OggVorbis_File  oggStream;
-        vorbis_info*    vorbisInfo;
-        vorbis_comment* vorbisComment;
-
-        ALuint buffers[2];
-        ALuint source;
-        ALenum format;
-		float m_volume;
-		bool m_initialized;
-};
-
-
-#endif // __SUMWARS_GUI_OGG_H__
--- a/src/gui/optionswindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/optionswindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -14,54 +14,66 @@
  */
 
 #include "optionswindow.h"
-#include "sound.h"
+//#include "sound.h"
 #include "listitem.h"
-#include "music.h"
+//#include "music.h"
 #include "sumwarshelper.h"
 
+// Allow the use of the sound manager.
+#include "gussound.h"
+
 // The following includes are added to support video mode changes in the options window.
 #include <OgreConfigFile.h>
 #include <OgreException.h>
 #include <OgreResourceGroupManager.h>
-#include "ceguiutility.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+// Sound operations helper.
+#include "soundhelper.h"
 
 using namespace std;
 
+using gussound::SoundManager;
+
 OptionsWindow::OptionsWindow (Document* doc, OIS::Keyboard *keyboard, const std::string& ceguiSkinName)
 	: Window (doc)
 	, m_ceguiSkinName (ceguiSkinName)
 {
+	CEGUI::PushButton* btn;
+
 	m_keyboard = keyboard;
 
-	DEBUG ("OptionsWindow being created using cegui skin [%s]", m_ceguiSkinName.c_str ());
+	SW_DEBUG ("OptionsWindow being created using cegui skin [%s]", m_ceguiSkinName.c_str ());
 	// Generate GUI Elements
 
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 
 	// Load the base options window - containing the actual elements.
-	CEGUI::FrameWindow* options = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("optionswindow.layout");
+	CEGUI::FrameWindow* options = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("optionswindow.layout");
 	if (!options)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "optionswindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "optionswindow.layout");
 	}
 
 	// Load the holder layout. This should be diffeent for each aspect ratio.
-	CEGUI::Window* options_holder = win_mgr.loadWindowLayout( "options_holder.layout" );
+	CEGUI::Window* options_holder = CEGUIUtility::loadLayoutFromFile ("options_holder.layout");
 	if (!options_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "options_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "options_holder.layout");
 	}
 
-	CEGUI::Window* wndHolder = win_mgr.getWindow("OptionsWindow_Holder");
-	CEGUI::Window* wndHeldWindow = win_mgr.getWindow("OptionsWindow");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (options_holder, "OptionsWindow_Holder");
+	CEGUI::Window* wndHeldWindow = CEGUIUtility::getWindowForLoadedLayoutEx (options, "OptionsWindow");
 	if (wndHolder && wndHeldWindow)
 	{
-		wndHolder->addChildWindow (wndHeldWindow);
+		CEGUIUtility::addChildWidget (wndHolder, wndHeldWindow);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for options window.");
-		if (!wndHeldWindow) DEBUG ("ERROR: Unable to get the window for options window.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for options window.");
+		if (!wndHeldWindow) SW_DEBUG ("ERROR: Unable to get the window for options window.");
 	}
 
 
@@ -69,30 +81,41 @@
 	options_holder->setAlwaysOnTop (true);
 	m_window = options_holder;
 
-	DEBUG ("OptionsWindow (ctor) loaded layout");
+	SW_DEBUG ("OptionsWindow (ctor) loaded layout");
 
 	// Rahmen fuer das Menue Savegame auswaehlen
-	CEGUI::TabControl* optionstab = (CEGUI::TabControl*) win_mgr.getWindow("OptionsWindowTab");
+	CEGUI::TabControl* optionstab = (CEGUI::TabControl*) CEGUIUtility::getWindowForLoadedLayoutEx (options, "OptionsWindowTab");
 	optionstab->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&OptionsWindow::onAreaMouseButtonPressed, this));
 	CEGUI::Window* label;
 	CEGUI::Scrollbar* slider;
 
-	label = win_mgr.getWindow("OptionsWindowTab__auto_TabPane__Buttons__auto_btnOptionsShortkeys");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, "__auto_TabPane__Buttons/__auto_btnOptionsShortkeys");
+	label->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+	label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
+	
 	label->setInheritsAlpha(false);
 	
-	label = win_mgr.getWindow("OptionsWindowTab__auto_TabPane__Buttons__auto_btnOptionsGameplay");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, "__auto_TabPane__Buttons/__auto_btnOptionsGameplay");
+	label->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+	label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
 	label->setInheritsAlpha(false);
 	
-	label = win_mgr.getWindow("OptionsWindowTab__auto_TabPane__Buttons__auto_btnOptionsSound");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, "__auto_TabPane__Buttons/__auto_btnOptionsSound");
+	label->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+	label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
 	label->setInheritsAlpha(false);
 	
-	label = win_mgr.getWindow("OptionsWindowTab__auto_TabPane__Buttons__auto_btnOptionsGraphic");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, "__auto_TabPane__Buttons/__auto_btnOptionsGraphic");
+	label->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+	label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
 	label->setInheritsAlpha(false);
 	
-	label = win_mgr.getWindow("OptionsWindowTab__auto_TabPane__Buttons__auto_btnOptionsMisc");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, "__auto_TabPane__Buttons/__auto_btnOptionsMisc");
+	label->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+	label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
 	label->setInheritsAlpha(false);
 	
-	DEBUG ("OptionsWindow (ctor) adding labels");
+	SW_DEBUG ("OptionsWindow (ctor) adding labels");
 
 	int targets[9] = {SHOW_INVENTORY, SHOW_CHARINFO, SHOW_SKILLTREE, SHOW_PARTYMENU, SHOW_CHATBOX, SHOW_QUESTINFO, SHOW_MINIMAP, SWAP_EQUIP, SHOW_ITEMLABELS};
 
@@ -100,23 +123,26 @@
 	for (int i=0; i<9; ++i)
 	{
 		stream.str("");
+		stream << "__auto_TabPane__/OptionsShortkeys/";
 		stream << "ShortkeyLabel"<<i;
 
-		label = win_mgr.getWindow(stream.str());
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, stream.str());
 		label->setID(targets[i]);
 		label->setWantsMultiClickEvents(false);
 
 		stream.str("");
+		stream << "__auto_TabPane__/OptionsShortkeys/";
 		stream << "ShortkeyValueLabel"<<i;
 
-		label = win_mgr.getWindow(stream.str());
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (optionstab, stream.str());
 		label->setID(targets[i]);
 		label->setWantsMultiClickEvents(false);
 		label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&OptionsWindow::onShortkeyLabelClicked,  this));
+		//label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover,  this));
 	}
 	
-	DEBUG ("Adding difficulty combo-box");
-	CEGUI::Combobox* diffcbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("DifficultyBox"));
+	SW_DEBUG ("Adding difficulty combo-box");//xxx
+	CEGUI::Combobox* diffcbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/DifficultyBox"));
 	diffcbo->addItem(new ListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Easy"),Options::EASY));
 	diffcbo->addItem(new ListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Normal"),Options::NORMAL));
 	diffcbo->addItem(new ListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Hard"),Options::HARD));
@@ -126,30 +152,34 @@
 	diffcbo->handleUpdatedListItemData();
 	diffcbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onDifficultyChanged, this));
 	diffcbo->setItemSelectState( (size_t) (Options::getInstance()->getDifficulty()-1),true);
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/DifficultyBox", "combobox");
 	
-	DEBUG ("Adding sliders");
-	slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow("TextSpeedSlider"));
+	SW_DEBUG ("Adding sliders");
+	slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/TextSpeedSlider"));
 	slider->setPageSize (0.01f);
 	slider->setDocumentSize(1.0f);
 	slider->setStepSize(0.01f);
 	slider->setWantsMultiClickEvents(false);
 	slider->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged, CEGUI::Event::Subscriber(&OptionsWindow::onTextSpeedChanged,  this));
+	slider->subscribeEvent(CEGUIUtility::EventMouseEntersScrollbarArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 	
-	slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow("MusicVolumeSlider"));
+	slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/MusicVolumeSlider"));
 	slider->setPageSize (0.01f);
 	slider->setDocumentSize(1.0f);
 	slider->setStepSize(0.01f);
 	slider->setWantsMultiClickEvents(false);
 	slider->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged, CEGUI::Event::Subscriber(&OptionsWindow::onMusicVolumeChanged,  this));
+	slider->subscribeEvent(CEGUIUtility::EventMouseEntersScrollbarArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 
-	slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow("SoundVolumeSlider"));
+	slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/SoundVolumeSlider"));
 	slider->setPageSize (0.01f);
 	slider->setDocumentSize(1.0f);
 	slider->setStepSize(0.01f);
 	slider->setWantsMultiClickEvents(false);
 	slider->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged, CEGUI::Event::Subscriber(&OptionsWindow::onSoundVolumeChanged,  this));
+	slider->subscribeEvent(CEGUIUtility::EventMouseEntersScrollbarArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 
-	CEGUI::Combobox* ehlcbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("EHColorBox"));
+	CEGUI::Combobox* ehlcbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/EHColorBox"));
 	ehlcbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("White"), "white", 0));
 	ehlcbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Black"), "black", 0));
 	ehlcbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Red"), "red", 0));
@@ -167,34 +197,42 @@
 	ehlcbo->setItemSelectState((size_t) getColorSelectionIndex("red"), true);
 	ehlcbo->handleUpdatedListItemData();
 	ehlcbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onEnemyHighlightChanged, this));
+	ehlcbo->subscribeEvent(CEGUIUtility::EventMouseEntersComboboxArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 	ehlcbo->setItemSelectState((size_t) (getColorSelectionIndex(Options::getInstance()->getEnemyHighlightColor())), true);
 
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/EHColorBox", "combobox");
+
 
-	CEGUI::Checkbox *chkbox = (CEGUI::Checkbox *) win_mgr.getWindow("GrabMouseInWindowedModeBox");
+	CEGUIUtility::ToggleButton *chkbox = static_cast<CEGUIUtility::ToggleButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (
+		m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/GrabMouseInWindowedModeBox"));
 	chkbox->setSelected(Options::getInstance()->getGrabMouseInWindowedMode());
-	chkbox->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&OptionsWindow::onGrabMouseChanged, this));
+	chkbox->subscribeEvent(CEGUIUtility::EventToggleButtonStateChanged (), CEGUI::Event::Subscriber(&OptionsWindow::onGrabMouseChanged, this));
+	chkbox->subscribeEvent(CEGUIUtility::ToggleButton::EventMouseClick, CEGUI::Event::Subscriber(&OptionsWindow::onGUIItemClicked, this));
+	chkbox->subscribeEvent(CEGUIUtility::EventMouseEntersToggleButtonArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 	
-	CEGUI::PushButton* btn;
-	//btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("ResetGraphicsButton"));
-	//btn->setID(5);
-	//btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&OptionsWindow::onResetGraphics, this));
-	// TODO: get rid of obsolete code.
 	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("OptionsCloseButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsCloseButton"));
 	btn->setID(5);
 	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&OptionsWindow::onButtonOkClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 
-	if (win_mgr.isWindowPresent ("OptionsWindow__auto_closebutton__"))
+	// todo: analyze this
+	try
 	{
-		label = win_mgr.getWindow ("OptionsWindow__auto_closebutton__");
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/__auto_closebutton__");
 		if (label)
 		{
 			label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&OptionsWindow::onButtonCancelClicked, this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this));
 		}
 	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Caught exception while creating events for optional object. Carrying on after the exception [%s]", e.what());
+	}
 	
 
-	CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("LanguageBox"));
+	CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsMisc/LanguageBox"));
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("System default"),"",0));
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), "German","de_DE",0));
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), "English GB","en_GB",0));
@@ -205,6 +243,8 @@
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), "Spanish ES","es_ES",0));
 
 	cbo->setReadOnly(true);
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsMisc/LanguageBox", "combobox");
+
 
 	int selection = 0;
 	std::string locale = Options::getInstance()->getLocale();
@@ -214,7 +254,7 @@
 		locale = locale.substr(0,pos);
 	}
 
-	DEBUG ("OptionsWindow (ctor) current locale is [%s]", locale.c_str ());
+	SW_DEBUG ("OptionsWindow (ctor) current locale is [%s]", locale.c_str ());
 	
 	for (int i=0; i < (int)cbo->getItemCount(); i++)
 	{
@@ -230,13 +270,13 @@
 	cbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onLanguageSelected, this));
 
 	// TODO: add comments.
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("DisplayModeBox"));
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx(m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/DisplayModeBox"));
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Fullscreen (Exclusive Mode)"),"",0));
 	cbo->addItem(new StrListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Window (With Borders)"),"",0));
 
 	if (Options::getInstance ()->isWindowedFullscreenModeSupported ())
 	{
-		DEBUG ("Windowed fullscreen mode supported! Adding combobox item.");
+		SW_DEBUG ("Windowed fullscreen mode supported! Adding combobox item.");
 		std::string modeName = gettext("Window (Fullscreen)");
 		std::string recommended = gettext (" - recommended");
 		std::string sum = modeName + recommended;
@@ -245,7 +285,7 @@
 	}
 	else
 	{
-		DEBUG ("Windowed fullscreen mode NOT supported!");
+		SW_DEBUG ("Windowed fullscreen mode NOT supported!");
 	}
 
 	cbo->setReadOnly(true);
@@ -258,6 +298,9 @@
 	cbo->handleUpdatedListItemData();
 	cbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onDisplayModeSelected, this));
 
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/DisplayModeBox", "combobox");
+
+
 	//
 	// Add the list of video drivers. --------------------------------------------------------------
 	//
@@ -269,7 +312,7 @@
 	std::string selectedVideoDriver = Options::getInstance ()->getUsedVideoDriver ();
 
 	// Start adding the driver items to the list
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow ("VideoDriverBox"));
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/VideoDriverBox"));
 	for (std::vector <std::string>::const_iterator it = videoDrivers.begin (); it != videoDrivers.end (); ++ it)
 	{
 		std::string myName = *it;
@@ -286,6 +329,8 @@
 	cbo->handleUpdatedListItemData ();
 
 	cbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onVideoDriverSelected, this));
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/VideoDriverBox", "combobox");
+
 
 	//
 	// Add the resolution list. Also select the currently used resolution.  ------------------------
@@ -293,13 +338,13 @@
 
 	// Get the resolution in the current options set.
 	std::string usedResolution = Options::getInstance ()->getUsedResolution ();
-	DEBUG ("Used resolution is: [%s]", usedResolution.c_str ());
+	SW_DEBUG ("Used resolution is: [%s]", usedResolution.c_str ());
 
 	// Get the list of available resolutions for the selected video driver.
 	std::vector <std::string> resolutions = Options::getInstance ()->getEditableResolutionsMapping ()[selectedVideoDriver];
 
 	// Start adding the resolutions as items to the combo-box, one by one.
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow ("ResolutionBox"));
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox"));
 	for (std::vector <std::string>::const_iterator it = resolutions.begin (); it != resolutions.end (); ++ it)
 	{
 		cbo->addItem (new StrListItem ((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) it->c_str (), "", 0));
@@ -326,6 +371,8 @@
 	}
 
 	cbo->handleUpdatedListItemData();
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox", "combobox");
+
 
 	//
 	// Add the shadow options into the list. Also select the currently used shadow mode ---------------------------------------------
@@ -333,7 +380,7 @@
 	Options::ShadowMode usedShadowMode = Options::getInstance ()->getShadowMode ();
 
 	// Start adding the shadow options as items to the combo-box, one by one.
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow ("ShadowsDropDownList"));
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ShadowsDropDownList"));
 	if (cbo)
 	{
 		cbo->addItem (new StrListItem ((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Off"), "", 0));
@@ -359,13 +406,15 @@
 
 		cbo->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&OptionsWindow::onShadowModeSelected, this));
 	}
+	connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ShadowsDropDownList", "combobox");
 
 	// Select the 1st available tab.
 	// This is a pre-emptive work-around for CEGUI 0.8+ support (which uses hierarchical items)
-	std::string widgetName =  CEGUIUtility::getNameForWidget ("OptionsWindow_Holder/OptionsWindow/OptionsWindowTab");
-	if (win_mgr.isWindowPresent (widgetName))
+	std::string widgetName =  CEGUIUtility::getNameForWidget ("OptionsWindow/OptionsWindowTab");
+
+	try
 	{
-		CEGUI::TabControl* tc = static_cast <CEGUI::TabControl*> (CEGUIUtility::getWindow (widgetName));
+		CEGUI::TabControl* tc = static_cast <CEGUI::TabControl*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
 		if (tc)
 		{
 			if (tc->getTabCount () > 0)
@@ -377,9 +426,13 @@
 		}
 		else
 		{
-			DEBUG ("Options Window init: could not find item named %s", widgetName.c_str());
+			SW_DEBUG ("Options Window init: could not find item named %s", widgetName.c_str());
 		}
 	}
+	catch(std::exception& e)
+	{
+		SW_DEBUG ("Caught exception and continuing [%s]", e.what ());
+	}
 
 	reset();
 	updateTranslation();
@@ -398,8 +451,9 @@
 	for (int i=0; i<9; i++)
 	{
 		stream.str("");
+		stream << "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/";
 		stream << "ShortkeyValueLabel"<<i;
-		label = win_mgr.getWindow(stream.str());
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
 
 		if (m_key_destination == (int) label->getID())
 		{
@@ -418,19 +472,23 @@
 		}
 	}
 
-	CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow( "SoundVolumeSlider"));
-	if ( fabs ( slider->getScrollPosition() - SoundSystem::getSoundVolume()) > 0.01f)
+	CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/SoundVolumeSlider"));
+	//if ( fabs ( slider->getScrollPosition() - SoundSystem::getSoundVolume()) > 0.01f)
+	if ( fabs ( slider->getScrollPosition() - SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Effect)) > 0.01f)
 	{
-		slider->setScrollPosition(SoundSystem::getSoundVolume());
+		//slider->setScrollPosition(SoundSystem::getSoundVolume());
+		slider->setScrollPosition (SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Effect));
 	}
 
-	slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow( "MusicVolumeSlider"));
-	if ( fabs ( slider->getScrollPosition() - MusicManager::instance().getMusicVolume()) > 0.01f)
+	slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/MusicVolumeSlider"));
+	//if ( fabs ( slider->getScrollPosition() - MusicManager::instance().getMusicVolume()) > 0.01f)
+	if ( fabs ( slider->getScrollPosition() - SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Music)) > 0.01f)
 	{
-		slider->setScrollPosition(MusicManager::instance().getMusicVolume());
+		//slider->setScrollPosition(MusicManager::instance().getMusicVolume());
+		slider->setScrollPosition (SoundManager::getPtr ()->getRepository ()->getVolumeForCategory (gussound::GSC_Music));
 	}
 	
-	slider = static_cast<CEGUI::Scrollbar*>(win_mgr.getWindow( "TextSpeedSlider"));
+	slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/TextSpeedSlider"));
 	float slidpos = (2.0 -Options::getInstance()->getTextSpeed()) / 1.4;
 	if ( fabs ( slider->getScrollPosition() - slidpos) > 0.01f)
 	{
@@ -443,101 +501,91 @@
 {
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
-	CEGUI::Checkbox* box;
+	CEGUIUtility::ToggleButton* box;
 	
-	CEGUI::DefaultWindow* keys =  (CEGUI::DefaultWindow*) win_mgr.getWindow("OptionsShortkeys");
+
+	CEGUI::DefaultWindow* keys = static_cast<CEGUI::DefaultWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__Buttons/__auto_btnOptionsShortkeys"));
 	keys->setText((CEGUI::utf8*) gettext("Shortkeys"));
-	CEGUI::DefaultWindow* gameplay =  (CEGUI::DefaultWindow*) win_mgr.getWindow("OptionsGameplay");
+	CEGUI::DefaultWindow* gameplay = static_cast<CEGUI::DefaultWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__Buttons/__auto_btnOptionsGameplay"));
 	gameplay->setText((CEGUI::utf8*) gettext("Gameplay"));
-	CEGUI::DefaultWindow* sound = (CEGUI::DefaultWindow*) win_mgr.getWindow("OptionsSound");
+	CEGUI::DefaultWindow* sound = static_cast<CEGUI::DefaultWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__Buttons/__auto_btnOptionsSound"));
 	sound->setText((CEGUI::utf8*) gettext("Audio"));
-	CEGUI::DefaultWindow* graphic = (CEGUI::DefaultWindow*) win_mgr.getWindow("OptionsGraphic");
+	CEGUI::DefaultWindow* graphic = static_cast<CEGUI::DefaultWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__Buttons/__auto_btnOptionsGraphic"));
 	graphic->setText((CEGUI::utf8*) gettext("Graphic"));
-	CEGUI::DefaultWindow* misc = (CEGUI::DefaultWindow*) win_mgr.getWindow("OptionsMisc");
+	CEGUI::DefaultWindow* misc =static_cast<CEGUI::DefaultWindow*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__Buttons/__auto_btnOptionsMisc"));
 	misc->setText((CEGUI::utf8*) gettext("Language"));
 
-	if (win_mgr.isWindowPresent ("OptionsLabel"))
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow");
+	if (label->isPropertyPresent ("Text"))
 	{
-		label = win_mgr.getWindow("OptionsLabel");
-		label->setText((CEGUI::utf8*) gettext("Options"));
-	}
-	else if (win_mgr.isWindowPresent ("OptionsWindow"))
-	{
-		label =  win_mgr.getWindow("OptionsWindow");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Options"));
-		}
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Options"));
 	}
 
-	label = win_mgr.getWindow("ShortkeyLabel0");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel0");
 	label->setText((CEGUI::utf8*) gettext("Inventory"));
 
-	label = win_mgr.getWindow("ShortkeyLabel1");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel1");
 	label->setText((CEGUI::utf8*) gettext("Character screen"));
 
-	label = win_mgr.getWindow("ShortkeyLabel2");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel2");
 	label->setText((CEGUI::utf8*) gettext("Skilltree"));
 
-	label = win_mgr.getWindow("ShortkeyLabel3");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel3");
 	label->setText((CEGUI::utf8*) gettext("Party screen"));
 
-	label = win_mgr.getWindow("ShortkeyLabel4");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel4");
 	label->setText((CEGUI::utf8*) gettext("Chatbox"));
 
-	label = win_mgr.getWindow("ShortkeyLabel5");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel5");
 	label->setText((CEGUI::utf8*) gettext("Quests"));
 
-	label = win_mgr.getWindow("ShortkeyLabel6");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel6");
 	label->setText((CEGUI::utf8*) gettext("Minimap"));
 
-	label = win_mgr.getWindow("ShortkeyLabel7");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel7");
 	label->setText((CEGUI::utf8*) gettext("Swap equipement"));
 
-	label = win_mgr.getWindow("ShortkeyLabel8");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsShortkeys/ShortkeyLabel8");
 	label->setText((CEGUI::utf8*) gettext("Item Labels"));
 
-	label = win_mgr.getWindow("GameplayDifficultyLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/GameplayDifficultyLabel");
 	label->setText((CEGUI::utf8*) gettext("Difficulty"));
 	
-	label = win_mgr.getWindow("TextSpeedLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/TextSpeedLabel");
 	label->setText((CEGUI::utf8*) gettext("Text Speed"));
 	
-	label = win_mgr.getWindow("SoundVolumeLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/SoundVolumeLabel");
 	label->setText((CEGUI::utf8*) gettext("Sound"));
 
-	label = win_mgr.getWindow("MusicVolumeLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsSound/MusicVolumeLabel");
 	label->setText((CEGUI::utf8*) gettext("Music"));
 
-	label = win_mgr.getWindow("EnemyHighlightLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/EnemyHighlightLabel");
 	label->setText((CEGUI::utf8*) gettext("Enemy Highlight Color"));
 
-	label = win_mgr.getWindow("LanguageLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsMisc/LanguageLabel");
 	label->setText((CEGUI::utf8*) gettext("Language"));
 	
-	//label = win_mgr.getWindow("ResetGraphicsLabel");
-	//label->setText((CEGUI::utf8*) gettext("Restart required for setting new options")); // TODO: clean-up code.
-
-	box = static_cast<CEGUI::Checkbox*>(win_mgr.getWindow("GrabMouseInWindowedModeBox"));
+	box = static_cast<CEGUIUtility::ToggleButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/GrabMouseInWindowedModeBox"));
 	box->setText((CEGUI::utf8*) gettext("Grab mouse in windowed mode (needs restart)"));
 	
-	label = win_mgr.getWindow("VideoDriver");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/VideoDriver");
 	label->setText((CEGUI::utf8*) gettext("Video Driver"));
 	
-	label = win_mgr.getWindow("DisplayMode");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/DisplayMode");
 	label->setText((CEGUI::utf8*) gettext("Display Mode"));
 	
-	label = win_mgr.getWindow("Resolution");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/Resolution");
 	label->setText((CEGUI::utf8*) gettext("Resolution"));
 
-	label = win_mgr.getWindow ("ShadowsLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ShadowsLabel");
 	if (label) label->setText ((CEGUI::utf8*) gettext("Shadows"));
 	
 	// Set the close button to "ok"
-	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow ("OptionsCloseButton"));
+	CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsCloseButton"));
 	btn->setText((CEGUI::utf8*) gettext("Ok"));
 
-	//btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow( "ResetGraphicsButton"));
+	//btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindow ("ResetGraphicsButton"));
 	//btn->setText((CEGUI::utf8*) gettext("Reset graphic options")); // TODO: clean-up code.
 }
 
@@ -547,6 +595,82 @@
 	m_key_destination = NO_KEY;
 }
 
+
+/**
+ * Connect specific sound events for the widget.
+ */
+void OptionsWindow::connectWidgetSoundEvents (const std::string& widgetName, const std::string& widgetType)
+{
+	try
+	{
+		CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+		if (widgetType == "combobox")
+		{
+			try
+			{
+				CEGUI::PushButton* btn;
+				std::string subWidgetName (widgetName);
+				subWidgetName.append ("/__auto_button__");
+				btn = static_cast<CEGUI::PushButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, subWidgetName));
+				btn->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
+				btn->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+
+				CEGUI::ComboDropList* drop;
+				subWidgetName = widgetName;
+				subWidgetName.append ("/__auto_droplist__");
+				drop = static_cast<CEGUI::ComboDropList*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, subWidgetName));
+				drop->subscribeEvent (CEGUI::ComboDropList::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
+				drop->subscribeEvent (CEGUIUtility::EventMouseEntersComboDroplistArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+
+				CEGUI::Editbox* ebox;
+				subWidgetName = widgetName;
+				subWidgetName.append ("/__auto_editbox__");
+				ebox = static_cast<CEGUI::Editbox*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, subWidgetName));
+				ebox->subscribeEvent (CEGUI::Editbox::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this));
+				ebox->subscribeEvent (CEGUIUtility::EventMouseEntersEditboxArea (), CEGUI::Event::Subscriber (&OptionsWindow::onButtonItemHover, this));
+			}
+			catch (std::exception& e)
+			{
+				SW_DEBUG ("Caught an exception while connecting widget sound events (will continue) [%s]", e.what ());
+			}
+
+		}
+		else
+		{
+			SW_DEBUG ("Developer message: widget type [%s] not recognized in connecting widget sound events", widgetType.c_str ());
+		}
+	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Caught exception: %s", e.what ());
+	}
+}
+
+
+/**
+ * \fn bool onButtonItemClicked(const CEGUI::EventArgs& evt)
+ * \brief Handle the click of gui items.
+ */
+bool OptionsWindow::onGUIItemClicked (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+	return true;
+}
+
+
+
+/**
+ * \fn bool onButtonItemHover(const CEGUI::EventArgs& evt)
+ * \brief Handle the hovering of gui items.
+ */
+bool OptionsWindow::onButtonItemHover (const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
+
+
+
 bool OptionsWindow::onShortkeyLabelClicked(const CEGUI::EventArgs& evt)
 {
 	const CEGUI::MouseEventArgs& we =
@@ -585,15 +709,21 @@
 
 bool OptionsWindow::onButtonCancelClicked (const CEGUI::EventArgs& evt)
 {
+	// Play the sound
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	m_document->onButtonOptionsClicked();
 	return true;
 }
 
 bool OptionsWindow::onButtonOkClicked (const CEGUI::EventArgs& evt)
 {
-	DEBUG ("[Ok] button clicked in options. Attempting to save them");
+	SW_DEBUG ("[Ok] button clicked in options. Attempting to save them");
 	// TODO: move video mode checks to separate function? or just wait for the full integration with the rest of the options?
 
+	// Play the sound
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	// Check to see if the display mode was updated. The display mode is stored in a different file at the moment.
 	// TODO: move towards integrated settings file (single file for most settings).
 	{
@@ -603,17 +733,17 @@
 		bool someVideoSettingsWereChanged (false);
 
 		// Check the driver for changes. ---------------
-		CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("VideoDriverBox"));
+		CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/VideoDriverBox"));
 		if (cbo == 0)
 		{
-			DEBUG ("Could not find widget [VideoDriverBox]");
+			SW_DEBUG ("Could not find widget [VideoDriverBox]");
 			return false;
 		}
 
 		CEGUI::ListboxItem* item = cbo->getSelectedItem();
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [VideoDriverBox]. Searching via text values. (slower)");
+			SW_DEBUG ("Could not find selected item in widget [VideoDriverBox]. Searching via text values. (slower)");
 			CEGUI::String currentText = cbo->getText();
 
 			for (unsigned i = 0; i < cbo->getItemCount (); i ++)
@@ -627,7 +757,7 @@
 
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [VideoDriverBox]. Unable to store any changes!!!");
+			SW_DEBUG ("Could not find selected item in widget [VideoDriverBox]. Unable to store any changes!!!");
 		}
 
 		std::string selectedDriverName (Options::getInstance ()->getUsedVideoDriver ());
@@ -639,17 +769,17 @@
 		}
 
 		// Check the display mode for changes. ---------------
-		cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("DisplayModeBox"));
+		cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/DisplayModeBox"));
 		if (cbo == 0)
 		{
-			DEBUG ("Could not find widget [DisplayModeBox]");
+			SW_DEBUG ("Could not find widget [DisplayModeBox]");
 			return false;
 		}
 
 		item = cbo->getSelectedItem();
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [DisplayModeBox]. Searching via text values. (slower)");
+			SW_DEBUG ("Could not find selected item in widget [DisplayModeBox]. Searching via text values. (slower)");
 			CEGUI::String currentText = cbo->getText();
 			
 			for (unsigned i = 0; i < cbo->getItemCount (); i ++)
@@ -662,7 +792,7 @@
 		}
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [DisplayModeBox]. Unable to store any changes!!!");
+			SW_DEBUG ("Could not find selected item in widget [DisplayModeBox]. Unable to store any changes!!!");
 		}
 
 		DisplayModes userMode = Options::getInstance ()->getUsedDisplayMode ();
@@ -671,20 +801,20 @@
 		{
 			size_t selectionIndex = (int)cbo->getItemIndex (item);
 
-			DEBUG ("selected display mode %s",item->getText().c_str());
+			SW_DEBUG ("selected display mode %s",item->getText().c_str());
 		
 			userMode = (DisplayModes)selectionIndex;
-			DEBUG ("Index of combobox selection is: %d. New display mode set to %d", selectionIndex, userMode);
+			SW_DEBUG ("Index of combobox selection is: %d. New display mode set to %d", selectionIndex, userMode);
 			someVideoSettingsWereChanged |= (userMode != Options::getInstance ()->getUsedDisplayMode ());
 		}
 
 		// Check the resolution for changes -----------------------
 		std::string userResolution;
-		cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("ResolutionBox"));
+		cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox"));
 
 		if (cbo == 0)
 		{
-			DEBUG ("Could not find widget [ResolutionBox]");
+			SW_DEBUG ("Could not find widget [ResolutionBox]");
 			return false;
 		}
 
@@ -693,7 +823,7 @@
 		{
 			userResolution = Options::getInstance ()->getUsedResolution ();
 		}
-		DEBUG ("selected userResolution %s", userResolution.c_str());
+		SW_DEBUG ("selected userResolution %s", userResolution.c_str());
 
 		if (userMode == WINDOWED_FULLSCREEN)
 		{
@@ -702,24 +832,24 @@
 			int desktopHeight = (int)GetSystemMetrics (SM_CYSCREEN);
 			userResolution = SumwarsHelper::getUpdatedResolutionString (userResolution, desktopWidth, desktopHeight);
 #endif
-			DEBUG ("Updated selected userResolution to [%s]", userResolution.c_str());
+			SW_DEBUG ("Updated selected userResolution to [%s]", userResolution.c_str());
 		}
 
 		someVideoSettingsWereChanged |= (userResolution != Options::getInstance ()->getUsedResolution ());
 
 		// Check the shadow mode for changes -----------------------------------
 		
-		cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow("ShadowsDropDownList"));
+		cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ShadowsDropDownList"));
 		if (cbo == 0)
 		{
-			DEBUG ("Could not find widget [ShadowsDropDownList]");
+			SW_DEBUG ("Could not find widget [ShadowsDropDownList]");
 			return false;
 		}
 
 		item = cbo->getSelectedItem();
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Searching via text values. (slower)");
+			SW_DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Searching via text values. (slower)");
 			CEGUI::String currentText = cbo->getText();
 			
 			for (unsigned i = 0; i < cbo->getItemCount (); i ++)
@@ -733,7 +863,7 @@
 
 		if (item == 0)
 		{
-			DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Unable to store any changes!!!");
+			SW_DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Unable to store any changes!!!");
 		}
 
 		Options::ShadowMode newShadowSettings = Options::getInstance ()->getShadowMode ();
@@ -748,7 +878,7 @@
 		}
 
 
-		DEBUG ("Used shadow mode (old - new) : %d - %d", Options::getInstance ()->getShadowMode (), newShadowSettings);
+		SW_DEBUG ("Used shadow mode (old - new) : %d - %d", Options::getInstance ()->getShadowMode (), newShadowSettings);
 	
 		someVideoSettingsWereChanged |= (newShadowSettings != Options::getInstance ()->getShadowMode ());
 
@@ -782,7 +912,7 @@
 			{
 				if (e.getNumber () == Ogre::Exception::ERR_FILE_NOT_FOUND)
 				{
-					DEBUG ("Could not find OGRE config file");
+					SW_DEBUG ("Could not find OGRE config file");
 					return false;
 				}
 				else
@@ -801,7 +931,7 @@
 
 			Ogre::String resolutionValueToSet ("");
 			resolutionValueToSet = Options::getInstance ()->getUsedResolution ();
-			DEBUG ("Saving options; will set resolution to : [%s]", resolutionValueToSet.c_str());
+			SW_DEBUG ("Saving options; will set resolution to : [%s]", resolutionValueToSet.c_str());
 
 			// Update the settings; 
 			Ogre::ConfigFile::SectionIterator iSection = cfg.getSectionIterator ();
@@ -886,17 +1016,23 @@
 	const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(we.window);
 	float vol = slider->getScrollPosition();
-	DEBUG("sound volume change to %f",vol);
-	SoundSystem::setSoundVolume(vol);
+	SW_DEBUG("sound volume change to %f",vol);
+	//SoundSystem::setSoundVolume(vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Effect, vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0);
 	return true;
 }
 
 bool OptionsWindow::onDifficultyChanged(const CEGUI::EventArgs& evt)
 {
-	const CEGUI::MouseEventArgs& we =
-	static_cast<const CEGUI::MouseEventArgs&>(evt);
+	const CEGUI::MouseEventArgs& we = 
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
 	
 	CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(we.window);
 	
@@ -904,11 +1040,11 @@
 	if (item != 0)
 	{
 		Options::getInstance()->setDifficulty(static_cast<Options::Difficulty>(item->getID()));
-		DEBUG ("Difficulty changed. %s", item->getText ().c_str ());
+		SW_DEBUG ("Difficulty changed. %s", item->getText ().c_str ());
 	}
 	else
 	{
-		DEBUG ("Difficulty changed. Unknown!");
+		SW_DEBUG ("Difficulty changed. Unknown!");
 	}
 	
 	return true;
@@ -917,8 +1053,10 @@
 bool OptionsWindow::onTextSpeedChanged(const CEGUI::EventArgs& evt)
 {
 	const CEGUI::MouseEventArgs& we =
-	static_cast<const CEGUI::MouseEventArgs&>(evt);
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
 	
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(we.window);
 	float speed = 2.0 - slider->getScrollPosition()*1.4;
 	DEBUGX("text speed changed to %f",speed);
@@ -931,10 +1069,14 @@
 	const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
 	CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(we.window);
 	float vol = slider->getScrollPosition();
 	DEBUGX("music volume changed to %f",vol);
-	MusicManager::instance().setMusicVolume(vol);
+	//MusicManager::instance().setMusicVolume(vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Music, vol);
+	SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0);
 	return true;
 }
 
@@ -1030,7 +1172,7 @@
 
 bool OptionsWindow::onDisplayModeSelected (const CEGUI::EventArgs& evt)
 {
-	DEBUG ("Display mode selected");
+	SW_DEBUG ("Display mode selected");
 	const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 
@@ -1038,7 +1180,7 @@
 
 	if (cbo == 0)
 	{
-		DEBUG ("CEGUI ERROR: source widget is NULL");
+		SW_DEBUG ("CEGUI ERROR: source widget is NULL");
 		return false;
 	}
 
@@ -1046,7 +1188,7 @@
 
 	if (item == 0)
 	{
-		DEBUG ("CEGUI ERROR: No valid selection in source widget");
+		SW_DEBUG ("CEGUI ERROR: No valid selection in source widget");
 		return false;
 	}
 
@@ -1062,12 +1204,8 @@
 
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
 
-	if (! win_mgr.isWindowPresent ("ResolutionBox"))
-	{
-		DEBUG ("Layout ERROR: Could not find expected combo [ResolutionBox]");
-		return false;
-	}
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow ("ResolutionBox"));
+	std::string widgetName = CEGUIUtility::getNameForWidget ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox");
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, widgetName));
 	if (myDisplayMode == WINDOWED_FULLSCREEN)
 	{
 		cbo->setEnabled (false);
@@ -1096,7 +1234,7 @@
 
 		std::string usedResolution = Options::getInstance ()->getUsedResolution ();
 		
-		DEBUG ("Will try to show that the used resolution is [%s]", usedResolution.c_str ());
+		SW_DEBUG ("Will try to show that the used resolution is [%s]", usedResolution.c_str ());
 
 		for (size_t i = 0; i < cbo->getItemCount (); ++ i)
 		{
@@ -1106,9 +1244,9 @@
 			{
 				cbo->setItemSelectState(i, true);
 				
-				DEBUG ("Located item [%s] at [%d]", itemText.c_str (), i);
+				SW_DEBUG ("Located item [%s] at [%d]", itemText.c_str (), i);
 			}
-			DEBUG ("Compared with [%s]", itemText.c_str ());
+			SW_DEBUG ("Compared with [%s]", itemText.c_str ());
 		}
 		cbo->handleUpdatedListItemData();
 	}
@@ -1120,7 +1258,7 @@
 
 bool OptionsWindow::onVideoDriverSelected (const CEGUI::EventArgs& evt)
 {
-	DEBUG ("Video Driver selected");
+	SW_DEBUG ("Video Driver selected");
 	const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 
@@ -1145,7 +1283,7 @@
 	int currentWidth (0), currentHeight (0);
 	SumwarsHelper::getSizesFromResolutionString (Options::getInstance ()->getUsedResolution (), currentWidth, currentHeight);
 
-	DEBUG ("Selected video driver: %s", videoDriver.c_str ());
+	SW_DEBUG ("Selected video driver: %s", videoDriver.c_str ());
 
 	// Get the list of available resolutions for the selected video driver.
 	std::vector <std::string> resolutions = Options::getInstance ()->getEditableResolutionsMapping ()[videoDriver];
@@ -1159,13 +1297,13 @@
 
 	// Start adding the resolutions as items to the combo-box, one by one.
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton ();
-	cbo = static_cast<CEGUI::Combobox*>(win_mgr.getWindow ("ResolutionBox"));
+	cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ResolutionBox"));
 	cbo->resetList ();
 
 
 	for (std::vector <std::string>::const_iterator it = resolutions.begin (); it != resolutions.end (); ++ it)
 	{
-		DEBUG ("New mode: %s", it->c_str ());
+		SW_DEBUG ("New mode: %s", it->c_str ());
 		cbo->addItem (new StrListItem ((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) it->c_str (), "", 0));
 		if (*it == usedResolution)
 		{
@@ -1175,9 +1313,9 @@
 
 	cbo->handleUpdatedListItemData ();
 
-	if (win_mgr.isWindowPresent ("OptionsWindowTab"))
+	if (CEGUIUtility::isWindowPresent ("OptionsWindow/OptionsWindowTab"))
 	{
-		CEGUI::TabControl* tc = static_cast <CEGUI::TabControl*> (CEGUIUtility::getWindow ("OptionsWindowTab"));
+		CEGUI::TabControl* tc = static_cast <CEGUI::TabControl*> (CEGUIUtility::getWindow ("OptionsWindow/OptionsWindowTab"));
 		if (tc)
 		{
 			if (tc->getTabCount () > 0)
@@ -1198,7 +1336,7 @@
 	const CEGUI::MouseEventArgs& we =
 			static_cast<const CEGUI::MouseEventArgs&>(evt);
 
-	CEGUI::Checkbox* cbo = static_cast<CEGUI::Checkbox*>(we.window);
+	CEGUIUtility::ToggleButton* cbo = static_cast<CEGUIUtility::ToggleButton*>(we.window);
 	
 	Options::getInstance()->setGrabMouseInWindowedMode(cbo->isSelected());
 	
--- a/src/gui/optionswindow.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/optionswindow.h	Thu Mar 20 19:04:28 2014 +0100
@@ -75,6 +75,23 @@
 		ShortkeyDestination m_key_destination;
 		
 		/**
+		 * Connect specific sound events for the widget.
+		 */
+		void connectWidgetSoundEvents (const std::string& widgetName, const std::string& widgetType);
+
+		/**
+		 * \fn bool onButtonItemClicked (const CEGUI::EventArgs& evt)
+		 * \brief Handle the click of gui items.
+		 */
+		bool onGUIItemClicked (const CEGUI::EventArgs& evt);
+
+		/**
+		 * \fn bool onButtonItemHover(const CEGUI::EventArgs& evt)
+		 * \brief Handle the hovering of gui items.
+		 */
+		bool onButtonItemHover (const CEGUI::EventArgs& evt);
+		
+		/**
 		 * \fn bool onShortkeyLabelClicked(const CEGUI::EventArgs& evt)
 		 * \brief Behandelt Klick auf ein Shortkey Label
 		 */
--- a/src/gui/partyinfo.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/partyinfo.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,551 +1,552 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "partyinfo.h"
-#include "ceguiutility.h"
-
-PartyInfo::PartyInfo (Document* doc, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	// Rahmen fuer CharInfo Fenster
-	CEGUI::FrameWindow* party_info = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "PartyInfo");
-	m_window = party_info;
-	
-	party_info->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
-	party_info->setSize(CEGUI::UVector2(cegui_reldim(0.48f), cegui_reldim( 0.77f)));
-	party_info->setProperty("FrameEnabled","false");
-	party_info->setProperty("TitlebarEnabled","false");
-	party_info->setProperty("CloseButtonEnabled","false");
-	party_info->setProperty("MousePassThroughEnabled","true");
-	party_info->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
-	party_info->setWantsMultiClickEvents(false);
-	party_info->setAlpha(0.0);
-
-	
-	CEGUI::PushButton* btn;
-	CEGUI::Window* label, *img;
-	std::ostringstream stream;
-	for (int i=0; i<7; i++)
-	{
-		stream.str("");
-		stream << "PlayerImage";
-		stream << i;
-		
-		img = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"),stream.str());
-		party_info->addChildWindow(img);
-		img->setProperty("InheritsAlpha", "false");
-		img->setProperty("FrameEnabled", "false");
-		img->setProperty("BackgroundEnabled", "false");
-		img->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f + 0.12f *i)));
-		img->setSize(CEGUI::UVector2(cegui_reldim(0.13f), cegui_reldim( 0.1f)));
-		img->setID(i);
-		
-		stream.str("");
-		stream << "PlayerParty";
-		stream << i;
-		
-		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-		party_info->addChildWindow(label);
-		label->setProperty("InheritsAlpha", "false");
-		label->setProperty("FrameEnabled", "false");
-		label->setProperty("BackgroundEnabled", "false");
-		label->setPosition(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.01f+ 0.12f *i)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(0.06f), cegui_reldim( 0.1f)));
-		label->setText("0");
-		
-		stream.str("");
-		stream << "PlayerName";
-		stream << i;
-		
-		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-		party_info->addChildWindow(label);
-		label->setProperty("InheritsAlpha", "false");
-		label->setProperty("FrameEnabled", "false");
-		label->setProperty("BackgroundEnabled", "false");
-		label->setPosition(CEGUI::UVector2(cegui_reldim(0.21f), cegui_reldim( 0.01f+ 0.12f *i)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(0.30f), cegui_reldim( 0.1f)));
-		label->setText("Name");
-		
-		stream.str("");
-		stream << "PlayerClass";
-		stream << i;
-		
-		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-		party_info->addChildWindow(label);
-		label->setProperty("InheritsAlpha", "false");
-		label->setProperty("FrameEnabled", "false");
-		label->setProperty("BackgroundEnabled", "false");
-		label->setPosition(CEGUI::UVector2(cegui_reldim(0.53f), cegui_reldim( 0.01f + 0.12f *i)));
-		label->setSize(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.1f)));
-		label->setText("Klasse");
-		
-		stream.str("");
-		stream << "AcceptMemberButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("A");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onAcceptMemberButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		stream.str("");
-		stream << "RejectMemberButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*> (win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("R");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onRejectMemberButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		
-		
-		stream.str("");
-		stream << "ApplyButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("C");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onApplyButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		stream.str("");
-		stream << "KickMemberButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("K");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onKickMemberButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		stream.str("");
-		stream << "LeavePartyButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("L");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onLeavePartyButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		
-		
-		stream.str("");
-		stream << "PeaceButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("P");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onPeaceButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		stream.str("");
-		stream << "DeclareWarButton";
-		stream << i;
-		
-		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
-		party_info->addChildWindow(btn);
-		btn->setProperty("InheritsAlpha", "false");
-		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
-		btn->setSize(CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.08f)));
-		btn->setText("W");
-		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onDeclareWarButtonClicked, this));
-		btn->setWantsMultiClickEvents(false);
-		btn->setID(i);
-		
-		
-
-	}
-	
-	updateTranslation();
-}
-
-void PartyInfo::update()
-{
-	Player* player = m_document->getLocalPlayer();
-	Player* pl;
-	Party* party =  World::getWorld()->getParty(player->getFraction());
-	
-	// Gibt an, ob der Spieler aktuell Alleinspieler ist
-	bool solo = false;
-	if (party->getNrMembers ()==1)
-		solo = true;
-	
-	WorldObjectMap* players = World::getWorld()->getPlayers();
-	WorldObjectMap::iterator it;
-	
-	int nr=0;
-	
-	// Gibt an, ob der Spieler Leiter seiner Party ist
-	bool leader = false;
-	if (player->getId() == party->getLeader())
-	{
-		leader = true;
-	}
-	
-	bool leader2;
-	DEBUGX("party %i solo %i leader %i",party->getId(),solo,leader);
-	
-	Fraction::Relation rel,rel2;
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	std::ostringstream stream;
-	CEGUI::Window* label, *img, *btn;
-	bool vis;
-	
-	for (it = players->begin(); it != players->end(); ++it)
-	{
-		leader2 = false;
-		
-		pl = static_cast<Player*>(it->second);
-		m_player_ids[nr] = pl->getId();
-		
-		if (pl == player)
-		{
-			//continue;
-		}
-		
-		leader2 = false;
-		if (pl->getParty()->getLeader() == pl->getId())
-		{
-			leader2 = true;
-		}
-		
-		rel = party->getRelations()[pl->getParty()->getId()];
-		rel2 = pl->getParty()->getRelations()[party->getId()];
-				
-		stream.str("");
-		stream << "PlayerImage";
-		stream << nr;
-		
-		img = win_mgr.getWindow(stream.str());
-		if (img->isVisible()!=true)
-		{
-			img->setVisible(true);
-		}
-		
-		std::string imagestr = pl->getEmotionImage("normal");
-		if (img->getProperty("Image") != imagestr)
-		{
-			img->setProperty("Image",imagestr);
-		}
-		
-		stream.str("");
-		stream << "PlayerParty";
-		stream << nr;
-		label = win_mgr.getWindow(stream.str());
-		
-		stream.str("");
-		stream<< pl->getParty()->getId();
-		if (label->isVisible()!=true)
-		{
-			label->setVisible(true);
-		}
-		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
-		{
-			label->setText((CEGUI::utf8*)  stream.str().c_str());
-		}
-		
-		stream.str("");
-		stream << "PlayerName";
-		stream << nr;
-		
-		label = win_mgr.getWindow(stream.str());
-		stream.str("");
-		stream << pl->getName().getRawText();
-		if (label->isVisible()!=true)
-		{
-			label->setVisible(true);
-		}
-		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
-		{
-			label->setText((CEGUI::utf8*)  stream.str().c_str());
-		}
-		
-		
-		stream.str("");
-		stream << "PlayerClass";
-		stream << nr;
-		
-		label = win_mgr.getWindow(stream.str());
-		PlayerBasicData* pdata = ObjectFactory::getPlayerData(pl->getSubtype());
-		if (pdata != 0)
-		{
-			stream.str(gettext(pdata->m_name.c_str()));
-		}
-		else
-		{
-			stream.str("");
-		}
-		
-		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
-		{
-			label->setText((CEGUI::utf8*)  stream.str().c_str());
-		}
-		
-		// Accept button nur Anzeigen wenn der Spieler Partyleiter ist und der andere Spieler ein Bewerber
-		vis = false;
-		if (leader && party->getCandidates().count(pl->getId())>0)
-		{
-			vis = true;
-		}
-		stream.str("");
-		stream << "AcceptMemberButton";
-		stream << nr;
-		
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		// gleiche Regeln fuer den Ablehnen Button
-		stream.str("");
-		stream << "RejectMemberButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		// Bewerbung erlauben, wenn der andere Spieler ein Partyleiter und man selbst Solo
-		vis = false;
-		if (solo && player->getCandidateParty() ==-1 && leader2 && party->getId() != pl->getParty()->getId() && party->getCandidates().count(pl->getId())==0 && rel == Fraction::NEUTRAL && rel2 == Fraction::NEUTRAL)
-		{
-			vis = true;
-		}
-		stream.str("");
-		stream << "ApplyButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		// Kick Button anzeigen, wenn man Partyleiter ist und der andere Spieler ein Verbuendeter
-		vis = false;
-		if (leader && party->getMembers().count(pl->getId())>0 && pl != player)
-		{
-			if (World::getWorld() !=0 && !World::getWorld()->isCooperative())
-				vis = true;
-		}
-		stream.str("");
-		stream << "KickMemberButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		vis = false;
-		if ((!solo && pl->getId() == party->getLeader()) || (solo && pl->getParty()->getId() == player->getCandidateParty()))
-		{
-			if (World::getWorld() !=0 && !World::getWorld()->isCooperative())
-				vis = true;
-		}
-		stream.str("");
-		stream << "LeavePartyButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		// Frieden Button anbieten, wenn aktuelles Verhaeltnis feindlich ist
-		vis = false;
-		if (leader && leader2 && rel == Fraction::HOSTILE)
-		{
-			vis = true;
-		}
-		stream.str("");
-		stream << "PeaceButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		// Krieg Button anbieten, wenn aktuelles Verhaeltnis neutral ist
-		vis = false;
-		if (leader && leader2 && rel == Fraction::NEUTRAL && player->getCandidateParty() != pl->getParty()->getId() && pl->getCandidateParty() != player->getParty()->getId())
-		{
-			vis = true;
-		}
-		stream.str("");
-		stream << "DeclareWarButton";
-		stream << nr;
-		
-		btn = win_mgr.getWindow(stream.str());
-		if (btn->isVisible()!=vis)
-		{
-			btn->setVisible(vis);
-		}
-		
-		
-		nr ++;
-		
-	}
-	
-	// alle GUI Elemente zu denen kein Spieler gehoehrt ausblenden
-	std::string elements[11] = {"PlayerImage","PlayerParty", "PlayerName", "PlayerClass", "AcceptMemberButton", "RejectMemberButton", "ApplyButton", "KickMemberButton", "PeaceButton", "DeclareWarButton","LeavePartyButton"};
-	
-	
-	for (int i=nr; i<7; i++)
-	{
-		for (int j=0; j<11; j++)
-		{
-			stream.str("");
-			stream << elements[j];
-			stream << i;
-			
-			label = win_mgr.getWindow(stream.str());
-			if (label->isVisible())
-			{
-				label->setVisible(false);
-			}
-			
-		}
-	}
-	
-}
-
-void PartyInfo::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	
-	std::ostringstream stream;
-	for (int i=0; i<7; i++)
-	{
-		stream.str("");
-		stream << "PlayerName";
-		stream << i;
-		
-		label = win_mgr.getWindow(stream.str());
-		label->setText((CEGUI::utf8*) gettext("Name"));
-	}
-}
-
-bool PartyInfo::onAcceptMemberButtonClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonPartyAccept(m_player_ids[id]);
-	
-	return true;
-}
-
-bool PartyInfo::onApplyButtonClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonPartyApply(m_player_ids[id]);
-	return true;
-}
-
-bool PartyInfo::onRejectMemberButtonClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonPartyReject(m_player_ids[id]);
-	return true;
-}
-
-bool PartyInfo::onKickMemberButtonClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonKick(m_player_ids[id]);
-	
-	return true;
-}
-
-bool PartyInfo::onLeavePartyButtonClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonPartyLeave();
-	return true;
-}
-
-bool PartyInfo::onPeaceButtonClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonPartyPeace(m_player_ids[id]);
-	return true;
-}
-
-bool PartyInfo::onDeclareWarButtonClicked(const CEGUI::EventArgs& evt)
-{
-	
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	m_document->onButtonPartyWar(m_player_ids[id]);
-	return true;
-}
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "partyinfo.h"
+#include "ceguiutility.h"
+
+PartyInfo::PartyInfo (Document* doc, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	// Rahmen fuer CharInfo Fenster
+	CEGUI::FrameWindow* party_info = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "PartyInfo");
+	m_window = party_info;
+	
+	party_info->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
+	CEGUIUtility::setWidgetSizeRel (party_info, 0.48f, 0.77f);
+
+	party_info->setProperty("FrameEnabled","false");
+	party_info->setProperty("TitlebarEnabled","false");
+	party_info->setProperty("CloseButtonEnabled","false");
+	party_info->setProperty("MousePassThroughEnabled","true");
+	party_info->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
+	party_info->setWantsMultiClickEvents(false);
+	party_info->setAlpha(0.0);
+
+	
+	CEGUI::PushButton* btn;
+	CEGUI::Window* label, *img;
+	std::ostringstream stream;
+	for (int i=0; i<7; i++)
+	{
+		stream.str("");
+		stream << "PlayerImage";
+		stream << i;
+		
+		img = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"),stream.str());
+		CEGUIUtility::addChildWidget (party_info, img);
+		img->setProperty("InheritsAlpha", "false");
+		img->setProperty("FrameEnabled", "false");
+		img->setProperty("BackgroundEnabled", "false");
+		img->setPosition(CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (img, 0.13f, 0.1f);
+		img->setID(i);
+		
+		stream.str("");
+		stream << "PlayerParty";
+		stream << i;
+		
+		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+		CEGUIUtility::addChildWidget (party_info, label);
+		label->setProperty("InheritsAlpha", "false");
+		label->setProperty("FrameEnabled", "false");
+		label->setProperty("BackgroundEnabled", "false");
+		label->setPosition(CEGUI::UVector2(cegui_reldim(0.15f), cegui_reldim( 0.01f+ 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (label, 0.06f, 0.1f);
+		label->setText("0");
+		
+		stream.str("");
+		stream << "PlayerName";
+		stream << i;
+		
+		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+		CEGUIUtility::addChildWidget (party_info, label);
+		label->setProperty("InheritsAlpha", "false");
+		label->setProperty("FrameEnabled", "false");
+		label->setProperty("BackgroundEnabled", "false");
+		label->setPosition(CEGUI::UVector2(cegui_reldim(0.21f), cegui_reldim( 0.01f+ 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (label, 0.30f, 0.1f);
+		label->setText("Name");
+		
+		stream.str("");
+		stream << "PlayerClass";
+		stream << i;
+		
+		label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+		CEGUIUtility::addChildWidget (party_info, label);
+		label->setProperty("InheritsAlpha", "false");
+		label->setProperty("FrameEnabled", "false");
+		label->setProperty("BackgroundEnabled", "false");
+		label->setPosition(CEGUI::UVector2(cegui_reldim(0.53f), cegui_reldim( 0.01f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (label, 0.15f, 0.1f);
+		label->setText("Klasse");
+		
+		stream.str("");
+		stream << "AcceptMemberButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("A");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onAcceptMemberButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		stream.str("");
+		stream << "RejectMemberButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*> (win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("R");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onRejectMemberButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		
+		
+		stream.str("");
+		stream << "ApplyButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("C");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onApplyButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		stream.str("");
+		stream << "KickMemberButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("K");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onKickMemberButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		stream.str("");
+		stream << "LeavePartyButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("L");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onLeavePartyButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		
+		
+		stream.str("");
+		stream << "PeaceButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.7), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("P");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onPeaceButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		stream.str("");
+		stream << "DeclareWarButton";
+		stream << i;
+		
+		btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), stream.str() ));
+		CEGUIUtility::addChildWidget (party_info, btn);
+		btn->setProperty("InheritsAlpha", "false");
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.85), cegui_reldim( 0.02f + 0.12f *i)));
+		CEGUIUtility::setWidgetSizeRel (btn, 0.12f, 0.08f);
+		btn->setText("W");
+		btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&PartyInfo::onDeclareWarButtonClicked, this));
+		btn->setWantsMultiClickEvents(false);
+		btn->setID(i);
+		
+		
+
+	}
+	
+	updateTranslation();
+}
+
+void PartyInfo::update()
+{
+	Player* player = m_document->getLocalPlayer();
+	Player* pl;
+	Party* party =  World::getWorld()->getParty(player->getFraction());
+	
+	// Gibt an, ob der Spieler aktuell Alleinspieler ist
+	bool solo = false;
+	if (party->getNrMembers ()==1)
+		solo = true;
+	
+	WorldObjectMap* players = World::getWorld()->getPlayers();
+	WorldObjectMap::iterator it;
+	
+	int nr=0;
+	
+	// Gibt an, ob der Spieler Leiter seiner Party ist
+	bool leader = false;
+	if (player->getId() == party->getLeader())
+	{
+		leader = true;
+	}
+	
+	bool leader2;
+	DEBUGX("party %i solo %i leader %i",party->getId(),solo,leader);
+	
+	Fraction::Relation rel,rel2;
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	std::ostringstream stream;
+	CEGUI::Window* label, *img, *btn;
+	bool vis;
+	
+	for (it = players->begin(); it != players->end(); ++it)
+	{
+		leader2 = false;
+		
+		pl = static_cast<Player*>(it->second);
+		m_player_ids[nr] = pl->getId();
+		
+		if (pl == player)
+		{
+			//continue;
+		}
+		
+		leader2 = false;
+		if (pl->getParty()->getLeader() == pl->getId())
+		{
+			leader2 = true;
+		}
+		
+		rel = party->getRelations()[pl->getParty()->getId()];
+		rel2 = pl->getParty()->getRelations()[party->getId()];
+				
+		stream.str("");
+		stream << "PlayerImage";
+		stream << nr;
+		
+		img = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (img->isVisible()!=true)
+		{
+			img->setVisible(true);
+		}
+		
+		std::string imagestr = pl->getEmotionImage("normal");
+		if (img->getProperty("Image") != imagestr)
+		{
+			img->setProperty("Image",imagestr);
+		}
+		
+		stream.str("");
+		stream << "PlayerParty";
+		stream << nr;
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		
+		stream.str("");
+		stream<< pl->getParty()->getId();
+		if (label->isVisible()!=true)
+		{
+			label->setVisible(true);
+		}
+		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
+		{
+			label->setText((CEGUI::utf8*)  stream.str().c_str());
+		}
+		
+		stream.str("");
+		stream << "PlayerName";
+		stream << nr;
+		
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		stream.str("");
+		stream << pl->getName().getRawText();
+		if (label->isVisible()!=true)
+		{
+			label->setVisible(true);
+		}
+		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
+		{
+			label->setText((CEGUI::utf8*)  stream.str().c_str());
+		}
+		
+		
+		stream.str("");
+		stream << "PlayerClass";
+		stream << nr;
+		
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		PlayerBasicData* pdata = ObjectFactory::getPlayerData(pl->getSubtype());
+		if (pdata != 0)
+		{
+			stream.str(gettext(pdata->m_name.c_str()));
+		}
+		else
+		{
+			stream.str("");
+		}
+		
+		if (label->getText() != (CEGUI::utf8*)  stream.str().c_str())
+		{
+			label->setText((CEGUI::utf8*)  stream.str().c_str());
+		}
+		
+		// Accept button nur Anzeigen wenn der Spieler Partyleiter ist und der andere Spieler ein Bewerber
+		vis = false;
+		if (leader && party->getCandidates().count(pl->getId())>0)
+		{
+			vis = true;
+		}
+		stream.str("");
+		stream << "AcceptMemberButton";
+		stream << nr;
+		
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		// gleiche Regeln fuer den Ablehnen Button
+		stream.str("");
+		stream << "RejectMemberButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		// Bewerbung erlauben, wenn der andere Spieler ein Partyleiter und man selbst Solo
+		vis = false;
+		if (solo && player->getCandidateParty() ==-1 && leader2 && party->getId() != pl->getParty()->getId() && party->getCandidates().count(pl->getId())==0 && rel == Fraction::NEUTRAL && rel2 == Fraction::NEUTRAL)
+		{
+			vis = true;
+		}
+		stream.str("");
+		stream << "ApplyButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		// Kick Button anzeigen, wenn man Partyleiter ist und der andere Spieler ein Verbuendeter
+		vis = false;
+		if (leader && party->getMembers().count(pl->getId())>0 && pl != player)
+		{
+			if (World::getWorld() !=0 && !World::getWorld()->isCooperative())
+				vis = true;
+		}
+		stream.str("");
+		stream << "KickMemberButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		vis = false;
+		if ((!solo && pl->getId() == party->getLeader()) || (solo && pl->getParty()->getId() == player->getCandidateParty()))
+		{
+			if (World::getWorld() !=0 && !World::getWorld()->isCooperative())
+				vis = true;
+		}
+		stream.str("");
+		stream << "LeavePartyButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		// Frieden Button anbieten, wenn aktuelles Verhaeltnis feindlich ist
+		vis = false;
+		if (leader && leader2 && rel == Fraction::HOSTILE)
+		{
+			vis = true;
+		}
+		stream.str("");
+		stream << "PeaceButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		// Krieg Button anbieten, wenn aktuelles Verhaeltnis neutral ist
+		vis = false;
+		if (leader && leader2 && rel == Fraction::NEUTRAL && player->getCandidateParty() != pl->getParty()->getId() && pl->getCandidateParty() != player->getParty()->getId())
+		{
+			vis = true;
+		}
+		stream.str("");
+		stream << "DeclareWarButton";
+		stream << nr;
+		
+		btn = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		if (btn->isVisible()!=vis)
+		{
+			btn->setVisible(vis);
+		}
+		
+		
+		nr ++;
+		
+	}
+	
+	// alle GUI Elemente zu denen kein Spieler gehoehrt ausblenden
+	std::string elements[11] = {"PlayerImage","PlayerParty", "PlayerName", "PlayerClass", "AcceptMemberButton", "RejectMemberButton", "ApplyButton", "KickMemberButton", "PeaceButton", "DeclareWarButton","LeavePartyButton"};
+	
+	
+	for (int i=nr; i<7; i++)
+	{
+		for (int j=0; j<11; j++)
+		{
+			stream.str("");
+			stream << elements[j];
+			stream << i;
+			
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+			if (label->isVisible())
+			{
+				label->setVisible(false);
+			}
+			
+		}
+	}
+	
+}
+
+void PartyInfo::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	
+	std::ostringstream stream;
+	for (int i=0; i<7; i++)
+	{
+		stream.str("");
+		stream << "PlayerName";
+		stream << i;
+		
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		label->setText((CEGUI::utf8*) gettext("Name"));
+	}
+}
+
+bool PartyInfo::onAcceptMemberButtonClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonPartyAccept(m_player_ids[id]);
+	
+	return true;
+}
+
+bool PartyInfo::onApplyButtonClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonPartyApply(m_player_ids[id]);
+	return true;
+}
+
+bool PartyInfo::onRejectMemberButtonClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonPartyReject(m_player_ids[id]);
+	return true;
+}
+
+bool PartyInfo::onKickMemberButtonClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonKick(m_player_ids[id]);
+	
+	return true;
+}
+
+bool PartyInfo::onLeavePartyButtonClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonPartyLeave();
+	return true;
+}
+
+bool PartyInfo::onPeaceButtonClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonPartyPeace(m_player_ids[id]);
+	return true;
+}
+
+bool PartyInfo::onDeclareWarButtonClicked(const CEGUI::EventArgs& evt)
+{
+	
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	m_document->onButtonPartyWar(m_player_ids[id]);
+	return true;
+}
+
--- a/src/gui/questinfo.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/questinfo.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -15,6 +15,9 @@
 
 #include "questinfo.h"
 
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
 QuestInfo::QuestInfo (Document* doc, const std::string& ceguiSkinName)
 	: Window (doc)
 	, m_ceguiSkinName (ceguiSkinName)
@@ -28,27 +31,27 @@
 	
 
 	// Rahmen fuer das Menue Savegame auswaehlen
-	CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("questinfo.layout");
+	CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("questinfo.layout");
 	if (!quest_info)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "questinfo.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "questinfo.layout");
 	}
-	CEGUI::Window* quest_info_holder = win_mgr.loadWindowLayout( "questinfo_holder.layout" );
+	CEGUI::Window* quest_info_holder = CEGUIUtility::loadLayoutFromFile ("questinfo_holder.layout");
 	if (!quest_info_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "questinfo_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "questinfo_holder.layout");
 	}
 
-	CEGUI::Window* wndHolder = win_mgr.getWindow("QuestInfo_Holder");
-	CEGUI::Window* wndQuest = win_mgr.getWindow("QuestInfo");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (quest_info_holder, "QuestInfo_Holder");
+	CEGUI::Window* wndQuest = CEGUIUtility::getWindowForLoadedLayoutEx (quest_info, "QuestInfo");
 	if (wndHolder && wndQuest)
 	{
-		wndHolder->addChildWindow (wndQuest);
+		CEGUIUtility::addChildWidget (wndHolder, wndQuest);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for quests.");
-		if (!wndQuest) DEBUG ("ERROR: Unable to get the window for quests.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for quests.");
+		if (!wndQuest) SW_DEBUG ("ERROR: Unable to get the window for quests.");
 	}
 
 	m_window = quest_info_holder;
@@ -56,45 +59,35 @@
 	quest_info->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent, (Window*) this));
 	
 	// Bestandteile der Kontrollleiste hinzufuegen
-	CEGUI::Window* label;
-
 	
-	CEGUI::Listbox* questlist = (CEGUI::Listbox*) win_mgr.getWindow("QuestList");
+	CEGUI::Listbox* questlist = (CEGUI::Listbox*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestList");
 	questlist->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber(&QuestInfo::onQuestSelected, this));
-	
-	CEGUI::Checkbox * box;
+
+	CEGUIUtility::ToggleButton * box;
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestOpenBox");
-	box->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestOpenBox");
+	box->subscribeEvent(CEGUIUtility::EventToggleButtonStateChanged (), CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
 	box->setSelected(true);
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestDoneBox");
-	box->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestDoneBox");
+	box->subscribeEvent(CEGUIUtility::EventToggleButtonStateChanged (), CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
 	box->setSelected(false);
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestFailedBox");
-	box->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestFailedBox");
+	box->subscribeEvent(CEGUIUtility::EventToggleButtonStateChanged (), CEGUI::Event::Subscriber(&QuestInfo::onFilterSelected, this));
 	box->setSelected(false);
 	
 	CEGUI::MultiLineEditbox* quest_descr;
-	quest_descr = static_cast<CEGUI::MultiLineEditbox*>(win_mgr.getWindow("QuestDescription"));
+	quest_descr = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestDescription"));
 	quest_descr->setWantsMultiClickEvents(false);
 	quest_descr->setReadOnly(true);
 	quest_descr->setText("");
 	
-	if (win_mgr.isWindowPresent ("QuestInfoCloseButton"))
-	{
-		label = win_mgr.getWindow("QuestInfoCloseButton");
-		label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&QuestInfo::onCloseButtonClicked, this));
-	}
-	else if (win_mgr.isWindowPresent ("QuestInfo__auto_closebutton__"))
+	CEGUI::Window* autoCloseButton;
+	autoCloseButton = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/__auto_closebutton__");
+	if (autoCloseButton)
 	{
-		CEGUI::Window* autoCloseButton;
-		autoCloseButton = win_mgr.getWindow ("QuestInfo__auto_closebutton__");
-		if (autoCloseButton)
-		{
-			autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&QuestInfo::onCloseButtonClicked, this));
-		}
+		autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&QuestInfo::onCloseButtonClicked, this));
 	}
 
 	updateTranslation();
@@ -110,18 +103,18 @@
 	
 	// Auswahl ermitteln
 	bool open,done,failed;
-	CEGUI::Checkbox * box;
+	CEGUIUtility::ToggleButton * box;
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestOpenBox");
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestOpenBox");
 	open = box->isSelected();
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestDoneBox");
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestDoneBox");
 	done = box->isSelected();
 	
-	box = (CEGUI::Checkbox *) win_mgr.getWindow("QuestFailedBox");
+	box = (CEGUIUtility::ToggleButton *) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestFailedBox");
 	failed = box->isSelected();
 	
-	CEGUI::Listbox* questlist = (CEGUI::Listbox*) win_mgr.getWindow("QuestList");
+	CEGUI::Listbox* questlist = (CEGUI::Listbox*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestList");
 	questlist->resetList();
 	
 	// Liste mit den Quests aktualisieren
@@ -168,27 +161,19 @@
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
 	CEGUI::Window* label;
 
-	if (win_mgr.isWindowPresent ("Quests"))
-	{
-		label =  win_mgr.getWindow("Quests");
-		label->setText((CEGUI::utf8*) gettext("Quests"));
-	}
-	else if (win_mgr.isWindowPresent ("QuestInfo"))
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo");
+	if (label->isPropertyPresent ("Text"))
 	{
-		label =  win_mgr.getWindow("QuestInfo");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Quests"));
-		}
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Quests"));
 	}
-
-	label = win_mgr.getWindow("QuestOpenLabel");
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestOpenLabel");
 	label->setText((CEGUI::utf8*) gettext("open"));
 	
-	label = win_mgr.getWindow("QuestDoneLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestDoneLabel");
 	label->setText((CEGUI::utf8*) gettext("finished"));
 	
-	label = win_mgr.getWindow("QuestFailedLabel");
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestFailedLabel");
 	label->setText((CEGUI::utf8*) gettext("failed"));
 	
 	
@@ -216,11 +201,11 @@
 void QuestInfo::updateDescription()
 {
 	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Listbox* classlist = (CEGUI::Listbox*) win_mgr.getWindow("QuestList");
+	CEGUI::Listbox* classlist = (CEGUI::Listbox*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestList");
 	CEGUI::ListboxItem * itm = classlist->getFirstSelectedItem();
 	
 	CEGUI::MultiLineEditbox* quest_descr;
-	quest_descr = static_cast<CEGUI::MultiLineEditbox*>(win_mgr.getWindow("QuestDescription"));
+	quest_descr = static_cast<CEGUI::MultiLineEditbox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "QuestInfo/questinfo_aux/QuestDescription"));
 	
 	if (itm !=0 && World::getWorld()!=0)
 	{
--- a/src/gui/savegamelist.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/savegamelist.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,417 +1,589 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "OgreResourceGroupManager.h"
-#include "OgreTextureManager.h"
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
-#include "savegamelist.h"
-#include "stdstreamconv.h"
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-#include "onlineservicesmanager.h"
-#endif
-#include "ceguiutility.h"
-
-SavegameList::SavegameList (Document* doc, const std::string& ceguiSkinName)
-
-	: Window(doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUGX("setup main menu");
-	// GUI Elemente erzeugen
-
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
-	m_currentSelected = 0;
-
-	// Rahmen fuer das Menue Savegame auswaehlen
-	CEGUI::FrameWindow* save_menu = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "SavegameMenu");
-	save_menu->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); //0.0/0.8
-	save_menu->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f))); //1.0/0.2
-	save_menu->setProperty("FrameEnabled","false");
-	save_menu->setProperty("TitlebarEnabled","false");
-	save_menu->setProperty("CloseButtonEnabled","false");
-	save_menu->setAlpha(0.0f);
-	save_menu->setInheritsAlpha(false);
-	
-	m_window = save_menu;
-
-	// Bestandteile der Kontrollleiste hinzufuegen
-	CEGUI::PushButton* btn;
-	//CEGUI::Window* label;// detected as unused, 2011.10.23.
-
-	
-	// Button neu
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), "NewCharButton"));
-	save_menu->addChildWindow(btn);
-	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.85f)));
-	btn->setSize(CEGUI::UVector2(cegui_reldim(0.4f), cegui_reldim( 0.05f)));
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onNewCharClicked, this));
-	btn->setWantsMultiClickEvents(false);
-	btn->setInheritsAlpha(false);
-	if (btn->isPropertyPresent ("NormalImage"))
-	{
-		btn->setProperty("NormalImage", "set:MainMenu image:SPBtnNormal");
-	}
-	if (btn->isPropertyPresent ("HoverImage"))
-	{
-		btn->setProperty("HoverImage", "set:MainMenu image:SPBtnHover");
-	}
-	if (btn->isPropertyPresent ("PushedImage"))
-	{
-		btn->setProperty("PushedImage", "set:MainMenu image:SPBtnPushed");
-	}
-	
-    m_numCurrentCharacterButtons = 0;
-
-	updateTranslation();
-}
-
-void SavegameList::update()
-{	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	// Liste aller Files im Save Ordner der Form *.sav
-	Ogre::FileInfoListPtr files;
-	Ogre::FileInfoList::iterator it;
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-    if(!OnlineServicesManager::getSingleton().userLoggedIn())
-        files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Savegame","*.sav");
-    else
-    {
-        std::string id = OnlineServicesManager::getSingleton().getUserDataResGroupId();
-        files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(id,"*.sav");
-    }
-#else
-    files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Savegame","*.sav");
-#endif
-
-
-	std::fstream file;
-	char bin;
-	int n = 0;
-	char lev;
-	
-	std::string name;
-	std::string classname;
-	std::ostringstream stream;
-	std::string filename;
-	PlayerLook look;
-	int version;
-	// iterieren ueber die Files
-	unsigned char* data;
-
-    for(int i = 0; i < m_numCurrentCharacterButtons; i++)
-    {
-		std::ostringstream s;
-		s << i;
-
-        CEGUI::Window* saveItem = 0;
-        try
-        {
-            saveItem = win_mgr.getWindow(s.str().append("SaveItemRoot"));
-			saveItem->hide();
-            //m_window->removeChildWindow(saveItem);
-        }
-        catch(CEGUI::UnknownObjectException&)
-        {
-        }
-    }
-
-    m_numCurrentCharacterButtons = files->size();
-
-	float height = m_window->getPixelSize().d_width / 4.0f;
-
-	for (it = files->begin(); it!= files->end();++it)
-    {
-		filename = it->archive->getName();
-		filename += "/";
-		filename += it->filename;
-		DEBUGX("file found %s",filename.c_str());
-		//File oeffnen
-
-		file.open(filename.c_str(),std::ios::in| std::ios::binary);
-		if (file.is_open())
-		{
-			std::ostringstream s;
-			s << n;
-
-			CEGUI::Window* saveItem = 0;
-			try
-			{
-				saveItem = win_mgr.getWindow(s.str().append("SaveItemRoot"));
-				saveItem->show();
-				m_currentSelected = saveItem;
-				// Store the file name in a mapping, along with this widget name
-				m_fileSaveMapping [s.str().append("SaveItemRoot")] = it->filename;
-			}
-			catch(CEGUI::UnknownObjectException&)
-			{
-				saveItem = (CEGUI::Window*) win_mgr.loadWindowLayout("saveitem.layout", s.str());
-				m_currentSelected = saveItem;
-				saveItem->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onSavegameChosen, this));
-				m_window->addChildWindow(saveItem);
-				saveItem->show();
-
-				// Store the mapping entry;
-				m_fileSaveMapping [s.str().append("SaveItemRoot/DelChar")] = it->filename;
-				
-				// make buttons resolution independant
-				saveItem->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim((height + 2.0f)*n)));
-				saveItem->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_absdim(height)));
-				saveItem->getChild(s.str().append("SaveItemRoot/Name"))->setMousePassThroughEnabled(true);
-				saveItem->getChild(s.str().append("SaveItemRoot/DecriptionLabel"))->setMousePassThroughEnabled(true);
-				saveItem->getChild(s.str().append("SaveItemRoot/Avatar"))->setMousePassThroughEnabled(true);
-				saveItem->getChild(s.str().append("SaveItemRoot/DelChar"))->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onDeleteCharClicked, this));	
-			}
-			
-			// set the proper Image
-			std::string texName = filename.erase(filename.length() - 4, filename.length());
-			Ogre::TextureManager *tmgr = Ogre::TextureManager::getSingletonPtr();
-
-			int pos = texName.find_last_of("\\");
-			if (texName.find_last_of("/") > (size_t)pos)
-			{
-				pos = texName.find_last_of("/");
-			}
-
-			std::string nameNoPath = texName.erase(0, pos+1).append(".png");
-			CEGUI::String imagesetName = (CEGUI::utf8*) (texName + "SaveItemRootAvatarImageset").c_str();
-			
-			CEGUI::String imageName = CEGUI::String("set:") + imagesetName + "  " + "image:MainMenuAvatarImg";
-			
-			DEBUGX("imagename %s",imageName.c_str() );
-			DEBUGX("imagesetName %s", imagesetName.c_str());
-			
-			
-			if (CEGUI::ImagesetManager::getSingleton().isDefined(imagesetName))
-			{
-				saveItem->getChild(s.str().append("SaveItemRoot/Avatar"))->setProperty("Image", imageName);
-			}
-			else
-			{
-                std::string resGrp = "Savegame";
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-                if(OnlineServicesManager::getSingletonPtr())
-                    resGrp = OnlineServicesManager::getSingleton().getUserDataResGroupId();
-#endif
-
-				// create CEGUI texture for the character thumbnail
-                if(Ogre::ResourceGroupManager::getSingleton().resourceExists(resGrp, nameNoPath))
-				{
-					Ogre::TexturePtr tex = tmgr->load(texName, "Savegame");
-
-					CEGUI::Texture &ceguiTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(tex);
-
-					CEGUI::Imageset& textureImageSet = CEGUI::ImagesetManager::getSingleton().create(imagesetName, ceguiTex);
-					textureImageSet.defineImage( "MainMenuAvatarImg",
-								CEGUI::Point( 0.0f, 0.0f ),
-								CEGUI::Size( ceguiTex.getSize().d_width, ceguiTex.getSize().d_height ),
-								CEGUI::Point( 0.0f, 0.0f ) );
-					
-					saveItem->getChild(s.str().append("SaveItemRoot/Avatar"))->setProperty("Image", imageName);
-				}
-				else
-				{
-					saveItem->getChild(s.str().append("SaveItemRoot/Avatar"))->setProperty("Image","set:MainMenu image:Logo");
-				}
-			}
-
-			file.get(bin);
-			
-			CharConv* save;
-			data =0;
-			if (bin == '0')
-			{
-				save = new StdStreamConv(&file);
-			}
-			else
-			{
-				// binary Savegames are not supported anymore
-				file.close();
-				continue;
-			}
-			
-			save->fromBuffer(version);
-			save->setVersion(version);
-			
-			save->fromBuffer(classname);
-			save->fromBuffer(name);
-			look.fromString(save);
-			save->fromBuffer(lev);
-			
-			stream.str("");
-			stream << (int) lev;
-
-
-			CEGUI::String temp;
-			temp.append((CEGUI::utf8*) gettext("Level")).append(" ").append(stream.str()).append(" ").append((CEGUI::utf8*) gettext(classname.c_str()));
-			saveItem->getChild(s.str().append("SaveItemRoot/Name"))->setText((CEGUI::utf8*) name.c_str());
-			saveItem->getChild(s.str().append("SaveItemRoot/DecriptionLabel"))->setText(temp);
-
-			n++;
-
-			file.close();
-			
-			delete save;
-			if (data != 0)
-				 delete data;
-        }
-	}
-	
-	CEGUI::PushButton *btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("NewCharButton"));
-	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim((height + 2.0f)*n+1)));
-	btn->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_absdim(height)));
-}
-
-void SavegameList::selectDefaultSavegame()
-{
-	std::string savegame = Options::getInstance()->getDefaultSavegame();
-	if (savegame != "")
-	{
-		m_document->setSaveFile(savegame.c_str());
-	}
-}
-
-void SavegameList::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	/*
-	CEGUI::Window* label;
-	label = win_mgr.getWindow("SavegameChooseLabel");
-	label->setText((CEGUI::utf8*) gettext("Characters"));*/
-	
-	/*btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SelectSavegameButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));*/
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("NewCharButton"));
-	btn->setText((CEGUI::utf8*) gettext("Create"));
-}
-
-bool SavegameList::onSavegameChosen(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(evt);
-	
-	std::string prefix = we.window->getName().c_str();
-	std::string saveWidgetName = prefix;
-
-	prefix.erase(prefix.length()-12, prefix.length());
-
-	std::string name = we.window->getChild(prefix.append("SaveItemRoot/Name"))->getText().c_str();
-
-	// Get the file mapped to this widget: if we have a mapping, use the mapped name, otherwise, just add an extension and try to use the same file name as the char name.
-	std::map <std::string, std::string>::const_iterator it = m_fileSaveMapping.find (saveWidgetName);
-	if (it != m_fileSaveMapping.end ())
-	{
-		name = m_fileSaveMapping [saveWidgetName];
-		DEBUG ("got mapping for [%s] as [%s]", saveWidgetName.c_str (), name.c_str ());
-	}
-	else
-	{
-		name.append(".sav");
-	}
-
-	m_document->setSaveFile(name.c_str());
-	DEBUGX("selected Savegame %s", sitm->m_data.c_str());
-
-	return true;
-}
-
-bool SavegameList::onSavegameSelected(const CEGUI::EventArgs& evt)
-{
-	if (m_document->getSaveFile() != "")
-	{
-		DEBUG("savegame accepted %s", m_document->getSaveFile().c_str());
-		m_document->getGUIState()->m_shown_windows = Document::START_MENU;
-		m_document->setModified(Document::WINDOWS_MODIFIED);
-	}
-	return true;
-}
-
-bool SavegameList::onNewCharClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onCreateNewCharButton();
-	return true;
-}
-
-
-bool SavegameList::onDeleteCharClicked(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(evt);
-	onSavegameChosen(CEGUI::WindowEventArgs(we.window->getParent()));
-	
-	m_document->showQuestionDialog ();
-
-	return true;
-}
-
-bool SavegameList::onDeleteCharConfirmClicked(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	m_document->hideQuestionDialog ();
-
-	// Get the save file to remove.
-	std::string saveFile =  m_document->getSaveFile();
-	if (saveFile.empty())
-	{
-		return false;
-	}
-	
-	// Get rid of the save file
-	remove (saveFile.c_str ());
-
-	// Also get rif od the preview image.
-	// The preview image should have the same name as the save file, but with a different extension.
-	// Using the standard 3 char extension (4 if the "." is included).
-	if (saveFile.length () > 4)
-	{
-		// Parse the name.
-		std::string previewPicture (saveFile);
-		previewPicture.erase (saveFile.length () - 4, saveFile.length());
-		previewPicture.append (".png");
-
-		// Get rid of the file
-		remove (previewPicture.c_str ());
-	}
-
-	// Clear the selection in the menu.
-	if(m_currentSelected != 0)
-	{
-		CEGUI::WindowManager::getSingleton().destroyWindow(m_currentSelected);
-		m_currentSelected = 0;
-	}
-	m_document->setSaveFile("");
-	
-	update();
-	return true;
-}
-
-bool SavegameList::onDeleteCharAbortClicked(const CEGUI::EventArgs& evt)
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	m_document->hideQuestionDialog ();
-
-	return true;
-}
-
-bool SavegameList::onSavegameDoubleClick(const CEGUI::EventArgs& evt)
-{
-	onSavegameSelected(evt);
-	return true;
-}
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "OgreResourceGroupManager.h"
+#include "OgreTextureManager.h"
+#include "savegamelist.h"
+#include "stdstreamconv.h"
+
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+#include "onlineservicesmanager.h"
+#endif
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+// needed to be able to create the CEGUI renderer interface
+#ifdef CEGUI_07
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
+#else
+#include "CEGUI/RendererModules/Ogre/Renderer.h"
+#endif
+
+// Sound operations helper.
+#include "soundhelper.h"
+
+
+SavegameList::SavegameList (Document* doc, const std::string& ceguiSkinName)
+
+	: Window(doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	DEBUGX("setup main menu");
+	// GUI Elemente erzeugen
+
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
+	m_currentSelected = 0;
+
+	// Rahmen fuer das Menue Savegame auswaehlen
+	CEGUI::FrameWindow* save_menu = (CEGUI::FrameWindow*) win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "FrameWindow"), "SavegameMenu");
+	save_menu->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f))); //0.0/0.8
+	CEGUIUtility::setWidgetSizeRel (save_menu, 1.0f, 1.0f);
+	save_menu->setProperty("FrameEnabled","false");
+	save_menu->setProperty("TitlebarEnabled","false");
+	save_menu->setProperty("CloseButtonEnabled","false");
+	save_menu->setAlpha(0.0f);
+	save_menu->setInheritsAlpha(false);
+	
+	m_window = save_menu;
+
+	// Bestandteile der Kontrollleiste hinzufuegen
+	CEGUI::PushButton* btn;
+	//CEGUI::Window* label;// detected as unused, 2011.10.23.
+
+	
+	// Button neu
+	btn = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "Button"), "NewCharButton"));
+	CEGUIUtility::addChildWidget (save_menu, btn);
+	btn->setPosition(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.85f)));
+	CEGUIUtility::setWidgetSizeRel (btn, 0.4f, 0.05f);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onNewCharClicked, this));
+	btn->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SavegameList::onItemButtonHover, this));
+	btn->setWantsMultiClickEvents(false);
+	btn->setInheritsAlpha(false);
+
+	if (btn->isPropertyPresent ("NormalImage"))
+	{
+		btn->setProperty("NormalImage", CEGUIUtility::getImageNameWithSkin("MainMenu","SPBtnNormal"));
+	}
+
+	if (btn->isPropertyPresent ("HoverImage"))
+	{
+		btn->setProperty("HoverImage", CEGUIUtility::getImageNameWithSkin ("MainMenu", "SPBtnHover"));
+	}
+
+	if (btn->isPropertyPresent ("PushedImage"))
+	{
+		btn->setProperty("PushedImage", CEGUIUtility::getImageNameWithSkin ("MainMenu", "SPBtnPushed"));
+	}
+	
+    m_numCurrentCharacterButtons = 0;
+
+	updateTranslation();
+}
+
+void SavegameList::update()
+{	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	// Liste aller Files im Save Ordner der Form *.sav
+	Ogre::FileInfoListPtr files;
+	Ogre::FileInfoList::iterator it;
+
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+    if(!OnlineServicesManager::getSingleton().userLoggedIn())
+        files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Savegame","*.sav");
+    else
+    {
+        std::string id = OnlineServicesManager::getSingleton().getUserDataResGroupId();
+        files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(id,"*.sav");
+    }
+#else
+    files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Savegame","*.sav");
+#endif
+
+
+	std::fstream file;
+	char bin;
+	int n = 0;
+	char lev;
+	
+	std::string name;
+	std::string classname;
+	std::ostringstream stream;
+	std::string filename;
+	PlayerLook look;
+	int version;
+	// iterieren ueber die Files
+	unsigned char* data;
+
+    m_numCurrentCharacterButtons = files->size();
+
+	float height = m_window->getPixelSize().d_width / 4.0f;
+
+	for (it = files->begin(); it!= files->end();++it)
+    {
+		filename = it->archive->getName();
+		filename += "/";
+		filename += it->filename;
+		DEBUGX("file found %s",filename.c_str());
+		//File oeffnen
+
+		file.open(filename.c_str(),std::ios::in| std::ios::binary);
+		if (file.is_open())
+		{
+			std::ostringstream s;
+			s << n;
+			bool needToLoadLayout = false;
+
+			CEGUI::Window* saveItem = 0;
+			CEGUI::String currentItemNumber (s.str ());
+			CEGUI::String layoutRootItemName (CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot")));
+			try
+			{
+				SW_DEBUG ("Trying to get existing item %s", layoutRootItemName.c_str ());
+				saveItem = CEGUIUtility::getWindowForLoadedLayout(m_window, layoutRootItemName);
+				if (!saveItem)
+				{
+					SW_DEBUG ("Could not get item; will have to load");
+					needToLoadLayout = true;
+				}
+			}
+			catch(CEGUI::UnknownObjectException&)
+			{
+				needToLoadLayout = true;
+			}
+
+			if (needToLoadLayout)
+			{
+				SW_DEBUG ("Loading layout file [saveitem.layout]");
+				saveItem = (CEGUI::FrameWindow*) (CEGUIUtility::loadLayoutFromFile ("saveitem.layout"));
+				SW_DEBUG ("Loaded layout file [saveitem.layout]");
+				//saveItem = (CEGUI::Window*) win_mgr.loadWindowLayout("saveitem.layout", s.str());
+				m_currentSelected = saveItem;
+				saveItem->setName (layoutRootItemName);
+				saveItem->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onSavegameChosen, this));
+				saveItem->subscribeEvent(CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SavegameList::onItemButtonHover, this));
+				CEGUIUtility::addChildWidget(m_window, saveItem);
+				saveItem->show();
+
+				// Store the mapping entry;
+				m_fileSaveMapping [s.str().append("SaveItemRoot_DelChar")] = it->filename;
+				
+				// make buttons resolution independent
+				saveItem->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim((height + 2.0f)*n)));
+				CEGUIUtility::setWidgetSize (saveItem, CEGUI::UVector2(cegui_reldim(1.0f), cegui_absdim(height)));
+
+				// Set child element properties.
+
+				// Augustin Preda, 2014.01.18: dropping support for CEGUI 0.7
+				CEGUI::String widgetName (CEGUIUtility::getNameForWidget("SaveItemRoot/SaveItemRoot_Name"));
+				CEGUI::Window *wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+				if (wndPtr)
+				{
+					wndPtr->setMousePassThroughEnabled(true);
+				}
+
+				widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_DecriptionLabel");
+				wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+				if (wndPtr)
+				{
+					wndPtr->setMousePassThroughEnabled(true);
+				}
+
+				widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_Avatar");
+				wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+				if (wndPtr)
+				{
+					wndPtr->setMousePassThroughEnabled(true);
+				}
+
+				// Connect to some events.
+				widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_DelChar");
+				wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+				if (wndPtr)
+				{
+					wndPtr->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&SavegameList::onDeleteCharClicked, this));
+					wndPtr->subscribeEvent (CEGUIUtility::EventMouseEntersPushButtonArea (), CEGUI::Event::Subscriber(&SavegameList::onItemButtonHover, this));
+				}
+			}
+			else
+			{
+				saveItem->show();
+				m_currentSelected = saveItem;
+				// Store the file name in a mapping, along with this widget name
+				m_fileSaveMapping [s.str().append("SaveItemRoot")] = it->filename;
+			}
+			
+			// set the proper Image
+			std::string texName = filename.erase(filename.length() - 4, filename.length());
+			Ogre::TextureManager *tmgr = Ogre::TextureManager::getSingletonPtr();
+
+			int pos = texName.find_last_of("\\");
+			if (texName.find_last_of("/") > (size_t)pos)
+			{
+				pos = texName.find_last_of("/");
+			}
+
+			std::string nameNoPath = texName.erase(0, pos+1).append(".png");
+			CEGUI::String imagesetName = (CEGUI::utf8*) (texName + "SaveItemRootAvatarImageset").c_str();
+			
+			CEGUI::String imageName = CEGUIUtility::getImageNameWithSkin (imagesetName.c_str(), s.str ().append("MainMenuAvatarImg"));
+			
+			DEBUGX("imagename %s",imageName.c_str() );
+			DEBUGX("imagesetName %s", imagesetName.c_str());
+			
+			if (CEGUIUtility::getImageManager ().isDefined(imagesetName))
+			{
+				CEGUI::String widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_Avatar");
+				CEGUI::Window* wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+				if (wndPtr)
+				{
+					SW_DEBUG ("Setting save button avatar for [%s] to [%s]", wndPtr->getNamePath ().c_str (), imageName.c_str ());
+					wndPtr->setProperty("Image", imageName);
+				}
+				else
+				{
+					WARNING ("Could not get widget named [%s]", widgetName.c_str ());
+				}
+			}
+			else
+			{
+                std::string resGrp = "Savegame";
+
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+                if(OnlineServicesManager::getSingletonPtr())
+                    resGrp = OnlineServicesManager::getSingleton().getUserDataResGroupId();
+#endif
+
+				// create CEGUI texture for the character thumbnail
+				if(Ogre::ResourceGroupManager::getSingleton().resourceExists(resGrp, nameNoPath))
+				{
+					CEGUI::String textureName (s.str ().append ("MainMenuAvatar_Tex"));
+					Ogre::TexturePtr tex = tmgr->load(texName, "Savegame");
+
+#ifdef CEGUI_07
+					CEGUI::Texture &ceguiTex = static_cast<CEGUI::OgreRenderer*>
+						(CEGUI::System::getSingleton().getRenderer())->createTexture(tex);
+
+
+					CEGUI::Imageset& textureImageSet = CEGUIUtility::getImageManager ().create (imagesetName, ceguiTex);
+					textureImageSet.defineImage( "MainMenuAvatarImg",
+								CEGUIUtility::Vector2f (0.0f, 0.0f),
+								CEGUIUtility::Size (ceguiTex.getSize().d_width, ceguiTex.getSize().d_height),
+								CEGUIUtility::Vector2f (0.0f, 0.0f)
+								);
+#else
+					CEGUI::String imageName (s.str ().append ("MainMenuAvatarImg"));
+					if (! CEGUI::System::getSingleton ().getRenderer ()->isTextureDefined (textureName)
+						&& ! CEGUI::ImageManager::getSingleton().isDefined(imageName))
+					{
+						CEGUI::Texture &ceguiTex = static_cast<CEGUI::OgreRenderer*>
+							(CEGUI::System::getSingleton ().getRenderer ())->createTexture (textureName, tex);
+
+						CEGUI::OgreRenderer* rendererPtr = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer());
+						CEGUI::TextureTarget*   d_textureTarget;
+						CEGUI::BasicImage*      d_textureTargetImage;
+						d_textureTarget = rendererPtr->createTextureTarget();
+						d_textureTargetImage = static_cast<CEGUI::BasicImage*>(&CEGUI::ImageManager::getSingleton().create("BasicImage", imageName));
+						d_textureTargetImage->setTexture(&ceguiTex);
+						d_textureTargetImage->setArea(CEGUI::Rectf(0, 0, ceguiTex.getSize ().d_width,ceguiTex.getSize ().d_height));
+					}
+#endif
+					{
+#ifdef CEGUI_07
+						CEGUI::String widgetName = CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot_Avatar"));
+#else
+						CEGUI::String widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_Avatar");
+#endif
+						CEGUI::Window* wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+						SW_DEBUG ("Setting save button avatar for [%s] to [%s]", widgetName.c_str (), imageName.c_str ());
+						if (wndPtr)
+						{
+							wndPtr->setProperty("Image", imageName);
+						}
+						else
+						{
+							WARNING("Could not get widget named [%s]", widgetName.c_str ());
+						}
+					}
+				}
+				else
+				{
+#ifdef CEGUI_07
+					CEGUI::String widgetName = CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot_Avatar"));
+#else
+					CEGUI::String widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_Avatar");
+#endif
+					CEGUI::Window* wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+					wndPtr->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("MainMenu", "Logo"));
+				}
+			}
+
+			file.get(bin);
+			
+			CharConv* save;
+			data =0;
+			if (bin == '0')
+			{
+				save = new StdStreamConv(&file);
+			}
+			else
+			{
+				// binary Savegames are not supported anymore
+				file.close();
+				continue;
+			}
+			
+			save->fromBuffer(version);
+			save->setVersion(version);
+			
+			save->fromBuffer(classname);
+			save->fromBuffer(name);
+			look.fromString(save);
+			save->fromBuffer(lev);
+			
+			stream.str("");
+			stream << (int) lev;
+
+
+			CEGUI::String temp;
+			temp.append((CEGUI::utf8*) gettext("Level")).append(" ").append(stream.str()).append(" ").append((CEGUI::utf8*) gettext(classname.c_str()));
+
+#ifdef CEGUI_07
+			CEGUI::String widgetName (CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot_Name")));
+#else
+			CEGUI::String widgetName (CEGUIUtility::getNameForWidget("SaveItemRoot_Name"));
+#endif
+
+			CEGUI::Window *wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName);
+			if (wndPtr)
+			{
+				wndPtr->setText ((CEGUI::utf8*) name.c_str ());
+			}
+
+#ifdef CEGUI_07
+			widgetName = CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot_DecriptionLabel"));
+#else
+			widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_DecriptionLabel");
+#endif
+			wndPtr = CEGUIUtility::getWindowForLoadedLayout (saveItem, widgetName);
+			if (wndPtr)
+			{
+				wndPtr->setText (temp);
+			}
+			//saveItem->getChild(s.str().append("SaveItemRoot_Name"))->setText((CEGUI::utf8*) name.c_str());
+			//saveItem->getChild(s.str().append("SaveItemRoot_DecriptionLabel"))->setText(temp);
+
+			n++;
+
+			file.close();
+			
+			delete save;
+			if (data != 0)
+				 delete data;
+        }
+	}
+	
+	CEGUI::String widgetName = CEGUIUtility::getNameForWidget("NewCharButton");
+	CEGUI::PushButton *btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_window, widgetName));
+	if (btn)
+	{
+		btn->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim((height + 2.0f)*n+1)));
+		CEGUIUtility::setWidgetSize (btn, CEGUI::UVector2(cegui_reldim(1.0f), cegui_absdim(height)));
+	}
+}
+
+void SavegameList::selectDefaultSavegame()
+{
+	std::string savegame = Options::getInstance()->getDefaultSavegame();
+	if (savegame != "")
+	{
+		m_document->setSaveFile(savegame.c_str());
+	}
+}
+
+void SavegameList::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	/*
+	CEGUI::Window* label;
+	label = win_mgr.getWindow("SavegameChooseLabel");
+	label->setText((CEGUI::utf8*) gettext("Characters"));*/
+	
+	/*btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("SelectSavegameButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));*/
+	
+	CEGUI::String widgetName (CEGUIUtility::getNameForWidget("NewCharButton"));
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayout(m_window, widgetName));
+
+	//btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindow(widgetName));
+//	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindow("NewCharButton"));
+	if (btn)
+	{
+		btn->setText((CEGUI::utf8*) gettext("Create"));
+	}
+}
+
+
+/**
+* \fn bool onItemButtonHover(const CEGUI::EventArgs& evt)
+* \brief Handle the hovering of a menu item
+*/
+bool SavegameList::onItemButtonHover(const CEGUI::EventArgs& evt)
+{
+	SoundHelper::playAmbientSoundGroup ("main_menu_hover_item");
+	return true;
+}
+
+
+bool SavegameList::onSavegameChosen(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(evt);
+	
+	std::string prefix = we.window->getName().c_str();
+	std::string saveWidgetName = prefix;
+
+	SW_DEBUG ("A character save has been chosen (widget [%s]", prefix.c_str ());
+	prefix.erase(prefix.length()-12, prefix.length());
+
+#ifdef CEGUI_07
+	std::string name = we.window->getChild(prefix.append("SaveItemRoot_Name"))->getText().c_str();
+#else
+	std::string name = we.window->getChild("SaveItemRoot_Name")->getText().c_str();
+#endif
+
+	// Get the file mapped to this widget: if we have a mapping, use the mapped name, otherwise, just add an extension and try to use the same file name as the char name.
+	std::map <std::string, std::string>::const_iterator it = m_fileSaveMapping.find (saveWidgetName);
+	if (it != m_fileSaveMapping.end ())
+	{
+		name = m_fileSaveMapping [saveWidgetName];
+		SW_DEBUG ("got mapping for [%s] as [%s]", saveWidgetName.c_str (), name.c_str ());
+	}
+	else
+	{
+		name.append(".sav");
+	}
+
+	m_document->setSaveFile(name.c_str());
+	DEBUGX("selected Savegame %s", sitm->m_data.c_str());
+
+	// Also play the click sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	return true;
+}
+
+bool SavegameList::onSavegameSelected(const CEGUI::EventArgs& evt)
+{
+	if (m_document->getSaveFile() != "")
+	{
+		SW_DEBUG("savegame accepted %s", m_document->getSaveFile().c_str());
+		m_document->getGUIState()->m_shown_windows = Document::START_MENU;
+		m_document->setModified(Document::WINDOWS_MODIFIED);
+	}
+	return true;
+}
+
+bool SavegameList::onNewCharClicked(const CEGUI::EventArgs& evt)
+{
+	// Also play the click sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	m_document->onCreateNewCharButton();
+	return true;
+}
+
+
+bool SavegameList::onDeleteCharClicked(const CEGUI::EventArgs& evt)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(evt);
+	onSavegameChosen(CEGUI::WindowEventArgs(we.window->getParent()));
+	
+	// Also play the notification sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_notification");
+
+	m_document->showQuestionDialog ();
+
+	return true;
+}
+
+bool SavegameList::onDeleteCharConfirmClicked(const CEGUI::EventArgs& evt)
+{
+	// Also play the click sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	m_document->hideQuestionDialog ();
+
+	// Get the save file to remove.
+	std::string saveFile =  m_document->getSaveFile();
+	if (saveFile.empty())
+	{
+		return false;
+	}
+	
+	// Get rid of the save file
+	remove (saveFile.c_str ());
+
+	// Also get rif od the preview image.
+	// The preview image should have the same name as the save file, but with a different extension.
+	// Using the standard 3 char extension (4 if the "." is included).
+	if (saveFile.length () > 4)
+	{
+		// Parse the name.
+		std::string previewPicture (saveFile);
+		previewPicture.erase (saveFile.length () - 4, saveFile.length());
+		previewPicture.append (".png");
+
+		// Get rid of the file
+		remove (previewPicture.c_str ());
+	}
+
+	// Clear the selection in the menu.
+	if(m_currentSelected != 0)
+	{
+		CEGUIUtility::removeChildWidget (m_currentSelected->getParent (), m_currentSelected);
+		CEGUI::WindowManager::getSingleton().destroyWindow(m_currentSelected);
+		m_currentSelected = 0;
+	}
+	m_document->setSaveFile("");
+	
+	update();
+	return true;
+}
+
+bool SavegameList::onDeleteCharAbortClicked(const CEGUI::EventArgs& evt)
+{
+	// Also play the click sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	m_document->hideQuestionDialog ();
+
+	return true;
+}
+
+bool SavegameList::onSavegameDoubleClick(const CEGUI::EventArgs& evt)
+{
+	// Also play the click sound.
+	SoundHelper::playAmbientSoundGroup ("main_menu_click_item");
+
+	onSavegameSelected(evt);
+	return true;
+}
--- a/src/gui/savegamelist.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/savegamelist.h	Thu Mar 20 19:04:28 2014 +0100
@@ -69,6 +69,12 @@
 		
 	private:
 		/**
+		 * \fn bool onItemButtonHover(const CEGUI::EventArgs& evt)
+		 * \brief Handle the hovering of a menu item
+		 */
+		bool onItemButtonHover(const CEGUI::EventArgs& evt);
+		
+		/**
 		 * \fn bool onSavegameChosen(const CEGUI::EventArgs& evt)
 		 * \brief Handle the selection of a saved game in the list.
 		 */
--- a/src/gui/scene.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/scene.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,1013 +1,1109 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "scene.h"
-
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreTexture.h"
-#include "CEGUI/RendererModules/Ogre/CEGUIOgreResourceProvider.h"
-
-#include "CEGUI/CEGUI.h"
-
-#include "graphicmanager.h"
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-#include "onlineservicesmanager.h"
-#endif
-
-Scene::Scene(Document* doc,Ogre::RenderWindow* window)
-{
-	m_document = doc;
-	m_window = window;
-	m_scene_manager = Ogre::Root::getSingleton().getSceneManager("DefaultSceneManager");
-	GraphicManager::setSceneManager(m_scene_manager);
-	
-	// Kamera anlegen
-	m_camera = m_scene_manager->createCamera("camera");
-	m_camera->setPosition(Ogre::Vector3(0, 30 * GraphicManager::g_global_scale, 30 * GraphicManager::g_global_scale));
-	m_camera->lookAt(Ogre::Vector3(0,0,0));
-	m_camera->setNearClipDistance(0.1*GraphicManager::g_global_scale);
-
-
-	// Viewport anlegen, Hintergrundfarbe schwarz
-	m_viewport = m_window->addViewport(m_camera);
-	m_viewport->setBackgroundColour(Ogre::ColourValue(0,0,0));
-	m_camera->setAspectRatio(Ogre::Real(m_viewport->getActualWidth()) / Ogre::Real(m_viewport->getActualHeight()));
-
-	registerMeshes();
-
-	m_region_id = -1;
-	
-	m_temp_player ="";
-	m_temp_player_object =0;
-
-	// Setup fuer die Minimap
-	Ogre::Camera* minimap_camera=m_scene_manager->createCamera("minimap_camera");
-	minimap_camera->setNearClipDistance(GraphicManager::g_global_scale*10);
-	minimap_camera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
-	minimap_camera->setFOVy(Ogre::Degree(90.0));
-
-	Ogre::TexturePtr minimap_texture = Ogre::TextureManager::getSingleton().createManual( "minimap_tex", "General", Ogre::TEX_TYPE_2D,
-                                                                                          512, 512, 0, Ogre::PF_R8G8B8A8, Ogre::TU_RENDERTARGET );
-
-	Ogre::RenderTarget* minimap_rt = minimap_texture->getBuffer()->getRenderTarget();
-	minimap_rt ->setAutoUpdated(false);
-
-	Ogre::Viewport *v = minimap_rt->addViewport( minimap_camera );
-	v->setClearEveryFrame( true );
-	v->setOverlaysEnabled (false);
-	v->setBackgroundColour(Ogre::ColourValue(0,0,0,0) );
-	float ratio = Ogre::Real(v->getActualWidth()) / Ogre::Real(v->getActualHeight());
-	DEBUGX("render target size %i %i",minimap_rt ->getWidth (), minimap_rt ->getHeight ());
-	DEBUGX("viewport size %i %i ratio %f",v->getActualWidth(),v->getActualHeight(), ratio);
-	minimap_camera->setAspectRatio(ratio);
-
-    // get the OgreRenderer from CEGUI and create a CEGUI texture from the Ogre texture
-    CEGUI::Texture &ceguiTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(minimap_texture);
-  
-	CEGUI::Imageset& textureImageSet = CEGUI::ImagesetManager::getSingleton().create("minimap", ceguiTex);
-
-	textureImageSet.defineImage( "minimap_img",
-				CEGUI::Point( 0.0f, 0.0f ),
-				CEGUI::Size( ceguiTex.getSize().d_width, ceguiTex.getSize().d_height ),
-				CEGUI::Point( 0.0f, 0.0f ) );
-
-	// Setup fuer die Spieleransicht
-
-	Ogre::SceneManager* char_scene_mng = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC,"CharacterSceneManager");
-	char_scene_mng->setAmbientLight(Ogre::ColourValue(1,1,1));
-			
-	Ogre::Camera* char_camera = char_scene_mng->createCamera("char_camera");
-	char_camera->setPosition(Ogre::Vector3(3*GraphicManager::g_global_scale, 1.2*GraphicManager::g_global_scale,0));
-	char_camera->lookAt(Ogre::Vector3(0,1.2*GraphicManager::g_global_scale,0));
-	char_camera->setNearClipDistance(0.1*GraphicManager::g_global_scale);
-			
-	char_camera->setAspectRatio(1.0);
-	
-
-	Ogre::SceneNode *camNode = char_scene_mng->getRootSceneNode()->createChildSceneNode("CharacterCamNode");
-	camNode->attachObject(char_camera);
-			
-	Ogre::TexturePtr char_texture = Ogre::TextureManager::getSingleton().createManual( "character_tex",
-			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
-   512, 512, 0, Ogre::PF_R8G8B8A8, Ogre::TU_RENDERTARGET );
-
-	Ogre::RenderTarget* char_rt = char_texture->getBuffer()->getRenderTarget();
-	char_rt ->setAutoUpdated(false);
-
-
-	Ogre::Viewport *char_view = char_rt->addViewport(char_camera );
-	char_view->setClearEveryFrame( true );
-	char_view->setOverlaysEnabled (false);
-	char_view->setBackgroundColour(Ogre::ColourValue(0,0,0,1.0) );
-	char_rt->update();
-
-	CEGUI::Texture& char_ceguiTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(char_texture);
-
-	CEGUI::Imageset& char_textureImageSet = CEGUI::ImagesetManager::getSingleton().create("character", char_ceguiTex);
-
-	char_textureImageSet.defineImage( "character_img",
-			CEGUI::Point( 0.0f, 0.0f ),
-			CEGUI::Size( char_ceguiTex.getSize().d_width, char_ceguiTex.getSize().d_height ),
-			CEGUI::Point( 0.0f, 0.0f ) );
-	
-	/*
-	Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("RttMat",
-			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
-	mat->getTechnique(0)->getPass(0)->createTextureUnitState("character_tex");
-
-			
-	Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("TextureOverlay");
-	Ogre::PanelOverlayElement* container = (Ogre::PanelOverlayElement*)Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "TextureOverlayPanel");
-	overlay->add2D(container);
-	container->setDimensions(0.4, 0.4);
-	container->setPosition(0.6, 0.6);
-	container->setMaterialName("RttMat");
-	overlay->show();
-*/
-}
-
-Scene::~Scene()
-{
-	clearObjects();
-}
-
-
-void Scene::registerMeshes()
-{
-	// Meshes fuer Objekte registrieren
-	GraphicManager::registerGraphicMapping("gold","gold.mesh");
-
-}
-
-
-GraphicObject* Scene::getGraphicObject(int id)
-{
-	std::map<int,GraphicObject*>::iterator it =  m_graphic_objects.find(id);
-	if (it == m_graphic_objects.end())
-		return 0;
-	return it->second;
-}
-
-std::pair<float,float> Scene::getProjection(Vector pos, float height)
-{
-	Ogre::Vector4 ipos(pos.m_x*GraphicManager::g_global_scale,
-					   height*GraphicManager::g_global_scale,
-					   pos.m_y*GraphicManager::g_global_scale,1);
-	Ogre::Vector4 projpos;
-	projpos = m_camera->getProjectionMatrix()*m_camera->getViewMatrix()*ipos;
-
-	return std::make_pair(0.5 + 0.5*projpos.x / projpos.w, 0.5 - 0.5*projpos.y / projpos.w);
-}
-
-
-GraphicObject* Scene::createGraphicObject(GameObject* gobj, std::string name)
-{
-	// Typ des GraphicObjekts ermitteln
-	if (name=="")
-	{
-		name = gobj->getNameId();
-	}
-	std::string otype;
-	Player* pl = dynamic_cast<Player*>(gobj);
-	GraphicObject::Type type;
-	if (pl != 0 )
-	{
-		type = pl->getPlayerLook().m_render_info;
-	}
-	else if (gobj->getType() == "SCRIPTOBJECT")
-	{
-		type = static_cast<ScriptObject*>(gobj)->getRenderInfo();
-	}
-	else
-	{
-		otype = gobj->getSubtype();
-		type = GraphicManager::getGraphicType(otype);
-	}
-	
-	
-	
-	// GraphicObjekt erstellen und ausgeben
-	if (type == "")
-	{
-		return 0;
-	}
-	else
-	{
-		DEBUGX("create graphic Object typ %s for %s",type.c_str(), otype.c_str());
-		return GraphicManager::createGraphicObject(type,name, gobj->getId());
-	}
-}
-
-
-void Scene::update(float ms)
-{
-	DEBUGX("update scene");
-
-	// Spielerobjekt
-	Player* player = m_document->getLocalPlayer();
-
-	if (player ==0)
-		return;
-
-	updateCharacterView();
-
-	if (player->getRegion() ==0)
-		return;
-
-	// Nummer der region in der sich der Spieler befindet
-	short region_nr = player->getRegionId();
-	Region* region = player->getRegion();
-
-	if (region_nr != m_region_id)
-	{
-		// Spieler hat eine neue Region betreten
-		if (player->getState() == WorldObject::STATE_ACTIVE)
-		{
-			// Szene komplett neu aufbauen
-			createScene();
-
-			m_document->setModified(m_document->getModified() & ~Document::REGION_MODIFIED);
-
-			m_region_id = region_nr;
-
-		}
-		else
-		{
-			// Spieler ist der Region noch nicht aktiviert
-			return;
-		}
-	}
-
-	// Koordinaten des Spielers
-	Vector pos = player->getShape()->m_center;
-
-	// Kamera auf Spieler ausrichten
-	float r= player->getCamera().m_distance*GraphicManager::g_global_scale;
-	float theta = player->getCamera().m_theta * 3.14159 / 180;
-	float phi = player->getCamera().m_phi * 3.14159 / 180;
-
-	if (player->getRegion()->getCutsceneMode())
-	{
-		RegionCamera::Position& cam =player->getRegion()->getCamera().m_position;
-		pos = cam.m_focus;
-		r = cam.m_distance*GraphicManager::g_global_scale;
-		phi = cam.m_phi* 3.14159 / 180;
-		theta = cam.m_theta* 3.14159 / 180;
-	}
-
-	m_camera->setPosition(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale + r*cos(theta)*cos(phi), r*sin(theta), pos.m_y*GraphicManager::g_global_scale - r*cos(theta)*sin(phi)));
-	m_camera->lookAt(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale,
-								   1.4*GraphicManager::g_global_scale,
-								   pos.m_y*GraphicManager::g_global_scale));
-	DEBUGX("cam position %f %f %f",pos.m_x*GraphicManager::g_global_scale + r*cos(theta)*cos(phi), r*sin(theta), pos.m_y*GraphicManager::g_global_scale - r*cos(theta)*sin(phi));
-
-	SoundSystem::setListenerPosition(pos);
-	
-	// Licht aktualisieren
-	float *colour;
-	Ogre::Light* light;
-	light= m_scene_manager->getLight("HeroLight");
-	light->setPosition(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale,
-									 6*GraphicManager::g_global_scale,
-									 pos.m_y*GraphicManager::g_global_scale));
-	colour= region->getLight().getHeroLight();
-	light->setDiffuseColour(colour[0], colour[1], colour[2]);
-	
-    
-    colour= region->getLight().getDirectionalLight();
-	light = m_scene_manager->getLight("RegionLight");
-	light->setDiffuseColour(colour[0], colour[1], colour[2]);
-	light->setSpecularColour(colour[0], colour[1], colour[2]);
-	
-	colour= region->getLight().getAmbientLight();
-	m_scene_manager->setAmbientLight(Ogre::ColourValue(colour[0], colour[1], colour[2]));
-	
-	updateGraphicObjects(ms);
-}
-
-void  Scene::insertObject(GameObject* gobj, bool is_static)
-{
-	GraphicObject* obj
-
-	DEBUGX("insert graphic object for %s",gobj->getNameId().c_str());
-	if (is_static)
-	{
-		
-		// Object placement
-		float x=gobj->getShape()->m_center.m_x;
-		float z=gobj->getShape()->m_center.m_y;
-		float y = gobj->getHeight();
-		Ogre::Vector3 vec(x*GraphicManager::g_global_scale,y*GraphicManager::g_global_scale,z*GraphicManager::g_global_scale);
-			
-		// Object rotation
-		float angle = gobj->getShape()->m_angle;
-		
-		std::string otype = gobj->getSubtype();
-		GraphicObject::Type type = GraphicManager::getGraphicType(otype);
-		GraphicManager::insertStaticGraphicObject(type,vec,angle);
-		return;
-	}
-	else
-	{
-		obj = createGraphicObject(gobj);
-		m_graphic_objects.insert(std::make_pair(gobj->getId(), obj));
-	}
-	
-	
-	if (obj != 0)
-	{	
-		Ogre::SceneNode* node = obj->getTopNode();
-		
-		// Monster zufaellig skalieren
-		if (gobj->getType() == "MONSTER")
-		{
-			float scale = 0.9 + 0.2*Random::random();
-			node->setScale(scale,scale,scale);
-		
-		}
-		
-		if (gobj->getType() == "PLAYER")
-		{
-			obj->setExactAnimations(true);
-		}
-		
-		if (gobj->getBaseType() == GameObject::WORLDOBJECT)
-		{
-			if (gobj->getState() == WorldObject::STATE_ACTIVE)
-			{
-				obj->setQueryMask(WORLDOBJECT);
-			}
-		}
-		else if (gobj->getBaseType() == GameObject::DROPITEM)
-		{
-			obj->setQueryMask(ITEM);
-		}
-		
-		updateGraphicObject(obj,gobj,0.0);
-	}
-}
-
-void Scene::updateGraphicObject(GraphicObject* obj, GameObject* gobj,float time)
-{
-	if (obj ==0 || gobj==0)
-		return;
-	
-	Ogre::SceneNode* node = obj->getTopNode();
-	
-	// Objektes positionieren
-	float x=gobj->getShape()->m_center.m_x;
-	float z=gobj->getShape()->m_center.m_y;
-	float y = gobj->getHeight();
-	Ogre::Vector3 vec(x*GraphicManager::g_global_scale,y*GraphicManager::g_global_scale,z*GraphicManager::g_global_scale);
-	node->setPosition(vec);
-		
-	// Objekt drehen
-	float angle = gobj->getShape()->m_angle;
-	//node->setDirection(sin(angle),0,-cos(angle),Ogre::Node::TS_WORLD);
-	node->setOrientation(1,0,0,0);
-	node->yaw(Ogre::Radian(-angle));
-	
-	DropItem* di = dynamic_cast<DropItem*>(gobj);
-	if (di != 0)
-	{
-		float anglex = di->getAngleX();
-		node->pitch(Ogre::Radian(anglex));
-	}
-	
-	// Aktion setzen
-	std::string action = gobj->getActionString();
-	float perc = gobj->getActionPercent();
-
-	Player* pl = dynamic_cast<Player*>(gobj);
-	if (pl != 0)
-	{
-		updatePlayerGraphicObject(obj,pl);
-	}
-	
-	obj->updateAction(action,perc);
-	DEBUGX("object %s action %s perc %f",gobj->getNameId().c_str(), action.c_str(), perc);
-	
-	// Zustaende aktualisieren
-	std::set<std::string> flags;
-	gobj->getFlags(flags);
-	if (pl != 0)
-	{
-		std::set<std::string> flags_suffix;
-		
-		std::string suffix = pl->getActionWeaponSuffix();
-		std::set<std::string>::iterator it;
-		std::string tmp;
-		for (it = flags.begin(); it !=flags.end(); ++it)
-		{
-			tmp = (*it);
-			tmp += suffix;
-			flags_suffix.insert(tmp);
-		}
-		obj->updateAllStates(flags_suffix);
-	}
-	else
-	{
-		obj->updateAllStates(flags);
-	}
-	
-	
-	obj->update(time);
-}
-
-bool Scene::updatePlayerGraphicObject(GraphicObject* obj, Player* pl)
-{	
-	MovableObjectInfo minfo;
-	bool update = false;
-	
-	std::stringstream stream;
-	
-	// Waffe
-	stream.str("");
-	stream << "weapon:"<<pl->getId();
-	minfo.m_objectname= stream.str();
-	minfo.m_type = MovableObjectInfo::SUBOBJECT;
-	
-	std::string& suffix = pl->getPlayerLook().m_item_suffix;
-	
-	Item* itm;
-	itm = pl->getWeapon();
-	if (itm !=0 && itm->m_weapon_attr !=0)
-	{
-		if (itm->m_weapon_attr->m_weapon_type == "bow" || itm->m_weapon_attr->m_weapon_type == "crossbow")
-		{
-			minfo.m_bone = "itemLeftHand";
-		}
-		else
-		{
-			minfo.m_bone = "itemRightHand";
-		}
-		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
-		if (minfo.m_source.find(".mesh") == std::string::npos)
-			minfo.m_source += suffix;
-	}
-	else
-	{
-		minfo.m_source="";
-	}
-	update |= obj->updateSubobject(minfo);
-	
-	// Schild
-	stream.str("");
-	stream << "shield:"<<pl->getId();
-	minfo.m_objectname= stream.str();
-	minfo.m_type = MovableObjectInfo::SUBOBJECT;
-	itm = pl->getShield();
-	if (itm !=0)
-	{
-		minfo.m_bone = "itemLeftHand";
-		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
-		if (minfo.m_source.find(".mesh") == std::string::npos)
-			minfo.m_source += suffix;
-	}
-	else
-	{
-		minfo.m_source="";
-	}
-	update |= obj->updateSubobject(minfo);
-	
-	DEBUGX("update %s : bone %s source %s", minfo.m_objectname.c_str(), minfo.m_bone.c_str(), minfo.m_source.c_str());
-	
-	// Handschuhe
-	stream.str("");
-	stream << "gloves:"<<pl->getId();
-	minfo.m_objectname= stream.str();
-	minfo.m_type = MovableObjectInfo::SUBOBJECT;
-	itm = pl->getEquipement()->getItem(Equipement::GLOVES);
-	
-	if (itm !=0)
-	{
-		std::string type = itm->m_subtype;
-		
-		minfo.m_bone = "";
-		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
-		if (minfo.m_source.find(".mesh") == std::string::npos)
-			minfo.m_source += suffix;
-	}
-	else
-	{
-		minfo.m_source="";
-	}
-	update |= obj->updateSubobject(minfo);
-	
-	// Helm
-	stream.str("");
-	stream << "helmet:"<<pl->getId();
-	minfo.m_objectname= stream.str();
-	minfo.m_type = MovableObjectInfo::SUBOBJECT;
-	itm = pl->getEquipement()->getItem(Equipement::HELMET);
-	minfo.m_bone = "crown";
-	
-	if (itm !=0)
-	{
-		std::string type = itm->m_subtype;
-		
-		
-		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
-		if (minfo.m_source.find(".mesh") == std::string::npos)
-			minfo.m_source += suffix;
-	}
-	else
-	{
-		minfo.m_source= pl->getPlayerLook().m_hair;
-	}
-	update |= obj->updateSubobject(minfo);
-	
-	// Ruestung
-	stream.str("");
-	stream << "armor:"<<pl->getId();
-	minfo.m_objectname= stream.str();
-	minfo.m_type = MovableObjectInfo::SUBOBJECT;
-	itm = pl->getEquipement()->getItem(Equipement::ARMOR);
-	
-	if (itm !=0)
-	{
-		std::string type = itm->m_subtype;
-		
-		minfo.m_bone = "";
-		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
-		if (minfo.m_source.find(".mesh") == std::string::npos)
-			minfo.m_source += suffix;
-
-	}
-	else
-	{
-		minfo.m_source="";
-	}
-	update |= obj->updateSubobject(minfo);
-	
-	return update;
-}
-
-void  Scene::deleteGraphicObject(int id)
-{
-	std::map<int,GraphicObject*>::iterator it;
-	it = m_graphic_objects.find(id);
-	if (it != m_graphic_objects.end())
-	{
-		GraphicManager::destroyGraphicObject(it->second);
-		m_graphic_objects.erase(id);
-	}
-}
-
-void Scene::updateGraphicObjects(float time)
-{
-	Player* player = m_document->getLocalPlayer();
-	GameObjectMap& game_objs = player->getRegion()->getGameObjects();
-	
-	GameObjectMap::iterator it = game_objs.begin();
-	std::map<int,GraphicObject*>::iterator jtold, jt = m_graphic_objects.begin();
-	
-	while (it != game_objs.end() || jt != m_graphic_objects.end())
-	{
-		if (it == game_objs.end() || (jt != m_graphic_objects.end() && it->first > jt->first))
-		{
-			// Objekt jt existiert als Graphisch, aber nicht mehr im Spiel
-			DEBUGX("deleting graphic object %i",jt->first);
-			jtold = jt;
-			++jt;
-			
-			deleteGraphicObject(jtold->first);
-		}
-		else if (jt == m_graphic_objects.end() || (it != game_objs.end() && it->first < jt->first))
-		{
-			// Objekt it existiert im Spiel, aber noch nicht graphisch
-			DEBUGX("inserting graphic object %i",it->first);	
-			if (it->second->getLayer() != GameObject::LAYER_SPECIAL)
-			{
-				insertObject(it->second,false);
-			}
-			
-			++it;
-		}
-		else if (it->first == jt->first)
-		{
-			// GraphikObjekt aktualisieren
-			DEBUGX("update graphic objekt %i",it->first);
-			updateGraphicObject(jt->second, it->second,time);
-			++it;
-			++jt;
-		}
-		else
-		{
-			ERRORMSG("Fehler beim Abgleich Graphik <-> ingame");
-		}
-	}
-	
-}
-
-
-void Scene::updateCharacterView()
-{
-	bool update = false;
-	
-	Ogre::SceneManager* scene_mgr = Ogre::Root::getSingleton().getSceneManager("CharacterSceneManager");
-	GraphicManager::setSceneManager(scene_mgr);
-	
-	Player* pl = m_document->getLocalPlayer();
-
-	if ((pl ==0 && m_temp_player!=""))
-	{
-		DEBUG("deleting inv player");
-		m_temp_player="";
-		GraphicManager::destroyGraphicObject(m_temp_player_object);
-		m_temp_player_object =0;
-		update = true;
-	}
-
-	if (pl !=0)
-	{
-		std::string correctname = pl->getNameId();
-		correctname += pl->getPlayerLook().m_render_info;
-		
-		if ((correctname != m_temp_player))
-		{
-			DEBUGX("updating inv player %s to %s",m_temp_player.c_str(), correctname.c_str());
-			GraphicManager::destroyGraphicObject(m_temp_player_object);
-			m_temp_player_object =0;
-			update = true;
-		}
-		
-		m_temp_player = correctname;
-		
-		if (m_temp_player_object ==0)
-		{
-			update = true;
-			m_temp_player_object = createGraphicObject(pl,"tempplayer");
-			m_temp_player_object->setExactAnimations(true);
-		}
-		
-		update |= updatePlayerGraphicObject(m_temp_player_object,pl);
-	}	
-	
-	if (update)
-	{
-		if (m_temp_player_object !=0)
-		{
-			// aktion temporaer fuer den Renderaufruf auf noaction setzen
-			Action actsave = *(pl->getAction());
-			Action tmpact("noaction");
-			std::string act = pl->getActionString();
-#if 0
-			// Commented out functionality to allow fix of Mantis ID:0000075 (http://sumwars.org/mantis/view.php?id=75)
-
-			pl->setAction(tmpact);
-			act = pl->getActionString();
-			DEBUG ("Current action string after is: %s", act.c_str ());
-#endif
-			m_temp_player_object->updateAction(act,0.5);
-			m_temp_player_object->update(0);
-			
-			pl->setAction(actsave);
-		}
-		
-		Ogre::Resource* res= Ogre::TextureManager::getSingleton().createOrRetrieve ("character_tex",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).first.getPointer();
-		Ogre::Texture* texture = dynamic_cast<Ogre::Texture*>(res);
-		Ogre::RenderTarget* target = texture->getBuffer()->getRenderTarget();
-	
-	
-		target->update();
-		
-		// update character icon
-		if (pl !=0)
-		{
-			Ogre::Image img;
-			texture->convertToImage(img);
-			std::string saveFile =  this->m_document->getSaveFile();
-			if(saveFile != "")
-			{
-				saveFile.erase(saveFile.length()-4, saveFile.length());
-				img.resize(256, 256);
-				img.save(saveFile.append(".png"));
-
-#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
-                if(OnlineServicesManager::getSingleton().userLoggedIn())
-                {
-                    Ogre::DataStreamPtr ptr = img.encode("png");
-                    OnlineServicesManager::getSingleton().syncCharacterAvatar(pl->getName().getRawText(), saveFile, ptr);
-                }
-#endif
-
-
-			}
-		}
-		DEBUGX("player image is now %s",m_temp_player.c_str());
-	}
-	
-	GraphicManager::setSceneManager(m_scene_manager);
-	
-}
-
-
-void Scene::clearObjects()
-{
-	std::map<int,GraphicObject*>::iterator it;
-	
-	for (it = m_graphic_objects.begin(); it != m_graphic_objects.end(); ++it)
-	{
-		GraphicManager::destroyGraphicObject(it->second);
-	}
-	m_graphic_objects.clear();
-}
-
-void Scene::createScene()
-{
-	DEBUGX("create Scene");
-
-	// alle bisherigen Objekte aus der Szene loeschen
-	clearObjects();
-	
-	GraphicManager::destroyGraphicObject(m_temp_player_object);
-	m_temp_player_object =0;
-	m_temp_player="";
-	SoundSystem::clearObjects();
-	
-	GraphicManager::clearStaticGeometry();
-	GraphicManager::clearParticlePool();
-
-	m_scene_manager->clearScene();
-	
-	updateCharacterView();
-	
-	// Liste der statischen Objekte
-	Ogre::StaticGeometry* static_geom = m_scene_manager->createStaticGeometry ("StaticGeometry");
-
-	std::list<WorldObject*> stat_objs;
-
-	Region* region = m_document->getLocalPlayer()->getRegion();
-
-	Ogre::Light *light = m_scene_manager->createLight("HeroLight");
-	light->setType(Ogre::Light::LT_POINT);
-	light->setSpecularColour(0.0, 0.0, 0.0);
-	light->setAttenuation(20*GraphicManager::g_global_scale,0.5,0.000,
-						  0.025/(GraphicManager::g_global_scale*GraphicManager::g_global_scale));
-	if (region)
-	{
-		const float* colour = region->getLight().getHeroLight();
-		light->setDiffuseColour(colour[0], colour[1], colour[2]);
-		DEBUGX("hero light %f %f %f",colour[0], colour[1], colour[2]);
-	}
-
-#ifndef DONT_USE_SHADOWS
-	light->setCastShadows (false);
-	// Augustin Preda, 2011.11.15: set to disabled.
-#endif // DONT_USE_SHADOWS
-    
-    light = m_scene_manager->createLight("RegionLight");
-	light->setType(Ogre::Light::LT_DIRECTIONAL);
-	light->setDirection(Ogre::Vector3(-1,-1,-1));
-	if (region)
-	{
-		const float* colour = region->getLight().getDirectionalLight();
-		light->setDiffuseColour(colour[0], colour[1], colour[2]);
-		light->setSpecularColour(colour[0], colour[1], colour[2]);
-	}
-
-#ifndef DONT_USE_SHADOWS
-    light->setCastShadows (true);
-#endif // DONT_USE_SHADOWS
-
-	DEBUGX("directional light %f %f %f",colour[0], colour[1], colour[2]);
-
-	if (region)
-	{
-		const WorldObjectMap& stat_objs = region->getStaticObjects();
-		for (WorldObjectMap::const_iterator it = stat_objs.begin(); it !=stat_objs.end(); ++it)
-		{
-			// Objekt in der Szene erzeugen
-			insertObject(it->second,true);
-		}
-		GraphicManager::buildStaticGeometry();
-
-		short dimx = region->getDimX();
-		short dimy = region->getDimY();
-		Ogre::Camera* minimap_camera=m_scene_manager->getCamera("minimap_camera");
-		DEBUGX("camera pos %i %i %i",dimx*GraphicManager::g_global_scale*2,
-			   std::max(dimx,dimy)*GraphicManager::g_global_scale*6,
-			   dimy*GraphicManager::g_global_scale*2);
-		minimap_camera->setPosition(Ogre::Vector3(dimx*GraphicManager::g_global_scale*2,
-												  MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4,
-												  dimy*GraphicManager::g_global_scale*2+1));
-		minimap_camera->lookAt(Ogre::Vector3(dimx*GraphicManager::g_global_scale*2,0,dimy*GraphicManager::g_global_scale*2));
-#if (OGRE_VERSION >= ((1 << 16) | (6 << 8)))
-			// >= Ogre 1.6
-
-			minimap_camera->setOrthoWindow(MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4, MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4);
-#else
-
-			minimap_camera->setNearClipDistance(MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*2);
-#endif
-		Ogre::Resource* res= Ogre::TextureManager::getSingleton().createOrRetrieve ("minimap_tex",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).first.getPointer();
-		Ogre::Texture* texture = dynamic_cast<Ogre::Texture*>(res);
-		Ogre::RenderTarget* target = texture->getBuffer()->getRenderTarget();
-
-		//m_minimap_camera->setPosition(Ogre::Vector3(6600,1000,11400));
-		//m_minimap_camera->lookAt(Ogre::Vector3(6600,0,11380));
-		//Ogre::Vector3 up = m_minimap_camera->getUp();
-		//m_minimap_camera->setFrustumExtents (0,dimx*200,0,dimy*200);
-		//DEBUG("camera up %f %f %f",up.x, up.y, up.z);
-
-        m_scene_manager->setAmbientLight(Ogre::ColourValue(1.0f,1.0f,1.0f));
-        
-		// Boden erstellen
-		if (region->getGroundMaterial() != "")
-		{
-			std::stringstream stream;
-			short dimx = region->getDimX();
-			short dimy = region->getDimY();
-			Ogre::Entity* ground;
-			ground = m_scene_manager->createEntity(stream.str(), "ground");
-			ground->setMaterialName(region->getGroundMaterial());
-			ground->setCastShadows(false);
-			ground->setQueryFlags(0);
-			
-			for (int i=0; i< dimx; ++i)
-			{
-				for (int j=0; j<dimy; ++j)
-				{
-					Ogre::Vector3 pos(i*GraphicManager::g_global_scale*4+GraphicManager::g_global_scale*2,0,j*GraphicManager::g_global_scale*4+GraphicManager::g_global_scale*2);
-					// This scales entity to the right size unit meshes are scaled
-					Ogre::Vector3 scale(GraphicManager::g_global_scale/50, GraphicManager::g_global_scale/50, GraphicManager::g_global_scale/50);
-					
-					static_geom->addEntity(ground, pos, Ogre::Quaternion::IDENTITY, scale);
-				}
-			}
-		}
-		static_geom->build();
-		
-		m_scene_manager->setAmbientLight(Ogre::ColourValue(0.4,0.4,0.4));
-		target->update();
-
-		const float* colour = region->getLight().getAmbientLight();
-		m_scene_manager->setAmbientLight(Ogre::ColourValue(colour[0], colour[1], colour[2]));
-		DEBUGX("ambient light %f %f %f",colour[0], colour[1], colour[2]);
-		//m_scene_manager->setAmbientLight(Ogre::ColourValue(0.0,0.0,0.0));
-	}
-}
-
-void Scene::getMeshInformation(const Ogre::MeshPtr mesh, size_t &vertex_count, Ogre::Vector3* &vertices,  size_t &index_count,
-							unsigned long* &indices,  const Ogre::Vector3 &position,  const Ogre::Quaternion &orient,  const Ogre::Vector3 &scale)
-{
-	bool added_shared = false;
-	size_t current_offset = 0;
-	size_t shared_offset = 0;
-	size_t next_offset = 0;
-	size_t index_offset = 0;
-
-	vertex_count = index_count = 0;
-
-    // Calculate how many vertices and indices we're going to need
-	for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
-	{
-		Ogre::SubMesh* submesh = mesh->getSubMesh( i );
-
-        // We only need to add the shared vertices once
-		if(submesh->useSharedVertices)
-		{
-			if( !added_shared )
-			{
-				vertex_count += mesh->sharedVertexData->vertexCount;
-				added_shared = true;
-			}
-		}
-		else
-		{
-			vertex_count += submesh->vertexData->vertexCount;
-		}
-
-        // Add the indices
-		index_count += submesh->indexData->indexCount;
-	}
-
-
-    // Allocate space for the vertices and indices
-	vertices = new Ogre::Vector3[vertex_count];
-	indices = new unsigned long[index_count];
-	for (size_t i=0; i<index_count; i++)
-	{
-		indices[i] = 0;
-	}
-	
-	added_shared = false;
-
-    // Run through the submeshes again, adding the data into the arrays
-	for ( unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
-	{
-		Ogre::SubMesh* submesh = mesh->getSubMesh(i);
-
-		Ogre::VertexData* vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;
-
-		if((!submesh->useSharedVertices)||(submesh->useSharedVertices && !added_shared))
-		{
-			if(submesh->useSharedVertices)
-			{
-				added_shared = true;
-				shared_offset = current_offset;
-			}
-
-			const Ogre::VertexElement* posElem =
-					vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
-
-			Ogre::HardwareVertexBufferSharedPtr vbuf =
-					vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
-
-			unsigned char* vertex =
-					static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
-
-            // There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double
-            //  as second argument. So make it float, to avoid trouble when Ogre::Real will
-            //  be comiled/typedefed as double:
-            //      Ogre::Real* pReal;
-			float* pReal;
-
-			for( size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
-			{
-				posElem->baseVertexPointerToElement(vertex, &pReal);
-
-				Ogre::Vector3 pt(pReal[0], pReal[1], pReal[2]);
-
-				vertices[current_offset + j] = (orient * (pt * scale)) + position;
-			}
-
-			vbuf->unlock();
-			next_offset += vertex_data->vertexCount;
-		}
-
-
-		Ogre::IndexData* index_data = submesh->indexData;
-		
-		size_t numTris = index_data->indexCount / 3;
-		Ogre::HardwareIndexBufferSharedPtr ibuf = index_data->indexBuffer;
-
-		bool use32bitindexes = (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT);
-
-		unsigned long*  pLong = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
-		unsigned short* pShort = reinterpret_cast<unsigned short*>(pLong);
-
-
-		size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
-
-		if ( use32bitindexes )
-		{
-			for ( size_t k = 0; k < numTris*3; ++k)
-			{
-				indices[index_offset] = pLong[k] + static_cast<unsigned long>(offset);
-				if (indices[index_offset] <0 || indices[index_offset] >= vertex_count)
-				{
-					DEBUG("-----------------------------");
-					DEBUG("illegal index %i at pos %i",indices[index_offset], offset);
-					DEBUG("submesh %i  triangle %i", i,k);
-					DEBUG("vertex count %i  index count %i",vertex_count, index_count);
-					DEBUG("32bit index %i  shared %i",use32bitindexes, submesh->useSharedVertices);
-				}
-				index_offset++;
-			}
-		}
-		else
-		{
-			for ( size_t k = 0; k < numTris*3; ++k)
-			{
-				indices[index_offset] = static_cast<unsigned long>(pShort[k]) +
-						static_cast<unsigned long>(offset);
-						if (indices[index_offset] <0 || indices[index_offset] >= vertex_count)
-						{
-							DEBUG("illegal index %i at pos %i",indices[index_offset], index_offset);
-							DEBUG("submesh %i  triangle %i", i,k);
-							DEBUG("vertex count %i  index count %i",vertex_count, index_count);
-							DEBUG("32bit index %i  shared %i",use32bitindexes, submesh->useSharedVertices);
-						}
-				index_offset++;
-			}
-		}
-
-		ibuf->unlock();
-		current_offset = next_offset;
-	}
-	
-	if (index_offset != index_count)
-	{
-		ERRORMSG("Index offset %i is not index count %i",index_offset,index_count);
-	}
-	
-	if (current_offset != vertex_count)
-	{
-		ERRORMSG("vertex offset %i is not vertex count %i",current_offset,vertex_count);
-	}
-} 
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "scene.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+// needed to be able to create the CEGUI renderer interface
+#ifdef CEGUI_07
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h"
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreTexture.h"
+#include "CEGUI/RendererModules/Ogre/CEGUIOgreResourceProvider.h"
+#else
+#include "CEGUI/RendererModules/Ogre/Renderer.h"
+#include "CEGUI/RendererModules/Ogre/Texture.h"
+#include "CEGUI/RendererModules/Ogre/ResourceProvider.h"
+#endif
+
+#include "CEGUI/CEGUI.h"
+
+#include "graphicmanager.h"
+
+#include "soundhelper.h"
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+#include "onlineservicesmanager.h"
+#endif
+// Sound and music management classes.
+#include "gussound.h"
+using gussound::SoundManager;
+
+#include "gopenal.h"
+
+Scene::Scene(Document* doc,Ogre::RenderWindow* window)
+{
+	m_document = doc;
+	m_window = window;
+	m_scene_manager = Ogre::Root::getSingleton().getSceneManager("DefaultSceneManager");
+	GraphicManager::setSceneManager(m_scene_manager);
+	
+	// Kamera anlegen
+	m_camera = m_scene_manager->createCamera("camera");
+	m_camera->setPosition(Ogre::Vector3(0, 30 * GraphicManager::g_global_scale, 30 * GraphicManager::g_global_scale));
+	m_camera->lookAt(Ogre::Vector3(0,0,0));
+	m_camera->setNearClipDistance(0.1*GraphicManager::g_global_scale);
+
+
+	// Viewport anlegen, Hintergrundfarbe schwarz
+	m_viewport = m_window->addViewport(m_camera);
+	m_viewport->setBackgroundColour(Ogre::ColourValue(0,0,0));
+	m_camera->setAspectRatio(Ogre::Real(m_viewport->getActualWidth()) / Ogre::Real(m_viewport->getActualHeight()));
+
+	registerMeshes();
+
+	m_region_id = -1;
+	
+	m_temp_player ="";
+	m_temp_player_object =0;
+
+	// Setup fuer die Minimap
+	Ogre::Camera* minimap_camera=m_scene_manager->createCamera("minimap_camera");
+	minimap_camera->setNearClipDistance(GraphicManager::g_global_scale*10);
+	minimap_camera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
+	minimap_camera->setFOVy(Ogre::Degree(90.0));
+
+	Ogre::TexturePtr minimap_texture = 
+		Ogre::TextureManager::getSingleton ().createManual ("minimap_tex"
+				, "General"
+				, Ogre::TEX_TYPE_2D
+				, 512
+				, 512
+				, 0
+				, Ogre::PF_R8G8B8A8
+				, Ogre::TU_RENDERTARGET );
+
+	Ogre::RenderTarget* minimap_rt = minimap_texture->getBuffer()->getRenderTarget();
+	minimap_rt ->setAutoUpdated (false);
+
+	Ogre::Viewport *v = minimap_rt->addViewport( minimap_camera );
+	v->setClearEveryFrame( true );
+	v->setOverlaysEnabled (false);
+	v->setBackgroundColour(Ogre::ColourValue(0,0,0,0) );
+	float ratio = Ogre::Real(v->getActualWidth()) / Ogre::Real(v->getActualHeight());
+	DEBUGX("render target size %i %i",minimap_rt ->getWidth (), minimap_rt ->getHeight ());
+	DEBUGX("viewport size %i %i ratio %f",v->getActualWidth(),v->getActualHeight(), ratio);
+	minimap_camera->setAspectRatio(ratio);
+
+	minimap_rt->update ();
+
+	// get the OgreRenderer from CEGUI and create a CEGUI texture from the Ogre texture
+	CEGUI::OgreRenderer* rendererPtr = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer());
+	
+#ifdef CEGUI_07
+	CEGUI::Texture &ceguiTex = rendererPtr->createTexture(minimap_texture);
+
+	CEGUI::Imageset& textureImageSet = CEGUI::ImagesetManager::getSingleton().create("minimap", ceguiTex);
+
+	textureImageSet.defineImage( "minimap_img",
+				CEGUIUtility::Vector2f (0.0f, 0.0f),
+				CEGUIUtility::Size (ceguiTex.getSize ().d_width, ceguiTex.getSize ().d_height ),
+				CEGUIUtility::Vector2f (0.0f, 0.0f) );
+#else
+	CEGUI::Texture &ceguiTex = rendererPtr->createTexture (minimap_texture->getName (), minimap_texture);
+	{
+		CEGUI::String imageName("minimap_img");
+		CEGUI::TextureTarget*   d_textureTarget;
+		CEGUI::BasicImage*      d_textureTargetImage;
+		d_textureTarget = rendererPtr->createTextureTarget();
+		d_textureTargetImage = static_cast<CEGUI::BasicImage*>(&CEGUI::ImageManager::getSingleton().create("BasicImage", imageName));
+		d_textureTargetImage->setTexture(&ceguiTex);
+		d_textureTargetImage->setArea(CEGUI::Rectf(0, 0, ceguiTex.getSize ().d_width,ceguiTex.getSize ().d_height));
+	}
+#endif
+
+	// Setup for the player's view
+
+	Ogre::SceneManager* char_scene_mng = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC,"CharacterSceneManager");
+	char_scene_mng->setAmbientLight(Ogre::ColourValue(1,1,1));
+			
+	Ogre::Camera* char_camera = char_scene_mng->createCamera("char_camera");
+	char_camera->setPosition(Ogre::Vector3(3*GraphicManager::g_global_scale, 1.2*GraphicManager::g_global_scale,0));
+	char_camera->lookAt(Ogre::Vector3(0,1.2*GraphicManager::g_global_scale,0));
+	char_camera->setNearClipDistance(0.1*GraphicManager::g_global_scale);
+			
+	char_camera->setAspectRatio(1.0);
+	
+
+	Ogre::SceneNode *camNode = char_scene_mng->getRootSceneNode()->createChildSceneNode("CharacterCamNode");
+	camNode->attachObject(char_camera);
+			
+	Ogre::TexturePtr char_texture = Ogre::TextureManager::getSingleton().createManual( "character_tex",
+			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
+   512, 512, 0, Ogre::PF_R8G8B8A8, Ogre::TU_RENDERTARGET );
+
+	Ogre::RenderTarget* char_rt = char_texture->getBuffer()->getRenderTarget();
+	char_rt ->setAutoUpdated(false);
+
+
+	Ogre::Viewport *char_view = char_rt->addViewport(char_camera );
+	char_view->setClearEveryFrame( true );
+	char_view->setOverlaysEnabled (false);
+	char_view->setBackgroundColour(Ogre::ColourValue(0,0,0,1.0) );
+	char_rt->update();
+
+
+	// Create a CEGUI texture, based on the Ogre Texture object [char_texture]
+	// Create a CEGUI image using this CEGUI texture. Name it "character_img".
+#ifdef CEGUI_07
+	CEGUI::Texture& char_ceguiTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(char_texture);
+	CEGUI::Imageset& char_textureImageSet = CEGUI::ImagesetManager::getSingleton().create("character", char_ceguiTex);
+
+	char_textureImageSet.defineImage ("character_img",
+			CEGUIUtility::Vector2f ( 0.0f, 0.0f ),
+			CEGUI::Size( char_ceguiTex.getSize().d_width, char_ceguiTex.getSize().d_height ),
+			CEGUIUtility::Vector2f (0.0f, 0.0f) );
+#else
+	{
+		CEGUI::OgreRenderer* myRenderer = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer());
+		CEGUI::Texture& char_ceguiTex = myRenderer->createTexture ("character", char_texture);
+		CEGUI::BasicImage*      d_textureTargetImage;
+	    CEGUI::TextureTarget*   d_textureTarget;
+		d_textureTarget = myRenderer->createTextureTarget();
+		CEGUI::String imageName("character_img");
+		d_textureTargetImage = static_cast<CEGUI::BasicImage*>(&CEGUI::ImageManager::getSingleton().create("BasicImage", imageName));
+		d_textureTargetImage->setTexture(&char_ceguiTex);
+		d_textureTargetImage->setArea(CEGUI::Rectf(0, 0, char_ceguiTex.getSize ().d_width, char_ceguiTex.getSize ().d_height));
+	}
+#endif	
+	/*
+	Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("RttMat",
+			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+	mat->getTechnique(0)->getPass(0)->createTextureUnitState("character_tex");
+
+			
+	Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("TextureOverlay");
+	Ogre::PanelOverlayElement* container = (Ogre::PanelOverlayElement*)Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "TextureOverlayPanel");
+	overlay->add2D(container);
+	container->setDimensions(0.4, 0.4);
+	container->setPosition(0.6, 0.6);
+	container->setMaterialName("RttMat");
+	overlay->show();
+*/
+}
+
+Scene::~Scene()
+{
+	clearObjects();
+}
+
+
+void Scene::registerMeshes()
+{
+	// Meshes fuer Objekte registrieren
+	GraphicManager::registerGraphicMapping("gold","gold.mesh");
+
+}
+
+
+GraphicObject* Scene::getGraphicObject(int id)
+{
+	std::map<int,GraphicObject*>::iterator it =  m_graphic_objects.find(id);
+	if (it == m_graphic_objects.end())
+		return 0;
+	return it->second;
+}
+
+std::pair<float,float> Scene::getProjection(Vector pos, float height)
+{
+	Ogre::Vector4 ipos(pos.m_x*GraphicManager::g_global_scale,
+					   height*GraphicManager::g_global_scale,
+					   pos.m_y*GraphicManager::g_global_scale,1);
+	Ogre::Vector4 projpos;
+	projpos = m_camera->getProjectionMatrix()*m_camera->getViewMatrix()*ipos;
+
+	return std::make_pair(0.5 + 0.5*projpos.x / projpos.w, 0.5 - 0.5*projpos.y / projpos.w);
+}
+
+
+GraphicObject* Scene::createGraphicObject(GameObject* gobj, std::string name)
+{
+	// Typ des GraphicObjekts ermitteln
+	if (name=="")
+	{
+		name = gobj->getNameId();
+	}
+	std::string otype;
+	Player* pl = dynamic_cast<Player*>(gobj);
+	GraphicObject::Type type;
+	if (pl != 0 )
+	{
+		type = pl->getPlayerLook().m_render_info;
+	}
+	else if (gobj->getType() == "SCRIPTOBJECT")
+	{
+		type = static_cast<ScriptObject*>(gobj)->getRenderInfo();
+	}
+	else
+	{
+		otype = gobj->getSubtype();
+		type = GraphicManager::getGraphicType(otype);
+	}
+	
+	
+	
+	// GraphicObjekt erstellen und ausgeben
+	if (type == "")
+	{
+		return 0;
+	}
+	else
+	{
+		DEBUGX("create graphic Object typ %s for %s",type.c_str(), otype.c_str());
+		return GraphicManager::createGraphicObject(type,name, gobj->getId());
+	}
+}
+
+
+void Scene::update(float ms)
+{
+	DEBUGX("update scene");
+
+	//TODO: remove the timer (only added for testing).
+	static Timer timer;
+	timer.start ();
+
+	// Spielerobjekt
+	Player* player = m_document->getLocalPlayer();
+
+	if (player ==0)
+		return;
+
+	updateCharacterView();
+
+	if (player->getRegion() ==0)
+		return;
+
+	// Nummer der region in der sich der Spieler befindet
+	short region_nr = player->getRegionId();
+	Region* region = player->getRegion();
+
+
+	if (region_nr != m_region_id)
+	{
+		// Spieler hat eine neue Region betreten
+		if (player->getState() == WorldObject::STATE_ACTIVE)
+		{
+			// Szene komplett neu aufbauen
+			createScene();
+
+			m_document->setModified(m_document->getModified() & ~Document::REGION_MODIFIED);
+
+			m_region_id = region_nr;
+
+			// TODO: create a listener class to remove the handling from here?
+			//SoundManager::getPtr ()->getMusicPlayer ()->switchToPlaylist (region->getName ());
+
+		}
+		else
+		{
+			// Spieler ist der Region noch nicht aktiviert
+			return;
+		}
+	}
+	float durationUpToCrScene = timer.getTime ();
+
+	// Koordinaten des Spielers
+	Vector pos = player->getShape()->m_center;
+
+	// Kamera auf Spieler ausrichten
+	float r= player->getCamera().m_distance*GraphicManager::g_global_scale;
+	float theta = player->getCamera().m_theta * 3.14159 / 180;
+	float phi = player->getCamera().m_phi * 3.14159 / 180;
+
+	if (player->getRegion()->getCutsceneMode())
+	{
+		RegionCamera::Position& cam =player->getRegion()->getCamera().m_position;
+		pos = cam.m_focus;
+		r = cam.m_distance*GraphicManager::g_global_scale;
+		phi = cam.m_phi* 3.14159 / 180;
+		theta = cam.m_theta* 3.14159 / 180;
+	}
+
+	m_camera->setPosition(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale + r*cos(theta)*cos(phi), r*sin(theta), pos.m_y*GraphicManager::g_global_scale - r*cos(theta)*sin(phi)));
+	m_camera->lookAt(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale,
+								   1.4*GraphicManager::g_global_scale,
+								   pos.m_y*GraphicManager::g_global_scale));
+	DEBUGX("cam position %f %f %f",pos.m_x*GraphicManager::g_global_scale + r*cos(theta)*cos(phi), r*sin(theta), pos.m_y*GraphicManager::g_global_scale - r*cos(theta)*sin(phi));
+
+
+	// TODO:XXX: find some way to abstract the listener position, so that a cast to the implementation is not needed!!
+	((GOpenAl::OpenAlManagerUtil*)SoundManager::getPtr ())->setListenerPosition (pos.m_x, pos.m_y, 0.0);
+	
+	// Licht aktualisieren
+	float *colour;
+	Ogre::Light* light;
+	light= m_scene_manager->getLight("HeroLight");
+	light->setPosition(Ogre::Vector3(pos.m_x*GraphicManager::g_global_scale,
+									 6*GraphicManager::g_global_scale,
+									 pos.m_y*GraphicManager::g_global_scale));
+	colour= region->getLight().getHeroLight();
+	light->setDiffuseColour(colour[0], colour[1], colour[2]);
+	
+    
+    colour= region->getLight().getDirectionalLight();
+	light = m_scene_manager->getLight("RegionLight");
+	light->setDiffuseColour(colour[0], colour[1], colour[2]);
+	light->setSpecularColour(colour[0], colour[1], colour[2]);
+	
+	colour= region->getLight().getAmbientLight();
+	m_scene_manager->setAmbientLight(Ogre::ColourValue(colour[0], colour[1], colour[2]));
+
+	float beforeUGO = timer.getTime ();
+
+	updateGraphicObjects(ms);
+	float duration = timer.getTime ();
+	if (duration >= 80)
+	{
+		SW_DEBUG ("scene update update took: %.2f ms. Up to ugo: %.2f", duration, beforeUGO);
+		SW_DEBUG ("Up to createscene: %.2f ms.", durationUpToCrScene);
+	}
+
+}
+
+void  Scene::insertObject(GameObject* gobj, bool is_static)
+{
+	GraphicObject* obj
+
+	DEBUGX("insert graphic object for %s",gobj->getNameId().c_str());
+	if (is_static)
+	{
+		
+		// Object placement
+		float x=gobj->getShape()->m_center.m_x;
+		float z=gobj->getShape()->m_center.m_y;
+		float y = gobj->getHeight();
+		Ogre::Vector3 vec(x*GraphicManager::g_global_scale,y*GraphicManager::g_global_scale,z*GraphicManager::g_global_scale);
+			
+		// Object rotation
+		float angle = gobj->getShape()->m_angle;
+		
+		std::string otype = gobj->getSubtype();
+		GraphicObject::Type type = GraphicManager::getGraphicType(otype);
+		GraphicManager::insertStaticGraphicObject(type,vec,angle);
+		return;
+	}
+	else
+	{
+		obj = createGraphicObject(gobj);
+		m_graphic_objects.insert(std::make_pair(gobj->getId(), obj));
+	}
+	
+	
+	if (obj != 0)
+	{	
+		Ogre::SceneNode* node = obj->getTopNode();
+		
+		// Monster zufaellig skalieren
+		if (gobj->getType() == "MONSTER")
+		{
+			float scale = 0.9 + 0.2*Random::random();
+			node->setScale(scale,scale,scale);
+		
+		}
+		
+		if (gobj->getType() == "PLAYER")
+		{
+			obj->setExactAnimations(true);
+		}
+		
+		if (gobj->getBaseType() == GameObject::WORLDOBJECT)
+		{
+			if (gobj->getState() == WorldObject::STATE_ACTIVE)
+			{
+				obj->setQueryMask(WORLDOBJECT);
+			}
+		}
+		else if (gobj->getBaseType() == GameObject::DROPITEM)
+		{
+			obj->setQueryMask(ITEM);
+		}
+		
+		updateGraphicObject(obj,gobj,0.0);
+	}
+}
+
+void Scene::updateGraphicObject(GraphicObject* obj, GameObject* gobj,float time)
+{
+	if (obj ==0 || gobj==0)
+		return;
+	
+	Ogre::SceneNode* node = obj->getTopNode();
+	
+	// Objektes positionieren
+	float x=gobj->getShape()->m_center.m_x;
+	float z=gobj->getShape()->m_center.m_y;
+	float y = gobj->getHeight();
+	Ogre::Vector3 vec(x*GraphicManager::g_global_scale,y*GraphicManager::g_global_scale,z*GraphicManager::g_global_scale);
+	node->setPosition(vec);
+		
+	// Objekt drehen
+	float angle = gobj->getShape()->m_angle;
+	//node->setDirection(sin(angle),0,-cos(angle),Ogre::Node::TS_WORLD);
+	node->setOrientation(1,0,0,0);
+	node->yaw(Ogre::Radian(-angle));
+	
+	DropItem* di = dynamic_cast<DropItem*>(gobj);
+	if (di != 0)
+	{
+		float anglex = di->getAngleX();
+		node->pitch(Ogre::Radian(anglex));
+	}
+	
+	// Aktion setzen
+	std::string action = gobj->getActionString();
+	float perc = gobj->getActionPercent();
+
+	Player* pl = dynamic_cast<Player*>(gobj);
+	if (pl != 0)
+	{
+		updatePlayerGraphicObject(obj,pl);
+	}
+	
+	obj->updateAction(action,perc);
+	DEBUGX("object %s action %s perc %f",gobj->getNameId().c_str(), action.c_str(), perc);
+	
+	// Zustaende aktualisieren
+	std::set<std::string> flags;
+	gobj->getFlags(flags);
+	if (pl != 0)
+	{
+		std::set<std::string> flags_suffix;
+		
+		std::string suffix = pl->getActionWeaponSuffix();
+		std::set<std::string>::iterator it;
+		std::string tmp;
+		for (it = flags.begin(); it !=flags.end(); ++it)
+		{
+			tmp = (*it);
+			tmp += suffix;
+			flags_suffix.insert(tmp);
+		}
+		obj->updateAllStates(flags_suffix);
+	}
+	else
+	{
+		obj->updateAllStates(flags);
+	}
+	
+	
+	obj->update(time);
+}
+
+bool Scene::updatePlayerGraphicObject(GraphicObject* obj, Player* pl)
+{	
+	MovableObjectInfo minfo;
+	bool update = false;
+	
+	std::stringstream stream;
+	
+	// Waffe
+	stream.str("");
+	stream << "weapon:"<<pl->getId();
+	minfo.m_objectname= stream.str();
+	minfo.m_type = MovableObjectInfo::SUBOBJECT;
+	
+	std::string& suffix = pl->getPlayerLook().m_item_suffix;
+	
+	Item* itm;
+	itm = pl->getWeapon();
+	if (itm !=0 && itm->m_weapon_attr !=0)
+	{
+		if (itm->m_weapon_attr->m_weapon_type == "bow" || itm->m_weapon_attr->m_weapon_type == "crossbow")
+		{
+			minfo.m_bone = "itemLeftHand";
+		}
+		else
+		{
+			minfo.m_bone = "itemRightHand";
+		}
+		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
+		if (minfo.m_source.find(".mesh") == std::string::npos)
+			minfo.m_source += suffix;
+	}
+	else
+	{
+		minfo.m_source="";
+	}
+	update |= obj->updateSubobject(minfo);
+	
+	// Schild
+	stream.str("");
+	stream << "shield:"<<pl->getId();
+	minfo.m_objectname= stream.str();
+	minfo.m_type = MovableObjectInfo::SUBOBJECT;
+	itm = pl->getShield();
+	if (itm !=0)
+	{
+		minfo.m_bone = "itemLeftHand";
+		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
+		if (minfo.m_source.find(".mesh") == std::string::npos)
+			minfo.m_source += suffix;
+	}
+	else
+	{
+		minfo.m_source="";
+	}
+	update |= obj->updateSubobject(minfo);
+	
+	DEBUGX("update %s : bone %s source %s", minfo.m_objectname.c_str(), minfo.m_bone.c_str(), minfo.m_source.c_str());
+	
+	// Handschuhe
+	stream.str("");
+	stream << "gloves:"<<pl->getId();
+	minfo.m_objectname= stream.str();
+	minfo.m_type = MovableObjectInfo::SUBOBJECT;
+	itm = pl->getEquipement()->getItem(Equipement::GLOVES);
+	
+	if (itm !=0)
+	{
+		std::string type = itm->m_subtype;
+		
+		minfo.m_bone = "";
+		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
+		if (minfo.m_source.find(".mesh") == std::string::npos)
+			minfo.m_source += suffix;
+	}
+	else
+	{
+		minfo.m_source="";
+	}
+	update |= obj->updateSubobject(minfo);
+	
+	// Helm
+	stream.str("");
+	stream << "helmet:"<<pl->getId();
+	minfo.m_objectname= stream.str();
+	minfo.m_type = MovableObjectInfo::SUBOBJECT;
+	itm = pl->getEquipement()->getItem(Equipement::HELMET);
+	minfo.m_bone = "crown";
+	
+	if (itm !=0)
+	{
+		std::string type = itm->m_subtype;
+		
+		
+		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
+		if (minfo.m_source.find(".mesh") == std::string::npos)
+			minfo.m_source += suffix;
+	}
+	else
+	{
+		minfo.m_source= pl->getPlayerLook().m_hair;
+	}
+	update |= obj->updateSubobject(minfo);
+	
+	// Ruestung
+	stream.str("");
+	stream << "armor:"<<pl->getId();
+	minfo.m_objectname= stream.str();
+	minfo.m_type = MovableObjectInfo::SUBOBJECT;
+	itm = pl->getEquipement()->getItem(Equipement::ARMOR);
+	
+	if (itm !=0)
+	{
+		std::string type = itm->m_subtype;
+		
+		minfo.m_bone = "";
+		minfo.m_source = GraphicManager::getGraphicType(itm->m_subtype);
+		if (minfo.m_source.find(".mesh") == std::string::npos)
+			minfo.m_source += suffix;
+
+	}
+	else
+	{
+		minfo.m_source="";
+	}
+	update |= obj->updateSubobject(minfo);
+	
+	return update;
+}
+
+void  Scene::deleteGraphicObject(int id)
+{
+	std::map<int,GraphicObject*>::iterator it;
+	it = m_graphic_objects.find(id);
+	if (it != m_graphic_objects.end())
+	{
+		GraphicManager::destroyGraphicObject(it->second);
+		m_graphic_objects.erase(id);
+	}
+}
+
+void Scene::updateGraphicObjects(float time)
+{
+	Player* player = m_document->getLocalPlayer();
+	GameObjectMap& game_objs = player->getRegion()->getGameObjects();
+	
+	GameObjectMap::iterator it = game_objs.begin();
+	std::map<int,GraphicObject*>::iterator jtold, jt = m_graphic_objects.begin();
+	
+	int numOps = 0;
+
+	while (it != game_objs.end() || jt != m_graphic_objects.end())
+	{
+		if (it == game_objs.end() || (jt != m_graphic_objects.end() && it->first > jt->first))
+		{
+			// Objekt jt existiert als Graphisch, aber nicht mehr im Spiel
+			DEBUGX("deleting graphic object %i",jt->first);
+			jtold = jt;
+			++jt;
+			
+			deleteGraphicObject(jtold->first);
+			++ numOps;
+		}
+		else if (jt == m_graphic_objects.end() || (it != game_objs.end() && it->first < jt->first))
+		{
+			// Objekt it existiert im Spiel, aber noch nicht graphisch
+			DEBUGX("inserting graphic object %i",it->first);	
+			if (it->second->getLayer() != GameObject::LAYER_SPECIAL)
+			{
+				insertObject(it->second,false);
+				++ numOps;
+			}
+			
+			++it;
+		}
+		else if (it->first == jt->first)
+		{
+			// GraphikObjekt aktualisieren
+			DEBUGX("update graphic objekt %i",it->first);
+			updateGraphicObject(jt->second, it->second,time);
+			++it;
+			++jt;
+			++ numOps;
+		}
+		else
+		{
+			ERRORMSG("Fehler beim Abgleich Graphik <-> ingame");
+		}
+		if (numOps > 10)
+		{
+			numOps = 10;
+			SoundHelper::signalSoundManager ();
+		}
+	}
+	
+}
+
+
+void Scene::updateCharacterView()
+{
+	bool update = false;
+	
+	Ogre::SceneManager* scene_mgr = Ogre::Root::getSingleton().getSceneManager("CharacterSceneManager");
+	GraphicManager::setSceneManager(scene_mgr);
+	
+	Player* pl = m_document->getLocalPlayer();
+
+	if ((pl ==0 && m_temp_player!=""))
+	{
+		SW_DEBUG("deleting inv player");
+		m_temp_player="";
+		GraphicManager::destroyGraphicObject(m_temp_player_object);
+		m_temp_player_object =0;
+		update = true;
+	}
+
+	if (pl !=0)
+	{
+		std::string correctname = pl->getNameId();
+		correctname += pl->getPlayerLook().m_render_info;
+		
+		if ((correctname != m_temp_player))
+		{
+			DEBUGX("updating inv player %s to %s",m_temp_player.c_str(), correctname.c_str());
+			GraphicManager::destroyGraphicObject(m_temp_player_object);
+			m_temp_player_object =0;
+			update = true;
+		}
+		
+		m_temp_player = correctname;
+		
+		if (m_temp_player_object ==0)
+		{
+			update = true;
+			m_temp_player_object = createGraphicObject(pl,"tempplayer");
+			m_temp_player_object->setExactAnimations(true);
+		}
+		
+		update |= updatePlayerGraphicObject(m_temp_player_object,pl);
+	}	
+	
+	if (update)
+	{
+		if (m_temp_player_object !=0)
+		{
+			// aktion temporaer fuer den Renderaufruf auf noaction setzen
+			Action actsave = *(pl->getAction());
+			Action tmpact("noaction");
+			std::string act = pl->getActionString();
+#if 0
+			// Commented out functionality to allow fix of Mantis ID:0000075 (http://sumwars.org/mantis/view.php?id=75)
+
+			pl->setAction(tmpact);
+			act = pl->getActionString();
+			DEBUG ("Current action string after is: %s", act.c_str ());
+#endif
+			m_temp_player_object->updateAction(act,0.5);
+			m_temp_player_object->update(0);
+			
+			pl->setAction(actsave);
+		}
+		
+		Ogre::Resource* res= Ogre::TextureManager::getSingleton().createOrRetrieve ("character_tex",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).first.getPointer();
+		Ogre::Texture* texture = dynamic_cast<Ogre::Texture*>(res);
+		Ogre::RenderTarget* target = texture->getBuffer()->getRenderTarget();
+	
+	
+		target->update();
+		
+		// update character icon
+		if (pl !=0)
+		{
+			Ogre::Image img;
+			texture->convertToImage(img);
+			std::string saveFile =  this->m_document->getSaveFile();
+			if(saveFile != "")
+			{
+				saveFile.erase(saveFile.length()-4, saveFile.length());
+				img.resize(256, 256);
+				img.save(saveFile.append(".png"));
+
+#ifdef SUMWARS_BUILD_WITH_ONLINE_SERVICES
+                if(OnlineServicesManager::getSingleton().userLoggedIn())
+                {
+                    Ogre::DataStreamPtr ptr = img.encode("png");
+                    OnlineServicesManager::getSingleton().syncCharacterAvatar(pl->getName().getRawText(), saveFile, ptr);
+                }
+#endif
+
+
+			}
+		}
+		DEBUGX("player image is now %s",m_temp_player.c_str());
+	}
+	
+	GraphicManager::setSceneManager(m_scene_manager);
+	
+}
+
+
+void Scene::clearObjects()
+{
+	std::map<int,GraphicObject*>::iterator it;
+	
+	for (it = m_graphic_objects.begin(); it != m_graphic_objects.end(); ++it)
+	{
+		GraphicManager::destroyGraphicObject(it->second);
+	}
+	m_graphic_objects.clear();
+}
+
+void Scene::createScene()
+{
+	DEBUGX("create Scene");
+
+	// alle bisherigen Objekte aus der Szene loeschen
+	clearObjects();
+	
+	GraphicManager::destroyGraphicObject(m_temp_player_object);
+	m_temp_player_object =0;
+	m_temp_player="";
+
+	// TODO: XXX: stop any ambient sounds that would be playing in the scene.
+	//SoundSystem::clearObjects();
+	
+	GraphicManager::clearStaticGeometry();
+	GraphicManager::clearParticlePool();
+
+	m_scene_manager->clearScene();
+	
+	updateCharacterView();
+
+	SoundHelper::signalSoundManager ();
+	
+	// Liste der statischen Objekte
+	Ogre::StaticGeometry* static_geom = m_scene_manager->createStaticGeometry ("StaticGeometry");
+
+	SoundHelper::signalSoundManager ();
+
+	std::list<WorldObject*> stat_objs;
+
+	Region* region = m_document->getLocalPlayer()->getRegion();
+
+	Ogre::Light *light = m_scene_manager->createLight("HeroLight");
+	light->setType(Ogre::Light::LT_POINT);
+	light->setSpecularColour(0.0, 0.0, 0.0);
+	light->setAttenuation(20*GraphicManager::g_global_scale,0.5,0.000,
+						  0.025/(GraphicManager::g_global_scale*GraphicManager::g_global_scale));
+	if (region)
+	{
+		const float* colour = region->getLight().getHeroLight();
+		light->setDiffuseColour(colour[0], colour[1], colour[2]);
+		DEBUGX("hero light %f %f %f",colour[0], colour[1], colour[2]);
+	}
+
+#ifndef DONT_USE_SHADOWS
+	light->setCastShadows (false);
+	// Augustin Preda, 2011.11.15: set to disabled.
+#endif // DONT_USE_SHADOWS
+    
+    light = m_scene_manager->createLight("RegionLight");
+	light->setType(Ogre::Light::LT_DIRECTIONAL);
+	light->setDirection(Ogre::Vector3(-1,-1,-1));
+	if (region)
+	{
+		const float* colour = region->getLight().getDirectionalLight();
+		light->setDiffuseColour(colour[0], colour[1], colour[2]);
+		light->setSpecularColour(colour[0], colour[1], colour[2]);
+	}
+
+#ifndef DONT_USE_SHADOWS
+    light->setCastShadows (true);
+#endif // DONT_USE_SHADOWS
+
+	DEBUGX("directional light %f %f %f",colour[0], colour[1], colour[2]);
+
+	if (region)
+	{
+		const WorldObjectMap& stat_objs = region->getStaticObjects();
+		for (WorldObjectMap::const_iterator it = stat_objs.begin(); it !=stat_objs.end(); ++it)
+		{
+			// Objekt in der Szene erzeugen
+			insertObject(it->second,true);
+		}
+		SoundHelper::signalSoundManager ();
+		GraphicManager::buildStaticGeometry();
+		SoundHelper::signalSoundManager ();
+
+		short dimx = region->getDimX();
+		short dimy = region->getDimY();
+		Ogre::Camera* minimap_camera=m_scene_manager->getCamera("minimap_camera");
+		DEBUGX("camera pos %i %i %i",dimx*GraphicManager::g_global_scale*2,
+			   std::max(dimx,dimy)*GraphicManager::g_global_scale*6,
+			   dimy*GraphicManager::g_global_scale*2);
+		minimap_camera->setPosition(Ogre::Vector3(dimx*GraphicManager::g_global_scale*2,
+												  MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4,
+												  dimy*GraphicManager::g_global_scale*2+1));
+		minimap_camera->lookAt(Ogre::Vector3(dimx*GraphicManager::g_global_scale*2,0,dimy*GraphicManager::g_global_scale*2));
+#if (OGRE_VERSION >= ((1 << 16) | (6 << 8)))
+			// >= Ogre 1.6
+
+			minimap_camera->setOrthoWindow(MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4, MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*4);
+#else
+
+			minimap_camera->setNearClipDistance(MathHelper::Max(dimx,dimy)*GraphicManager::g_global_scale*2);
+#endif
+		Ogre::Resource* res= Ogre::TextureManager::getSingleton().createOrRetrieve ("minimap_tex",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME).first.getPointer();
+		Ogre::Texture* texture = dynamic_cast<Ogre::Texture*>(res);
+		Ogre::RenderTarget* target = texture->getBuffer()->getRenderTarget();
+
+		//m_minimap_camera->setPosition(Ogre::Vector3(6600,1000,11400));
+		//m_minimap_camera->lookAt(Ogre::Vector3(6600,0,11380));
+		//Ogre::Vector3 up = m_minimap_camera->getUp();
+		//m_minimap_camera->setFrustumExtents (0,dimx*200,0,dimy*200);
+		//DEBUG("camera up %f %f %f",up.x, up.y, up.z);
+
+        m_scene_manager->setAmbientLight(Ogre::ColourValue(1.0f,1.0f,1.0f));
+        
+		// Boden erstellen
+		if (region->getGroundMaterial() != "")
+		{
+			std::stringstream stream;
+			short dimx = region->getDimX();
+			short dimy = region->getDimY();
+			Ogre::Entity* ground;
+			ground = m_scene_manager->createEntity(stream.str(), "ground");
+			ground->setMaterialName(region->getGroundMaterial());
+			ground->setCastShadows(false);
+			ground->setQueryFlags(0);
+			
+			for (int i=0; i< dimx; ++i)
+			{
+				for (int j=0; j<dimy; ++j)
+				{
+					Ogre::Vector3 pos(i*GraphicManager::g_global_scale*4+GraphicManager::g_global_scale*2,0,j*GraphicManager::g_global_scale*4+GraphicManager::g_global_scale*2);
+					// This scales entity to the right size unit meshes are scaled
+					Ogre::Vector3 scale(GraphicManager::g_global_scale/50, GraphicManager::g_global_scale/50, GraphicManager::g_global_scale/50);
+					
+					static_geom->addEntity(ground, pos, Ogre::Quaternion::IDENTITY, scale);
+				}
+			}
+		}
+		SoundHelper::signalSoundManager ();
+		static_geom->build();
+		
+		m_scene_manager->setAmbientLight(Ogre::ColourValue(0.4,0.4,0.4));
+		SoundHelper::signalSoundManager ();
+		target->update();
+		SoundHelper::signalSoundManager ();
+
+		const float* colour = region->getLight().getAmbientLight();
+		m_scene_manager->setAmbientLight(Ogre::ColourValue(colour[0], colour[1], colour[2]));
+		DEBUGX("ambient light %f %f %f",colour[0], colour[1], colour[2]);
+		//m_scene_manager->setAmbientLight(Ogre::ColourValue(0.0,0.0,0.0));
+	}
+}
+
+void Scene::getMeshInformation(const Ogre::MeshPtr mesh, size_t &vertex_count, Ogre::Vector3* &vertices,  size_t &index_count,
+							unsigned long* &indices,  const Ogre::Vector3 &position,  const Ogre::Quaternion &orient,  const Ogre::Vector3 &scale)
+{
+	bool added_shared = false;
+	size_t current_offset = 0;
+	size_t shared_offset = 0;
+	size_t next_offset = 0;
+	size_t index_offset = 0;
+
+	vertex_count = index_count = 0;
+
+    // Calculate how many vertices and indices we're going to need
+	for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
+	{
+		Ogre::SubMesh* submesh = mesh->getSubMesh( i );
+
+        // We only need to add the shared vertices once
+		if(submesh->useSharedVertices)
+		{
+			if( !added_shared )
+			{
+				vertex_count += mesh->sharedVertexData->vertexCount;
+				added_shared = true;
+			}
+		}
+		else
+		{
+			vertex_count += submesh->vertexData->vertexCount;
+		}
+
+        // Add the indices
+		index_count += submesh->indexData->indexCount;
+	}
+
+
+    // Allocate space for the vertices and indices
+	vertices = new Ogre::Vector3[vertex_count];
+	indices = new unsigned long[index_count];
+	for (size_t i=0; i<index_count; i++)
+	{
+		indices[i] = 0;
+	}
+	
+	added_shared = false;
+
+    // Run through the submeshes again, adding the data into the arrays
+	for ( unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
+	{
+		Ogre::SubMesh* submesh = mesh->getSubMesh(i);
+
+		Ogre::VertexData* vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;
+
+		if((!submesh->useSharedVertices)||(submesh->useSharedVertices && !added_shared))
+		{
+			if(submesh->useSharedVertices)
+			{
+				added_shared = true;
+				shared_offset = current_offset;
+			}
+
+			const Ogre::VertexElement* posElem =
+					vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
+
+			Ogre::HardwareVertexBufferSharedPtr vbuf =
+					vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
+
+			unsigned char* vertex =
+					static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
+
+            // There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double
+            //  as second argument. So make it float, to avoid trouble when Ogre::Real will
+            //  be comiled/typedefed as double:
+            //      Ogre::Real* pReal;
+			float* pReal;
+
+			for( size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
+			{
+				posElem->baseVertexPointerToElement(vertex, &pReal);
+
+				Ogre::Vector3 pt(pReal[0], pReal[1], pReal[2]);
+
+				vertices[current_offset + j] = (orient * (pt * scale)) + position;
+			}
+
+			vbuf->unlock();
+			next_offset += vertex_data->vertexCount;
+		}
+
+
+		Ogre::IndexData* index_data = submesh->indexData;
+		
+		size_t numTris = index_data->indexCount / 3;
+		Ogre::HardwareIndexBufferSharedPtr ibuf = index_data->indexBuffer;
+
+		bool use32bitindexes = (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT);
+
+		unsigned long*  pLong = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
+		unsigned short* pShort = reinterpret_cast<unsigned short*>(pLong);
+
+
+		size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
+
+		if ( use32bitindexes )
+		{
+			for ( size_t k = 0; k < numTris*3; ++k)
+			{
+				indices[index_offset] = pLong[k] + static_cast<unsigned long>(offset);
+				if (indices[index_offset] <0 || indices[index_offset] >= vertex_count)
+				{
+					SW_DEBUG("-----------------------------");
+					SW_DEBUG("illegal index %i at pos %i",indices[index_offset], offset);
+					SW_DEBUG("submesh %i  triangle %i", i,k);
+					SW_DEBUG("vertex count %i  index count %i",vertex_count, index_count);
+					SW_DEBUG("32bit index %i  shared %i",use32bitindexes, submesh->useSharedVertices);
+				}
+				index_offset++;
+			}
+		}
+		else
+		{
+			for ( size_t k = 0; k < numTris*3; ++k)
+			{
+				indices[index_offset] = static_cast<unsigned long>(pShort[k]) +
+						static_cast<unsigned long>(offset);
+						if (indices[index_offset] <0 || indices[index_offset] >= vertex_count)
+						{
+							SW_DEBUG("illegal index %i at pos %i",indices[index_offset], index_offset);
+							SW_DEBUG("submesh %i  triangle %i", i,k);
+							SW_DEBUG("vertex count %i  index count %i",vertex_count, index_count);
+							SW_DEBUG("32bit index %i  shared %i",use32bitindexes, submesh->useSharedVertices);
+						}
+				index_offset++;
+			}
+		}
+
+		ibuf->unlock();
+		current_offset = next_offset;
+	}
+	
+	if (index_offset != index_count)
+	{
+		ERRORMSG("Index offset %i is not index count %i",index_offset,index_count);
+	}
+	
+	if (current_offset != vertex_count)
+	{
+		ERRORMSG("vertex offset %i is not vertex count %i",current_offset,vertex_count);
+	}
+} 
--- a/src/gui/scene.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/scene.h	Thu Mar 20 19:04:28 2014 +0100
@@ -19,7 +19,6 @@
 #include "OgreSceneManager.h"
 #include "OgreEntity.h"
 #include "OgreTextureManager.h"
-#include "OgreParticleSystem.h"
 #include "OgreRoot.h"
 #include "OgreRenderWindow.h"
 #include "OgreRenderTarget.h"
@@ -36,7 +35,7 @@
 #include "objectloader.h"
 #include "document.h"
 #include "worldobject.h"
-#include "sound.h"
+//#include "sound.h"
 #include "player.h"
 #include "graphicobject.h"
 #include "scriptobject.h"
--- a/src/gui/skilltree.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/skilltree.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,739 +1,833 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "skilltree.h"
-
-#include "tooltipmanager.h"
-#include "ceguiutility.h"
-
-#define DEFAULT_SKILL_ITEM_WIDTH 0.18f
-#define DEFAULT_SKILL_ITEM_HEIGHT 0.16f
-#define DEFAULT_SKILL_BTN_WIDTH 0.07f
-#define DEFAULT_SKILL_BTN_HEIGHT 0.05f
-
-SkillTree::SkillTree (Document* doc, OIS::Keyboard *keyboard, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUGX("setup skilltree");
-	m_keyboard = keyboard;
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-
-	// Rahmen fuer Skilltree Fenster
-
-	// Bestandteile des Charakterfensters hinzufuegen
-
-	std::ostringstream outStream;
-	std::string name;
-	std::string lname,bname;
-	CEGUI::UVector2 pos;
-	CEGUI::Window* label;
-	
-	m_player_id =0;
-	
-	CEGUI::TabControl* skilltree = (CEGUI::TabControl*) win_mgr.loadWindowLayout( "skilltree.layout" );
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "skilltree.h"
+
+#include "tooltipmanager.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+
+#define DEFAULT_SKILL_ITEM_WIDTH 0.18f
+#define DEFAULT_SKILL_ITEM_HEIGHT 0.16f
+#define DEFAULT_SKILL_BTN_WIDTH 0.07f
+#define DEFAULT_SKILL_BTN_HEIGHT 0.05f
+
+SkillTree::SkillTree (Document* doc, OIS::Keyboard *keyboard, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	DEBUGX("setup skilltree");
+	m_keyboard = keyboard;
+	m_skill_widgets_pics.clear ();
+	m_skill_widgets_btns.clear ();
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+
+	// Rahmen fuer Skilltree Fenster
+
+	// Bestandteile des Charakterfensters hinzufuegen
+
+	std::ostringstream outStream;
+	std::string name;
+	std::string lname,bname;
+	CEGUI::UVector2 pos;
+	CEGUI::Window* label;
+	
+	m_player_id =0;
+	
+	CEGUI::TabControl* skilltree = (CEGUI::TabControl*) CEGUIUtility::loadLayoutFromFile ("skilltree.layout");
 	if (!skilltree)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "skilltree.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "skilltree.layout");
 	}
-	CEGUI::Window* skilltree_holder = win_mgr.loadWindowLayout( "skilltree_holder.layout" );
+	CEGUI::Window* skilltree_holder = CEGUIUtility::loadLayoutFromFile ("skilltree_holder.layout");
 	if (!skilltree_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "questinfo_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "skilltree_holder.layout");
+	}
+
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (skilltree_holder, "Skilltree_Holder");
+	CEGUI::Window* wndSkilltree = CEGUIUtility::getWindowForLoadedLayoutEx (skilltree, "Skilltree");
+	if (wndHolder && wndSkilltree)
+	{
+		CEGUIUtility::addChildWidget (wndHolder, wndSkilltree);
+	}
+	else
+	{
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for skills.");
+		if (!wndSkilltree) SW_DEBUG ("ERROR: Unable to get the window for skills.");
+	}
+
+	m_window = skilltree_holder;
+	skilltree->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent,  (Window*) this));
+	skilltree->setWantsMultiClickEvents(false);
+	
+	// the panel should also have an auto-close button; connect it to the Cancel/Abort event.
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/__auto_closebutton__");
+	if (label)
+	{
+		label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onCloseButtonClicked, this));
 	}
-
-	CEGUI::Window* wndHolder = win_mgr.getWindow("Skilltree_Holder");
-	CEGUI::Window* wndSkilltree = win_mgr.getWindow("Skilltree");
-	if (wndHolder && wndSkilltree)
-	{
-		wndHolder->addChildWindow (wndSkilltree);
-	}
-	else
-	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for skills.");
-		if (!wndSkilltree) DEBUG ("ERROR: Unable to get the window for skills.");
-	}
-
-	m_window = skilltree_holder;
-	skilltree->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Window::consumeEvent,  (Window*) this));
-	skilltree->setWantsMultiClickEvents(false);
-	
-	// TODO: remove this when no longer needed (layout updated).
-	if (win_mgr.isWindowPresent ("SkillTreeCloseButton"))
-	{
-		label = win_mgr.getWindow("SkillTreeCloseButton");
-		label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onCloseButtonClicked, this));
-	}
-	
-	// If the panel also has an auto-close button, connect it to the Cancel/Abort event.
-	if (win_mgr.isWindowPresent ("Skilltree__auto_closebutton__"))
+
+
+	m_nr_tabs =0;
+	m_nr_skills =0;
+	m_nr_dependencies = 0;
+	m_shortkey_labels = 0;
+}
+
+void SkillTree::update()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	Player* player = m_document->getLocalPlayer();
+	CEGUI::TabControl* skilltree = (CEGUI::TabControl*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkilltreeTabs");
+	
+	CEGUI::Window* wnd;
+	std::vector<CEGUI::DefaultWindow*> tabs(3);
+	CEGUI::Window* label;
+	CEGUI::PushButton* button;
+	std::stringstream stream;
+	
+	if (player->getId() != m_player_id)
 	{
-		label = win_mgr.getWindow ("Skilltree__auto_closebutton__");
-		if (label)
+		m_player_id = player->getId();
+		DEBUGX("new Player id %i",m_player_id);
+		
+		// alle bisherigen Tabs und Skills entfernen
+		
+		for (int i=0; i<m_nr_skills; i++)
+		{
+			//stream.str("");
+			//stream << "SkillImage"<<i;
+			std::string skillImageWidget = m_skill_widgets_pics[i];
+			std::string skillButtonWidget = m_skill_widgets_btns[i];
+			wnd = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillImageWidget);
+			
+			CEGUIUtility::removeChildWidget (wnd->getParent (), wnd);
+			win_mgr.destroyWindow(wnd);
+			
+			//stream.str("");
+			//stream << "SkillButton"<<i;
+			wnd = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillButtonWidget);
+			
+			CEGUIUtility::removeChildWidget (wnd->getParent (), wnd);
+			win_mgr.destroyWindow(wnd);
+		}
+		
+		for (int i=0; i<m_nr_dependencies; i++)
+		{
+			//stream.str("");
+			//stream << "SkillDependencyConnection"<<i;
+			std::string skillConnWidget = m_skill_widgets_connections[i];
+			wnd = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillConnWidget);
+			
+			CEGUIUtility::removeChildWidget (wnd->getParent (), wnd);
+			win_mgr.destroyWindow(wnd);
+		}
+		m_nr_dependencies=0;
+		
+		for (int i=0; i<m_shortkey_labels; i++)
+		{
+			//stream.str("");
+			//stream << "SkillShortkeyLabel"<<i;
+			std::string skillShortcutsWidget = m_skill_widgets_shortcuts[i];
+			wnd = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillShortcutsWidget);
+			
+			CEGUIUtility::removeChildWidget (wnd->getParent (), wnd);
+			win_mgr.destroyWindow(wnd);
+		}
+		m_shortkey_labels=0;
+		
+		for (int i=0; i<m_nr_tabs; i++)
+		{
+			stream.str("");
+			stream << "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/";
+			stream << "SkilltreeTab"<<i;
+			wnd = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+			
+			skilltree->removeTab(wnd->getID());
+			win_mgr.destroyWindow(wnd);
+		}
+		
+		
+		
+		
+		// neue Tabs
+		// TODO: generisch ausprogrammieren
+		
+		m_nr_tabs =3;
+		for (int i=0; i<m_nr_tabs; i++)
+		{
+			stream.str("");
+			stream << "SkilltreeTab" << i;
+			
+			
+			tabs[i] = (CEGUI::DefaultWindow*) win_mgr.createWindow(CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "TabContentPane"), stream.str());
+			skilltree->addTab(tabs[i]);
+			
+			stream.str("");
+			stream << "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/SkilltreeTab" << i;
+
+			label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+			label->setInheritsAlpha(false);
+		}
+		
+		//Set tab name colors 
+		stream.str("");
+		stream << "FFD43D1A";
+
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/SkilltreeTab0");
+		if (label->isPropertyPresent ("NormalTextColour"))
+		{
+			label->setProperty("NormalTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("HoverTextColour"))
+		{
+			label->setProperty("HoverTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("SelectedTextColour"))
+		{
+			label->setProperty("SelectedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("PushedTextColour"))
+		{
+			label->setProperty("PushedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("DisabledTextColour"))
+		{
+			label->setProperty("DisabledTextColour", stream.str());
+		}
+
+		stream.str("");
+		stream << "FF5CACEE";
+
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/SkilltreeTab1");
+		if (label->isPropertyPresent ("NormalTextColour"))
+		{
+			label->setProperty("NormalTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("HoverTextColour"))
+		{
+			label->setProperty("HoverTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("SelectedTextColour"))
+		{
+			label->setProperty("SelectedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("PushedTextColour"))
+		{
+			label->setProperty("PushedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("DisabledTextColour"))
+		{
+			label->setProperty("DisabledTextColour", stream.str());
+		}
+
+		stream.str("");
+		stream << "FFD15FEE";
+
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/SkilltreeTab2");
+		if (label->isPropertyPresent ("NormalTextColour"))
+		{
+			label->setProperty("NormalTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("HoverTextColour"))
+		{
+			label->setProperty("HoverTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("SelectedTextColour"))
+		{
+			label->setProperty("SelectedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("PushedTextColour"))
+		{
+			label->setProperty("PushedTextColour", stream.str());
+		}
+		if (label->isPropertyPresent ("DisabledTextColour"))
+		{
+			label->setProperty("DisabledTextColour", stream.str());
+		}
+
+		// labels for skillpoints and next skillpoint
+		
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/SkillpointsValueLabel");
+		label->setText("0");
+		
+		
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/NextSkillpointsValueLabel");
+		label->setText("0");
+		
+		
+		CEGUI::UVector2 pos;
+		CEGUI::UVector2 bgpos;
+		std::string name,lname,bname;
+		Vector spos;
+		
+		DEBUGX("nr of abilities %i", player->getLearnableAbilities().size());
+		
+		std::map<int,LearnableAbility>::iterator it;
+		int cnt =0;
+		for (it = player->getLearnableAbilities().begin(); it != player->getLearnableAbilities().end(); ++it)
 		{
-			label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onCloseButtonClicked, this));
+			// Picture of skill
+			DEBUGX("ability %s nr %i",it->second.m_type.c_str(),cnt);
+			stream.str("");
+			stream << "SkillImage"<<cnt;
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+
+			CEGUIUtility::addChildWidget (tabs[it->second.m_skilltree_tab-1], label);
+			spos = it->second.m_skilltree_position;
+			pos = CEGUI::UVector2(cegui_reldim(spos.m_x), cegui_reldim( spos.m_y));
+
+			if (label->isPropertyDefault ("FrameEnabled"))
+			{
+				label->setProperty ("FrameEnabled", "True");
+			}
+			label->setPosition(pos);
+			CEGUIUtility::setWidgetSizeRel (label, DEFAULT_SKILL_ITEM_WIDTH, DEFAULT_SKILL_ITEM_HEIGHT);
+			std::string imageWidgetName = label->getNamePath ().c_str ();
+			size_t string_pos = imageWidgetName.find ("SW/GameScreen/Skilltree_Holder/");
+			if (string_pos != std::string::npos)
+			{
+				imageWidgetName.erase (string_pos, 31);
+			}
+			m_skill_widgets_pics[cnt] = imageWidgetName;
+			SW_DEBUG ("Added widget name (img) [%s]", imageWidgetName.c_str ());
+
+			//
+			// Setup the button to be used to learn the corresponding skill.
+			// Also connect the callbacks to the button click events.
+			//
+			pos += CEGUI::UVector2 (cegui_reldim (DEFAULT_SKILL_ITEM_WIDTH - 0.01f), cegui_reldim (DEFAULT_SKILL_ITEM_HEIGHT - 0.05f));
+			stream.str ("");
+			stream << "SkillButton" << cnt;
+			button = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), stream.str ()));
+			button->setInheritsAlpha (false);
+			CEGUIUtility::addChildWidget (tabs [it->second.m_skilltree_tab - 1], button);
+			if (button->isPropertyPresent ("HoverImage"))
+			{
+				button->setProperty("HoverImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+			}
+			if (button->isPropertyPresent ("NormalImage"))
+			{
+				button->setProperty("NormalImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnReleased"));
+			}
+			if (button->isPropertyPresent ("PushedImage"))
+			{
+				button->setProperty("PushedImage", CEGUIUtility::getImageNameWithSkin ("CharScreen", "PlusBtnPressed"));
+			}
+			button->setPosition (pos);
+			CEGUIUtility::setWidgetSizeRel (button, DEFAULT_SKILL_BTN_WIDTH, DEFAULT_SKILL_BTN_HEIGHT);
+			button->setID(it->first);
+			button->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onSkillLearnMouseClicked, this));
+			
+			std::string btnWidgetName = button->getNamePath ().c_str ();
+			string_pos = btnWidgetName.find ("SW/GameScreen/Skilltree_Holder/");
+			if (string_pos != std::string::npos)
+			{
+				btnWidgetName.erase (string_pos, 31);
+			}
+			m_skill_widgets_btns[cnt] = btnWidgetName;
+			SW_DEBUG ("Added widget name (btn) [%s]", btnWidgetName.c_str ());
+
+			//
+			// Set the skill picture settings. This loads the picture and sets specific properties.
+			// 
+			label->setInheritsAlpha(false);
+			label->setProperty("BackgroundEnabled", "false");
+			label->setID(it->first);
+			std::string imagename = it->second.m_image;
+			if (imagename == "")
+			{
+				imagename = CEGUIUtility::getImageNameWithSkin ("skills", it->second.m_type);
+			}
+			label->setProperty("Image", imagename);
+			label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onSkillMouseClicked, this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&SkillTree::onAbilityHover, this));
+			
+			//
+			// Create Connections for Dependencies
+			// loop over dependencies
+			for (std::list< Action::ActionType >::iterator at = it->second.m_req_abilities.begin(); at != it->second.m_req_abilities.end(); ++at)
+			{
+				// another loop over all abilities
+				std::map<int,LearnableAbility>::iterator jt;
+				for (jt = player->getLearnableAbilities().begin(); jt != player->getLearnableAbilities().end(); ++jt)
+				{
+					if (*at == jt->second.m_type)
+					{
+						// found dependency
+						Vector deppos = jt->second.m_skilltree_position;
+						
+						stream.str("");
+						stream << "SkillDependencyConnection"<<m_nr_dependencies;
+						label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+						CEGUIUtility::addChildWidget (tabs[it->second.m_skilltree_tab-1], label);
+						label->setMousePassThroughEnabled(true);
+						label->setInheritsAlpha(false);
+						label->setProperty("FrameEnabled", "false");
+						label->setProperty("BackgroundEnabled", "false");
+						label->moveToBack ();
+			
+						CEGUI::UVector2 start = CEGUI::UVector2 (cegui_reldim (deppos.m_x + (DEFAULT_SKILL_ITEM_WIDTH / 2) - 0.02f), cegui_reldim (deppos.m_y + DEFAULT_SKILL_ITEM_HEIGHT));
+						CEGUI::UVector2 end   = CEGUI::UVector2 (cegui_reldim (spos.m_x + (DEFAULT_SKILL_ITEM_WIDTH / 2) + 0.02f), cegui_reldim (spos.m_y));
+						label->setPosition(start);
+						CEGUIUtility::setWidgetSize (label, end - start);
+						label->setID(jt->first);
+						
+						// distinguish vertical and diagonal connectors
+						if (deppos.m_x == spos.m_x)
+						{
+							label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("SumWarsExtras", "SkilltreeVertConnection")); 
+						}
+						else if (deppos.m_x <= spos.m_x)
+						{
+							label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("SumWarsExtras", "SkilltreeDiagConnection")); 
+						}
+						else
+						{
+							label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("SumWarsExtras", "SkilltreeDiag2Connection"));
+							start= CEGUI::UVector2(cegui_reldim(spos.m_x+0.07f), cegui_reldim( deppos.m_y+0.1f));
+							end= CEGUI::UVector2(cegui_reldim(deppos.m_x+0.06f), cegui_reldim( spos.m_y));
+							label->setPosition(start);
+							CEGUIUtility::setWidgetSize (label, end - start);
+						}
+
+						std::string depsWidgetName = label->getNamePath ().c_str ();
+						size_t string_pos = depsWidgetName.find ("SW/GameScreen/Skilltree_Holder/");
+						if (string_pos != std::string::npos)
+						{
+							depsWidgetName.erase (string_pos, 31);
+						}
+						m_skill_widgets_connections[m_nr_dependencies] = depsWidgetName;
+						SW_DEBUG ("Added widget name (conn) [%s]", depsWidgetName.c_str ());
+
+						m_nr_dependencies++;
+						
+						DEBUGX("dependency %s from %s", it->second.m_type.c_str(), at->c_str());
+					}
+				}
+			}
+			
+			cnt ++;
+		}
+		
+		m_nr_skills = cnt;
+		
+		updateTranslation();
+	}
+	
+	std::ostringstream out_stream;
+	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
+	bool vis;
+	Action::ActionType act;
+	
+	// Schleife ueber alle Skill labels
+	for (int j=0;j<m_nr_skills;j++)
+	{
+		out_stream.str("");
+		out_stream << "SkillImage" << j;
+		std::string skillImageWidget = m_skill_widgets_pics[j];
+
+		// Label welches das Skillicon zeigt
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillImageWidget);
+
+		// A gray semi-transparent layer is added on top of the items that are unavailable
+		std::string availAbility ("00FFFFFF");
+		std::string unavailAbility ("CC000000");
+		std::string usedColour (unavailAbility);
+		
+		act = ablts[j].m_type;
+
+		if (player->checkAbility(act))
+		{
+			// Ability is available.
+			usedColour = availAbility;
+		}
+		else
+		{
+			// Ability is unavailable.
+			usedColour = unavailAbility;
+		}
+
+		if (label->isPropertyPresent ("OverlayColour"))
+		{
+			label->setProperty ("OverlayColour", usedColour.c_str ());
+		}
+		else
+		{
+            SW_DEBUG ("Property not found: OverlayColour (in %s)", label->getNamePath().c_str());
+		}
+		
+		std::string skillButtonWidget = m_skill_widgets_btns[j];
+
+		button = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillButtonWidget));
+		vis = player->checkAbilityLearnable(act) && (player->getSkillPoints()>0);
+		if (button->isVisible() != vis)
+		{
+			button->setVisible(vis);
 		}
 	}
-
-
-	m_nr_tabs =0;
-	m_nr_skills =0;
-	m_nr_dependencies = 0;
-	m_shortkey_labels = 0;
-}
-
-void SkillTree::update()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	Player* player = m_document->getLocalPlayer();
-	CEGUI::TabControl* skilltree = (CEGUI::TabControl*) win_mgr.getWindow("SkilltreeTabs");
-	
-	CEGUI::Window* wnd;
-	std::vector<CEGUI::DefaultWindow*> tabs(3);
-	CEGUI::Window* label;
-	CEGUI::PushButton* button;
-	std::stringstream stream;
-	
-	if (player->getId() != m_player_id)
-	{
-		m_player_id = player->getId();
-		DEBUGX("new Player id %i",m_player_id);
-		
-		// alle bisherigen Tabs und Skills entfernen
-		
-		for (int i=0; i<m_nr_skills; i++)
-		{
-			stream.str("");
-			stream << "SkillImage"<<i;
-			wnd = win_mgr.getWindow(stream.str());
-			
-			wnd->getParent()->removeChildWindow(wnd);
-			win_mgr.destroyWindow(wnd);
-			
-			stream.str("");
-			stream << "SkillButton"<<i;
-			wnd = win_mgr.getWindow(stream.str());
-			
-			wnd->getParent()->removeChildWindow(wnd);
-			win_mgr.destroyWindow(wnd);
-		}
-		
-		for (int i=0; i<m_nr_dependencies; i++)
-		{
-			stream.str("");
-			stream << "SkillDependencyConnection"<<i;
-			wnd = win_mgr.getWindow(stream.str());
-			
-			wnd->getParent()->removeChildWindow(wnd);
-			win_mgr.destroyWindow(wnd);
-		}
-		m_nr_dependencies=0;
-		
-		for (int i=0; i<m_shortkey_labels; i++)
-		{
-			stream.str("");
-			stream << "SkillShortkeyLabel"<<i;
-			wnd = win_mgr.getWindow(stream.str());
-			
-			wnd->getParent()->removeChildWindow(wnd);
-			win_mgr.destroyWindow(wnd);
-		}
-		m_shortkey_labels=0;
-		
-		for (int i=0; i<m_nr_tabs; i++)
-		{
-			stream.str("");
-			stream << "SkilltreeTab"<<i;
-			wnd = win_mgr.getWindow(stream.str());
-			
-			skilltree->removeTab(wnd->getID());
-			win_mgr.destroyWindow(wnd);
-		}
-		
-		
-		
-		
-		// neue Tabs
-		// TODO: generisch ausprogrammieren
-		
-		m_nr_tabs =3;
-		for (int i=0; i<m_nr_tabs; i++)
-		{
-			stream.str("");
-			stream << "SkilltreeTab" << i;
-			
-			
-			tabs[i] = (CEGUI::DefaultWindow*) win_mgr.createWindow(CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "TabContentPane"), stream.str());
-			skilltree->addTab(tabs[i]);
-			
-			stream.str("");
-			stream << "SkilltreeTabs__auto_TabPane__Buttons__auto_btnSkilltreeTab" << i;
-			label =  win_mgr.getWindow(stream.str());
-			label->setInheritsAlpha(false);
-		}
-		
-		//Set tab name colors 
-		stream.str("");
-		stream << "FFD43D1A";
-
-		label = win_mgr.getWindow("SkilltreeTabs__auto_TabPane__Buttons__auto_btnSkilltreeTab0");
-		label->setProperty("NormalTextColour", stream.str());
-		label->setProperty("HoverTextColour", stream.str());
-		label->setProperty("SelectedTextColour", stream.str());
-		label->setProperty("PushedTextColour", stream.str());
-		label->setProperty("DisabledTextColour", stream.str());
-
-		stream.str("");
-		stream << "FF5CACEE";
-
-		label = win_mgr.getWindow("SkilltreeTabs__auto_TabPane__Buttons__auto_btnSkilltreeTab1");
-		label->setProperty("NormalTextColour", stream.str());
-		label->setProperty("HoverTextColour", stream.str());
-		label->setProperty("SelectedTextColour", stream.str());
-		label->setProperty("PushedTextColour", stream.str());
-		label->setProperty("DisabledTextColour", stream.str());
-
-		stream.str("");
-		stream << "FFD15FEE";
-
-		label = win_mgr.getWindow("SkilltreeTabs__auto_TabPane__Buttons__auto_btnSkilltreeTab2");
-		label->setProperty("NormalTextColour", stream.str());
-		label->setProperty("HoverTextColour", stream.str());
-		label->setProperty("SelectedTextColour", stream.str());
-		label->setProperty("PushedTextColour", stream.str());
-		label->setProperty("DisabledTextColour", stream.str());
-
-		// labels for skillpoints and next skillpoint
-		
-		label = win_mgr.getWindow("SkillpointsValueLabel");
-		label->setText("0");
-		
-		
-		label = win_mgr.getWindow("NextSkillpointsValueLabel");
-		label->setText("0");
-		
-		
-		CEGUI::UVector2 pos;
-		CEGUI::UVector2 bgpos;
-		std::string name,lname,bname;
-		Vector spos;
-		
-		DEBUGX("nr of abilities %i", player->getLearnableAbilities().size());
-		
-		std::map<int,LearnableAbility>::iterator it;
-		int cnt =0;
-		for (it = player->getLearnableAbilities().begin(); it != player->getLearnableAbilities().end(); ++it)
-		{
-			// Picture of skill
-			DEBUGX("ability %s nr %i",it->second.m_type.c_str(),cnt);
-			stream.str("");
-			stream << "SkillImage"<<cnt;
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-
-			tabs[it->second.m_skilltree_tab-1]->addChildWindow(label);
-			spos = it->second.m_skilltree_position;
-			pos = CEGUI::UVector2(cegui_reldim(spos.m_x), cegui_reldim( spos.m_y));
-
-			if (label->isPropertyDefault ("FrameEnabled"))
-			{
-				label->setProperty ("FrameEnabled", "True");
-			}
-			label->setPosition(pos);
-			label->setSize (CEGUI::UVector2 (cegui_reldim (DEFAULT_SKILL_ITEM_WIDTH), cegui_reldim (DEFAULT_SKILL_ITEM_HEIGHT)));
-
-			//
-			// Setup the button to be used to learn the corresponding skill.
-			// Also connect the callbacks to the button click events.
-			//
-			pos += CEGUI::UVector2 (cegui_reldim (DEFAULT_SKILL_ITEM_WIDTH - 0.01f), cegui_reldim (DEFAULT_SKILL_ITEM_HEIGHT - 0.05f));
-			stream.str ("");
-			stream << "SkillButton" << cnt;
-			button = static_cast<CEGUI::PushButton*>(win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "ImageButton"), stream.str ()));
-			button->setInheritsAlpha (false);
-			tabs [it->second.m_skilltree_tab - 1]->addChildWindow (button);
-			if (button->isPropertyPresent ("HoverImage"))
-			{
-				button->setProperty("HoverImage", "set:CharScreen image:PlusBtnReleased");
-			}
-			if (button->isPropertyPresent ("NormalImage"))
-			{
-				button->setProperty("NormalImage", "set:CharScreen image:PlusBtnReleased");
-			}
-			if (button->isPropertyPresent ("PushedImage"))
-			{
-				button->setProperty("PushedImage", "set:CharScreen image:PlusBtnPressed");
-			}
-			button->setPosition (pos);
-			button->setSize (CEGUI::UVector2 (cegui_reldim (DEFAULT_SKILL_BTN_WIDTH), cegui_reldim (DEFAULT_SKILL_BTN_HEIGHT)));
-			button->setID(it->first);
-			button->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onSkillLearnMouseClicked, this));
-			
-			//
-			// Set the skill picture settings. This loads the picture and sets specific properties.
-			// 
-			label->setInheritsAlpha(false);
-			label->setProperty("BackgroundEnabled", "false");
-			label->setID(it->first);
-			std::string imagename = it->second.m_image;
-			if (imagename == "")
-			{
-				imagename = "set:skills image:";
-				imagename += it->second.m_type;
-			}
-			label->setProperty("Image", imagename);
-			label->subscribeEvent(CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber(&SkillTree::onSkillMouseClicked, this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&SkillTree::onAbilityHover, this));
-			
-			//
-			// Create Connections for Dependencies
-			// loop over dependencies
-			for (std::list< Action::ActionType >::iterator at = it->second.m_req_abilities.begin(); at != it->second.m_req_abilities.end(); ++at)
-			{
-				// another loop over all abilities
-				std::map<int,LearnableAbility>::iterator jt;
-				for (jt = player->getLearnableAbilities().begin(); jt != player->getLearnableAbilities().end(); ++jt)
-				{
-					if (*at == jt->second.m_type)
-					{
-						// found dependency
-						Vector deppos = jt->second.m_skilltree_position;
-						
-						stream.str("");
-						stream << "SkillDependencyConnection"<<m_nr_dependencies;
-						label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-						tabs[it->second.m_skilltree_tab-1]->addChildWindow(label);
-						label->setMousePassThroughEnabled(true);
-						label->setInheritsAlpha(false);
-						label->setProperty("FrameEnabled", "false");
-						label->setProperty("BackgroundEnabled", "false");
-						label->moveToBack ();
-			
-						CEGUI::UVector2 start = CEGUI::UVector2 (cegui_reldim (deppos.m_x + (DEFAULT_SKILL_ITEM_WIDTH / 2) - 0.02f), cegui_reldim (deppos.m_y + DEFAULT_SKILL_ITEM_HEIGHT));
-						CEGUI::UVector2 end   = CEGUI::UVector2 (cegui_reldim (spos.m_x + (DEFAULT_SKILL_ITEM_WIDTH / 2) + 0.02f), cegui_reldim (spos.m_y));
-						label->setPosition(start);
-						label->setSize(end - start);
-						label->setID(jt->first);
-						
-						// distinguish vertical and diagonal connectors
-						if (deppos.m_x == spos.m_x)
-						{
-							label->setProperty("Image", "set:SumWarsExtras image:SkilltreeVertConnection"); 
-						}
-						else if (deppos.m_x <= spos.m_x)
-						{
-							label->setProperty("Image", "set:SumWarsExtras image:SkilltreeDiagConnection"); 
-						}
-						else
-						{
-							label->setProperty("Image", "set:SumWarsExtras image:SkilltreeDiag2Connection");
-							start= CEGUI::UVector2(cegui_reldim(spos.m_x+0.07f), cegui_reldim( deppos.m_y+0.1f));
-							end= CEGUI::UVector2(cegui_reldim(deppos.m_x+0.06f), cegui_reldim( spos.m_y));
-							label->setPosition(start);
-							label->setSize(end - start);
-						}
-						m_nr_dependencies++;
-						
-						DEBUGX("dependency %s from %s", it->second.m_type.c_str(), at->c_str());
-					}
-				}
-			}
-			
-			cnt ++;
-		}
-		
-		m_nr_skills = cnt;
-		
-		updateTranslation();
-	}
-	
-	std::ostringstream out_stream;
-	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	bool vis;
-	Action::ActionType act;
-	
-	// Schleife ueber alle Skill labels
-	for (int j=0;j<m_nr_skills;j++)
-	{
-		out_stream.str("");
-		out_stream << "SkillImage" << j;
-
-		// Label welches das Skillicon zeigt
-		label = win_mgr.getWindow(out_stream.str());
-
-		// A gray semi-transparent layer is added on top of the items that are unavailable
-		std::string availAbility ("00FFFFFF");
-		std::string unavailAbility ("CC000000");
-		std::string usedColour (unavailAbility);
-		
-		act = ablts[j].m_type;
-
-		if (player->checkAbility(act))
-		{
-			// Ability is available.
-			usedColour = availAbility;
-		}
-		else
-		{
-			// Ability is unavailable.
-			usedColour = unavailAbility;
-		}
-
-		if (label->isPropertyPresent ("OverlayColour"))
-		{
-			label->setProperty ("OverlayColour", usedColour.c_str ());
-		}
-		else
-		{
-			DEBUG ("Property not found: OverlayColour");
-		}
-		
-		out_stream.str("");
-		out_stream << "SkillButton" << j;
-		
-		button = static_cast<CEGUI::PushButton*>(win_mgr.getWindow(out_stream.str()));
-		vis = player->checkAbilityLearnable(act) && (player->getSkillPoints()>0);
-		if (button->isVisible() != vis)
-		{
-			button->setVisible(vis);
-		}
-	}
-	
-	// Loop over all Dependencies
-	for (int j=0;j<m_nr_dependencies;j++)
-	{
-		out_stream.str("");
-		out_stream << "SkillDependencyConnection" << j;
-
-		// Label for the dependency connecntion
-		label = win_mgr.getWindow(out_stream.str());
-		act = ablts[label->getID()].m_type;
-		
-		float alpha = 0.2;
-		if (player->checkAbility(act))
-		{
-			// Faehigkeit steht zur Verfuegung
-			alpha = 1.0;
-		}
-		else
-		{
-			alpha = 0.3;
-		}
-
-		if (label->getAlpha() != alpha)
-		{
-			label->setAlpha(alpha);
-		}
-	}
-	
-	// update labels for skillpoints and nextskillpoint at
-	// value for next skillpoint level calculation is hacky!
-	int skilllvls[20] = {2,3,5,7,10,15,20,25,30,35,40,45,50,60,70,80,90,100,1000};
-	//int nextlvl; // 2011.10.26: found as unused
-	int lvlid;
-	for (lvlid=0; lvlid<20; lvlid++)
-	{
-		if (player->getBaseAttr()->m_level < skilllvls[lvlid])
-			break;
-	}
-	
-	std::string lvlstr;
-	if (skilllvls[lvlid] != 1000)
-	{
-		std::stringstream lvlstream;
-		lvlstream << skilllvls[lvlid];
-		lvlstr = lvlstream.str();
-	}
-	else
-	{
-		lvlstr = "-";
-	}
-	
-	std::stringstream spstream;
-	spstream << player->getSkillPoints();
-	
-	// there is one label on _each_ tab
-	label =  win_mgr.getWindow("SkillpointsValueLabel");
-		if (label->getText() != spstream.str())
-		{
-			label->setText(spstream.str());
-		}
-		
-	label =  win_mgr.getWindow("NextSkillpointsValueLabel");
-		if (label->getText() != lvlstr)
-		{
-			label->setText(lvlstr);
-		}
-	
-	
-	// Markierer fuer Shortkeys einbauen
-	// Zaehler fuer die Fenster
-	
-	ShortkeyMap& shortkeys = m_document->getAbilityShortkeys();
-	ShortkeyMap::iterator it;
-	int nr =0;
-	
-	CEGUI::Window *label2;
-	bool right;
-	std::string keyname;
-	int key;
-	CEGUI::UVector2 pos;
-	
-	for (it = shortkeys.begin(); it != shortkeys.end(); ++it)
-	{
-		if (it->second < USE_SKILL_LEFT || it->second >USE_SKILL_RIGHT+200)
-			continue;
-		
-		DEBUGX("shortkey %i to %i",it->first,it->second);
-		key = it->first;
-		
-		right = false;
-		int id =0;
-		if (it->second >= USE_SKILL_RIGHT)
-		{
-			id = it->second - USE_SKILL_RIGHT;
-			right = true;
-		}
-		else
-		{
-			id = it->second - USE_SKILL_LEFT;
-		}
-		
-		if (ablts.count(id) ==0)
-			continue;
-		act= ablts[id].m_type;
-		
-		stream.str("");
-		stream << "SkillShortkeyLabel";
-		stream << nr;
-		
-		if (nr >= m_shortkey_labels)
-		{
-			m_shortkey_labels ++;
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
-			label->setInheritsAlpha(false);
-			label->setProperty("FrameEnabled", "false");
-			label->setProperty("BackgroundEnabled", "false");
-			label->setProperty("HorzFormatting", "Centred");
-			label->setID(-1);
-			label->setText("");
-			label->setSize(CEGUI::UVector2(cegui_reldim(0.07f), cegui_reldim( 0.05f)));
-			label->setAlpha(1.0);
-			label->setMousePassThroughEnabled(true);
-			label->setAlwaysOnTop(true);
-		}
-		else
-		{
-			label = win_mgr.getWindow(stream.str());
-		}
-		
-		stream.str("");
-		stream << "SkillImage" << id;
-		label2 = win_mgr.getWindow(stream.str());
-		
-		
-		if (label2->getParent() != label->getParent())
-		{
-			if (label->getParent() != 0)
-			{
-				label->getParent()->removeChildWindow (label);
-			}
-			label2->getParent()->addChildWindow (label);
-		}
-		
-		keyname = m_keyboard->getAsString ( (OIS::KeyCode) key);
-		if (label->getText() != keyname)
-		{
-			label->setText(keyname);
-		}
-		
-		if ((int) label->getID() != it->second)
-		{
-			label->setID(it->second);
-			pos = label2->getPosition();
-			if (right)
-			{
-				pos += CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.01f));
-			}
-			else
-			{
-				pos += CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f));
-			}
-			label->setPosition(pos);
-		}
-		
-		if (!label->isVisible())
-		{
-			label->setVisible(true);
-		}
-		nr ++;
-	}
-	
-	
-	// restliche Labels ausblenden
-	for (; nr<m_shortkey_labels; nr++)
-	{
-		stream.str("");
-		stream << "SkillShortkeyLabel";
-		stream << nr;
-			
-		label = win_mgr.getWindow(stream.str());
-		label->setVisible(false);
-	}
-	
-}
-
-
-void SkillTree::updateTranslation()
-{
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	std::vector<CEGUI::DefaultWindow*> tabs(m_nr_tabs);
-	
-	std::stringstream stream;
-	
-	for (int i=0; i<m_nr_tabs; i++)
-	{
-		stream.str("");
-		stream << "SkilltreeTab" << i;
-			
-		tabs[i] = (CEGUI::DefaultWindow*) win_mgr.getWindow(stream.str());
-	}
-	
-	// Ueberschriften der Tabs setzen
-	Player* player = m_document->getLocalPlayer();
-	if (m_nr_tabs <3)
-		return;
-	
-	PlayerBasicData* pdata = ObjectFactory::getPlayerData(player->getSubtype());
-	CEGUI::Window* label;
-	for (int i=0; i<3; i++)
-	{
-		tabs[i]->setText((CEGUI::utf8*) gettext(pdata->m_tabnames[i].c_str()));
-	}
-
-	label =  win_mgr.getWindow("SkillpointsLabel");
-	label->setText((CEGUI::utf8*) gettext("Skillpoints"));
-		
-	label =  win_mgr.getWindow("NextSkillpointsLabel");
-	label->setText((CEGUI::utf8*) gettext("Next Skillpoint at Level"));
-
-	if (win_mgr.isWindowPresent ("SkilltreeLabel"))
-	{
-		label =  win_mgr.getWindow("SkilltreeLabel");
-		label->setText((CEGUI::utf8*) gettext("Skilltree"));
-	}
-	else if (win_mgr.isWindowPresent ("Skilltree"))
+
+	// Loop over all Dependencies
+	for (int j=0;j<m_nr_dependencies;j++)
 	{
-		label =  win_mgr.getWindow("Skilltree");
-		if (label->isPropertyPresent ("Text"))
+		std::string skillConnWidget = m_skill_widgets_connections[j];
+
+		// Label for the dependency connecntion
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillConnWidget);
+		act = ablts[label->getID()].m_type;
+		
+		float alpha = 0.2;
+		if (player->checkAbility(act))
 		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Skilltree"));
+			// Faehigkeit steht zur Verfuegung
+			alpha = 1.0;
+		}
+		else
+		{
+			alpha = 0.3;
+		}
+
+		if (label->getAlpha() != alpha)
+		{
+			label->setAlpha(alpha);
 		}
 	}
-
-}
-
-void SkillTree::updateAbilityTooltip(unsigned int pos)
-{
-	Player* player = m_document->getLocalPlayer();
-	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	
-	
-	DEBUGX("update tooltip for %i %s", pos, ablts[pos].m_type.c_str());
-
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::Window* label;
-	std::ostringstream out_stream;
-	out_stream.str("");
-	out_stream << "SkillImage" << pos;
-	
-	label = win_mgr.getWindow(out_stream.str());
-	std::string tooltip = m_document->getAbilityDescription(ablts[pos].m_type);
-	
-	FormatedText txt =  CEGUIUtility::fitTextToWindow((CEGUI::utf8*)tooltip.c_str(), 400, CEGUIUtility::Centred, label->getFont());
-
-	TooltipManager::getSingleton().createTooltip(label, CEGUIUtility::getColourizedString(CEGUIUtility::White, txt.text.c_str(), CEGUIUtility::White));
-	
-}
-
-bool SkillTree::onSkillMouseClicked(const CEGUI::EventArgs& evt)
-{
-	Player* player = m_document->getLocalPlayer();
-	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-
-	if (we.button == CEGUI::LeftButton)
-	{
-		m_document->setLeftAction(ablts[id].m_type);
-	}
-
-	if (we.button == CEGUI::RightButton)
-	{
-		DEBUGX("right button pressed on skill %i",id);
-		m_document->setRightAction(ablts[id].m_type);
-	}
-	
-	return true;
-	
-}
-
-bool SkillTree::onSkillLearnMouseClicked(const CEGUI::EventArgs& evt)
-{
-	Player* player = m_document->getLocalPlayer();
-	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	// versuche Faehigkeit zu lernen
-	m_document->learnAbility(ablts[id].m_type);
-	
-	return true;
-}
-
-bool SkillTree::onCloseButtonClicked(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonSkilltreeClicked();
-	return true;
-}
-
-bool SkillTree::onAbilityHover(const CEGUI::EventArgs& evt)
-{
-
-	Player* player = m_document->getLocalPlayer();
-	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	DEBUGX("mouse entered Ability %i",id);
-	updateAbilityTooltip(id);
-	m_document->getGUIState()->m_hover_ability = ablts[id].m_type;
-	
-	return true;
-}
-
-bool SkillTree::onAbilityHoverLeave(const CEGUI::EventArgs& evt)
-{
-	m_document->getGUIState()->m_hover_ability = "noaction";
-	return true;
-}
-
+	
+	// update labels for skillpoints and nextskillpoint at
+	// value for next skillpoint level calculation is hacky!
+	int skilllvls[20] = {2,3,5,7,10,15,20,25,30,35,40,45,50,60,70,80,90,100,1000};
+	//int nextlvl; // 2011.10.26: found as unused
+	int lvlid;
+	for (lvlid=0; lvlid<20; lvlid++)
+	{
+		if (player->getBaseAttr()->m_level < skilllvls[lvlid])
+			break;
+	}
+	
+	std::string lvlstr;
+	if (skilllvls[lvlid] != 1000)
+	{
+		std::stringstream lvlstream;
+		lvlstream << skilllvls[lvlid];
+		lvlstr = lvlstream.str();
+	}
+	else
+	{
+		lvlstr = "-";
+	}
+	
+	std::stringstream spstream;
+	spstream << player->getSkillPoints();
+	
+	// there is one label on _each_ tab
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/SkillpointsValueLabel");
+	if (label->getText() != spstream.str())
+	{
+		label->setText(spstream.str());
+	}
+		
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/NextSkillpointsValueLabel");
+	if (label->getText() != lvlstr)
+	{
+		label->setText(lvlstr);
+	}
+	
+	// Markierer fuer Shortkeys einbauen
+	// Zaehler fuer die Fenster
+	
+	ShortkeyMap& shortkeys = m_document->getAbilityShortkeys();
+	ShortkeyMap::iterator it;
+	int nr =0;
+	
+	CEGUI::Window *label2;
+	bool right;
+	std::string keyname;
+	int key;
+	CEGUI::UVector2 pos;
+	
+	for (it = shortkeys.begin(); it != shortkeys.end(); ++it)
+	{
+		if (it->second < USE_SKILL_LEFT || it->second >USE_SKILL_RIGHT+200)
+			continue;
+		
+		DEBUGX("shortkey %i to %i",it->first,it->second);
+		key = it->first;
+		
+		right = false;
+		int id =0;
+		if (it->second >= USE_SKILL_RIGHT)
+		{
+			id = it->second - USE_SKILL_RIGHT;
+			right = true;
+		}
+		else
+		{
+			id = it->second - USE_SKILL_LEFT;
+		}
+		
+		if (ablts.count(id) ==0)
+			continue;
+		act= ablts[id].m_type;
+		
+		stream.str("");
+		stream << "SkillShortkeyLabel";
+		stream << nr;
+		
+		if (nr >= m_shortkey_labels)
+		{
+			m_shortkey_labels ++;
+			
+			std::map<int, std::string>::iterator it = m_skill_widgets_shortcuts.find (nr);
+			if (it != m_skill_widgets_shortcuts.end ())
+			{
+				label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, it->second);
+			}
+			else
+			{
+				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticText"), stream.str());
+			}
+
+			label->setInheritsAlpha(false);
+			label->setProperty("FrameEnabled", "false");
+			label->setProperty("BackgroundEnabled", "false");
+			label->setProperty("HorzFormatting", "Centred");
+			label->setID(-1);
+			label->setText("");
+			CEGUIUtility::setWidgetSizeRel (label, 0.07f, 0.05f);
+			label->setAlpha(1.0);
+			label->setMousePassThroughEnabled(true);
+			label->setAlwaysOnTop(true);
+
+			std::string shortkeywidget = label->getNamePath ().c_str ();
+			size_t string_pos = shortkeywidget.find ("SW/GameScreen/Skilltree_Holder/");
+			if (string_pos != std::string::npos)
+			{
+				shortkeywidget.erase (string_pos, 31);
+			}
+			m_skill_widgets_shortcuts[nr] = shortkeywidget;
+		}
+		else
+		{
+			std::string shortkeywidget = m_skill_widgets_shortcuts[nr];
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, shortkeywidget);
+		}
+		
+		std::string skillImageWidget = m_skill_widgets_pics[id];
+		label2 = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillImageWidget);
+		
+		
+		if (label2->getParent() != label->getParent())
+		{
+			SW_DEBUG ("Reassigning siblings: [%s], to image widgets [%s]", label->getNamePath ().c_str (), label2->getNamePath ().c_str ());
+
+			if (label->getParent() != 0)
+			{
+				CEGUIUtility::removeChildWidget (label->getParent(), label);
+			}
+			CEGUIUtility::addChildWidget (label2->getParent(), label);
+			
+			// Re-calculate the name of the widget. 
+			std::string shortkeywidget = label->getNamePath ().c_str ();
+			size_t string_pos = shortkeywidget.find ("SW/GameScreen/Skilltree_Holder/");
+			if (string_pos != std::string::npos)
+			{
+				shortkeywidget.erase (string_pos, 31);
+			}
+			m_skill_widgets_shortcuts[nr] = shortkeywidget;
+		}
+		
+		keyname = m_keyboard->getAsString ( (OIS::KeyCode) key);
+		if (label->getText() != keyname)
+		{
+			label->setText(keyname);
+		}
+		
+		if ((int) label->getID() != it->second)
+		{
+			label->setID(it->second);
+			pos = label2->getPosition();
+			if (right)
+			{
+				pos += CEGUI::UVector2(cegui_reldim(0.12f), cegui_reldim( 0.01f));
+			}
+			else
+			{
+				pos += CEGUI::UVector2(cegui_reldim(0.01f), cegui_reldim( 0.01f));
+			}
+			label->setPosition(pos);
+		}
+		
+		if (!label->isVisible())
+		{
+			label->setVisible(true);
+		}
+		nr ++;
+	}
+		
+	// restliche Labels ausblenden
+	for (; nr<m_shortkey_labels; nr++)
+	{
+		//stream.str("");
+		//stream << "SkillShortkeyLabel";
+		//stream << nr;
+		std::string shortkeywidget = m_skill_widgets_shortcuts[nr];
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, shortkeywidget);
+
+		label->setVisible(false);
+	}
+	
+}
+
+
+void SkillTree::updateTranslation()
+{
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	std::vector<CEGUI::DefaultWindow*> tabs(m_nr_tabs);
+	
+	std::stringstream stream;
+	
+	for (int i=0; i<m_nr_tabs; i++)
+	{
+		stream.str("");
+		stream << "Skilltree/skilltree_aux/SkilltreeTabs/__auto_TabPane__/";
+		stream << "SkilltreeTab" << i;
+			
+		tabs[i] = (CEGUI::DefaultWindow*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+	}
+	
+	// Ueberschriften der Tabs setzen
+	Player* player = m_document->getLocalPlayer();
+	if (m_nr_tabs <3)
+		return;
+	
+	PlayerBasicData* pdata = ObjectFactory::getPlayerData(player->getSubtype());
+	CEGUI::Window* label;
+	for (int i=0; i<3; i++)
+	{
+		tabs[i]->setText((CEGUI::utf8*) gettext(pdata->m_tabnames[i].c_str()));
+	}
+
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/SkillpointsLabel");
+	label->setText((CEGUI::utf8*) gettext("Skillpoints"));
+		
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree/skilltree_aux/SkillTreeAdditionalInfoHolder/NextSkillpointsLabel");
+	label->setText((CEGUI::utf8*) gettext("Next Skillpoint at Level"));
+
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Skilltree");
+	if (label->isPropertyPresent ("Text"))
+	{
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Skilltree"));
+	}
+
+}
+
+void SkillTree::updateAbilityTooltip(unsigned int pos)
+{
+	Player* player = m_document->getLocalPlayer();
+	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
+	
+	
+	DEBUGX("update tooltip for %i %s", pos, ablts[pos].m_type.c_str());
+
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::Window* label;
+	//std::ostringstream out_stream;
+	//out_stream.str("");
+	//out_stream << "SkillImage" << pos;
+	std::string skillImageWidget = m_skill_widgets_pics[pos];
+
+	
+	label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, skillImageWidget);
+	std::string tooltip = m_document->getAbilityDescription(ablts[pos].m_type);
+	
+	FormatedText txt =  CEGUIUtility::fitTextToWindow((CEGUI::utf8*)tooltip.c_str(), 400, CEGUIUtility::Centred, label->getFont());
+
+	TooltipManager::getSingleton().createTooltip(label, CEGUIUtility::getColourizedString(CEGUIUtility::White, txt.text.c_str(), CEGUIUtility::White));
+	
+}
+
+bool SkillTree::onSkillMouseClicked(const CEGUI::EventArgs& evt)
+{
+	Player* player = m_document->getLocalPlayer();
+	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
+	
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+
+	if (we.button == CEGUI::LeftButton)
+	{
+		m_document->setLeftAction(ablts[id].m_type);
+	}
+
+	if (we.button == CEGUI::RightButton)
+	{
+		DEBUGX("right button pressed on skill %i",id);
+		m_document->setRightAction(ablts[id].m_type);
+	}
+	
+	return true;
+	
+}
+
+bool SkillTree::onSkillLearnMouseClicked(const CEGUI::EventArgs& evt)
+{
+	Player* player = m_document->getLocalPlayer();
+	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
+	
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	// versuche Faehigkeit zu lernen
+	m_document->learnAbility(ablts[id].m_type);
+	
+	return true;
+}
+
+bool SkillTree::onCloseButtonClicked(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonSkilltreeClicked();
+	return true;
+}
+
+bool SkillTree::onAbilityHover(const CEGUI::EventArgs& evt)
+{
+
+	Player* player = m_document->getLocalPlayer();
+	std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
+	
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	DEBUGX("mouse entered Ability %i",id);
+	updateAbilityTooltip(id);
+	m_document->getGUIState()->m_hover_ability = ablts[id].m_type;
+	
+	return true;
+}
+
+bool SkillTree::onAbilityHoverLeave(const CEGUI::EventArgs& evt)
+{
+	m_document->getGUIState()->m_hover_ability = "noaction";
+	return true;
+}
+
--- a/src/gui/skilltree.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/skilltree.h	Thu Mar 20 19:04:28 2014 +0100
@@ -18,6 +18,9 @@
 
 #include "window.h"
 #include "OISKeyboard.h"
+
+#include <map>
+
 /**
  * \class SkillTree
  * \brief Fenster Faehigkeitenbaum
@@ -119,6 +122,15 @@
 		 */
 		std::string m_ceguiSkinName;
 
+		/**
+		 * \brief Holds the skill widgets.
+		 */
+		std::map<int, std::string> m_skill_widgets_pics;
+		std::map<int, std::string> m_skill_widgets_btns;
+
+		std::map<int, std::string> m_skill_widgets_connections;
+		std::map<int, std::string> m_skill_widgets_shortcuts;
+
 };
 
 #endif // __SUMWARS_GUI_SKILLTREE_H__
--- a/src/gui/sound.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "sound.h"
-
-#include "elementattrib.h"
-#include "random.h"
-#include <OgreResourceGroupManager.h>
-
-std::map<SoundName, SoundSystem::SoundSet> SoundSystem::m_sounds;
-
-std::map<std::string, SoundObject*> SoundSystem::m_sound_objects;
-
-float SoundSystem::m_sound_volume = 0.0f;
-ALCdevice * SoundSystem::m_device;
-ALCcontext* SoundSystem::m_context;
-std::list<SoundObject*> SoundSystem::m_ambient_sounds;
-
-Sound SoundSystem::getSound(SoundName sname)
-{
-	// Iterators for the first and last Sounds with the desired name.
-	std::map<SoundName, SoundSet>::iterator it;
-    it = m_sounds.find(sname);
-    if ( it == m_sounds.end())
-    {
-        return AL_NONE;
-    }
-    SoundSet& sset = it->second;
-    
-    // roll whether to play a sound
-    if (Random::random() > sset.m_probability)
-    {
-        return AL_NONE;
-    }
-    
-    // check that there are sounds in the list
-    if (sset.m_weights.empty())
-    {
-        return AL_NONE;
-    }
-
-
-    int soundnr = Random::randDiscrete(sset.m_weights);
-    DEBUGX("play sound %i for soundname %s",sset.m_sounds[soundnr], sname.c_str());
-    return sset.m_sounds[soundnr];
-}
-
-void SoundSystem::loadSoundFile(std::string file, SoundName sname, float weight)
-{
-	Ogre::FileInfoListPtr files;
-	Ogre::FileInfoList::iterator it;
-	std::string filename;
-	files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("sound",file);
-	
-	for (it = files->begin(); it != files->end(); ++it)
-	{
-		filename = it->archive->getName();
-		filename += "/";
-		filename += it->filename;
-		
-		DEBUGX("loading file %s",filename.c_str());
-		
-		int buffernr;
-		buffernr = alutCreateBufferFromFile(filename.c_str());
-
-		// Check for errors. We may get an error if the sound format is not supported.
-		if (buffernr !=  AL_NONE)
-		{
-			m_sounds[sname].m_weights.push_back(weight);
-            m_sounds[sname].m_sounds.push_back(buffernr);
-		}
-		else
-		{
-			ERRORMSG ("Could not load [%s]", filename.c_str ());
-		}
-	}
-	checkErrors();
-}
-
-void SoundSystem::loadSoundData(const char* pFilename)
-{
-	TiXmlDocument doc(pFilename);
-	bool loadOkay = doc.LoadFile();
-
-	if (loadOkay)
-	{
-		loadSoundInfos(&doc);
-	}
-	else
-	{
-		ERRORMSG("Failed to load file %s", pFilename);
-	}
-}
-
-void SoundSystem::loadSoundInfos(TiXmlNode* node)
-{
-	TiXmlNode* child;
-	if (node->Type()==TiXmlNode::TINYXML_ELEMENT && !strcmp(node->Value(), "Sound"))
-	{
-		ElementAttrib attr;
-		attr.parseElement(node->ToElement());
-		
-		std::string name,file;
-		attr.getString("name",name);
-        attr.getFloat("probability",m_sounds[name].m_probability, 1.0);
-
-		
-		for ( child = node->FirstChild(); child != 0; child = child->NextSibling())
-		{
-			if (child->Type()==TiXmlNode::TINYXML_ELEMENT)
-			{
-				attr.parseElement(child->ToElement());
-				if (!strcmp(child->Value(), "Soundfile"))
-				{
-					attr.getString("source",file);
-                    float weight;
-                    attr.getFloat("weight",weight,1.0);
-                    
-					DEBUGX("loading sound file %s for sound %s",file.c_str(), name.c_str());
-					loadSoundFile(file, name,weight);
-				}
-			}
-		}
-	}
-	else
-	{
-		for ( child = node->FirstChild(); child != 0; child = child->NextSibling())
-		{
-			loadSoundInfos(child);
-		}
-	}
-}
-
-void SoundSystem::init()
-{
-	m_device = 0;
-	m_context = 0;
-	// variante 1, geht unter ubuntu 9.10 nicht
-	/*
-    m_device = alcOpenDevice("Generic Software");
-    m_context = alcCreateContext(m_device, NULL);
-    alcMakeContextCurrent(m_context);
-	alutInitWithoutContext(0,0);
-	*/
-	
-	// variante 2, geht unter win nicht
-	//alutInit(0,0);
-	
-	// variante 3: zu testen
-	/*
-	const ALCchar *defaultDevice = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
-	m_device = alcOpenDevice(defaultDevice);
-	m_context = alcCreateContext(m_device, NULL);
-	alcMakeContextCurrent(m_context);
-	alutInitWithoutContext(0,0);
-	*/
-	
-	// variante 4: zu testen
-	
-	m_device = alcOpenDevice(NULL);
-    m_context = alcCreateContext(m_device, NULL);
-    alcMakeContextCurrent(m_context);
-	alutInitWithoutContext(NULL,NULL);
-	
-	alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
-	checkErrors();
-}
-
-void SoundSystem::setListenerPosition(Vector pos)
-{
-	ALfloat listenerPos[3]={0.0,0.0,0.0};
-	listenerPos[0] = pos.m_x;
-	listenerPos[1] = pos.m_y;
-
-	alListenerfv(AL_POSITION,listenerPos);
-	checkErrors();
-}
-
-void SoundSystem::update()
-{
-	std::list<SoundObject*>::iterator it;
-	for (it = m_ambient_sounds.begin(); it != m_ambient_sounds.end(); )
-	{
-		(*it)->update();
-		if ((*it)->isPlaying())
-		{
-			++it;
-		}
-		else
-		{
-			std::list<SoundObject*>::iterator todel = it;
-			++it;
-			deleteSoundObject(*todel);
-			m_ambient_sounds.erase(todel);
-		}
-	}
-}
-
-void SoundSystem::cleanup()
-{
-	std::map<SoundName, SoundSet>::iterator it;
-    std::vector<Sound>::iterator st;
-	for (it = m_sounds.begin(); it != m_sounds.end(); ++it)
-	{
-        for (st = it->second.m_sounds.begin(); st != it->second.m_sounds.end(); ++st)
-        {
-            alDeleteBuffers(1,&(*st));
-        }
-	}
-	m_sounds.clear();
-	
-	std::list<SoundObject*>::iterator jt;
-	for (jt = m_ambient_sounds.begin(); jt != m_ambient_sounds.end(); ++jt)
-	{
-		deleteSoundObject(*jt);
-	}
-	m_ambient_sounds.clear();
-		
-
-	clearObjects();
-}
-
-void SoundSystem::cleanupBuffers()
-{
-	// stop the soundsobjects from using buffer contents
-	std::list<SoundObject*>::iterator jt;
-	for (jt = m_ambient_sounds.begin(); jt != m_ambient_sounds.end(); ++jt)
-	{
-		(*jt)->stop();
-	}
-	
-	std::map<std::string, SoundObject*>::iterator it;
-	for (it = m_sound_objects.begin(); it != m_sound_objects.end(); ++it)
-	{
-		it->second->stop();
-	}
-	
-	std::vector<Sound>::iterator st;
-	for (std::map<SoundName, SoundSet>::iterator it = m_sounds.begin(); it != m_sounds.end(); ++it)
-	{
-		for (st = it->second.m_sounds.begin(); st != it->second.m_sounds.end(); ++st)
-		{
-			alDeleteBuffers(1,&(*st));
-		}
-	}
-	m_sounds.clear();
-}
-
-void SoundSystem::clearObjects()
-{
-	std::map<std::string, SoundObject*>::iterator it;
-	for (it = m_sound_objects.begin(); it != m_sound_objects.end(); ++it)
-	{
-		delete it->second;
-	}
-
-	m_sound_objects.clear();
-}
-
-
-void SoundSystem::setSoundVolume(float vol)
-{
-	m_sound_volume = vol;
-	
-	// Apply new sound volume for existing sound objects.
-	std::map<std::string, SoundObject*>::iterator it;
-	for (it = m_sound_objects.begin(); it != m_sound_objects.end(); ++it)
-	{
-		it->second->setVolume(vol);
-	}
-}
-
-SoundObject* SoundSystem::createSoundObject(std::string name)
-{
-	if (m_sound_objects.count(name)>0)
-	{
-		ERRORMSG("Sound object with name %s already exists",name.c_str());
-		return getSoundObject(name);
-	}
-	DEBUGX("creating sound object with name %s",name.c_str());
-
-	SoundObject* so;
-	so = new SoundObject(name);
-	so->setVolume(m_sound_volume);
-	m_sound_objects.insert(std::make_pair(name,so));
-	checkErrors();
-	
-	return so;
-
-}
-
-SoundObject* SoundSystem::getSoundObject(std::string name)
-{
-	std::map<std::string, SoundObject*>::iterator it;
-	it = m_sound_objects.find(name);
-	if (it ==m_sound_objects.end())
-	{
-		return 0;
-	}
-
-	return it->second;
-}
-
-void SoundSystem::deleteSoundObject(std::string name)
-{
-	std::map<std::string, SoundObject*>::iterator it;
-	it = m_sound_objects.find(name);
-	if (it !=m_sound_objects.end())
-	{
-		delete it->second;
-		m_sound_objects.erase(it);
-	}
-	else
-	{
-		ERRORMSG("Cant delete Sound Object %s",name.c_str());
-	}
-}
-
-void SoundSystem::deleteSoundObject(SoundObject* object)
-{
-	deleteSoundObject(object->getName());
-}
-
-
-bool SoundSystem::getSourceHandle(ALuint &handle)
-{
-	bool success = true;
-	
-	alGenSources(1, &handle);
-	if (alGetError() != AL_NO_ERROR)
-	{
-		success = false;
-	}
-	else
-	{
-		//alSourcei(m_handle, AL_LOOPING, AL_TRUE);
-		alSourcef(handle, AL_REFERENCE_DISTANCE, 5);
-		alSourcef(handle, AL_ROLLOFF_FACTOR, 0.5);
-		
-		alSourcef(handle,AL_MAX_DISTANCE , 20);
-	}
-	return success;
-}
-
-void SoundSystem::playAmbientSound(SoundName sname, float volume, Vector* position)
-{
-	static int id=1;
-	std::stringstream stream;
-	stream << "ambient#"<<id;
-	id ++;
-	
-	DEBUGX("play ambient sound %s volume %f",sname.c_str(), volume);
-	
-	SoundObject* sobj = createSoundObject(stream.str());
-	sobj->setVolume(volume*m_sound_volume);
-	sobj->setSound(sname);
-	
-	// if position is given: set it,
-	// otherwise the object is directly attached to the listener
-	if (position != 0)
-	{
-		sobj->setPosition(*position);
-	}
-	else
-	{
-		sobj->setPositionRelative(Vector(0,0));
-	}
-	m_ambient_sounds.push_back(sobj);
-}
-
-bool SoundSystem::checkErrors()
-{
-	int error = alGetError();
-
-	if(error != AL_NO_ERROR)
-	{
-		ERRORMSG("AL error %i: %s",error, alGetString(error)) ;
-		return true;
-	}
-	return false;
-}
-
-
-
-
-
-SoundObject::SoundObject(std::string name, Vector pos)
-{
-	/*
-	m_handle_valid = SoundSystem::getSourceHandle(m_handle);
-	setPosition(pos);
-	SoundSystem::checkErrors();
-	*/
-	m_handle_valid = false;
-	m_sound_name = "";
-	m_name = name;
-	m_global_volume = 1.0;
-	m_volume = 1.0;
-}
-
-SoundObject::~SoundObject()
-{
-	if (m_handle_valid)
-	{
-		alDeleteSources(1,&m_handle);
-	}
-}
-
-void SoundObject::setPosition(Vector pos)
-{
-	m_position = pos;
-	
-
-	if (m_handle_valid)
-	{
-		ALfloat spos[3]={0.0,0.0,0.0};
-		spos[0] = pos.m_x;
-		spos[1] = pos.m_y;
-	
-		alSourcefv(m_handle, AL_POSITION, spos);
-		alSourcei (m_handle, AL_SOURCE_RELATIVE, AL_FALSE);
-	}
-}
-
-void SoundObject::setPositionRelative(Vector pos)
-{
-	m_position = pos;
-	
-	if (m_handle_valid)
-	{
-		ALfloat spos[3]={0.0,0.0,0.0};
-		spos[0] = pos.m_x;
-		spos[1] = pos.m_y;
-	
-		alSourcefv(m_handle, AL_POSITION, spos);
-		alSourcei (m_handle, AL_SOURCE_RELATIVE, AL_TRUE      );
-	}
-}
-
-Vector SoundObject::getPosition()
-{
-	return m_position;
-}
-
-void SoundObject::setSound(Sound snd)
-{
-	// if this object has no valid handle, try to get a valid one
-	if (!m_handle_valid)
-	{
-		m_handle_valid = SoundSystem::getSourceHandle(m_handle);
-		setPosition(m_position);
-		setVolume(m_volume);
-	}
-	
-	if (m_handle_valid)
-	{
-		alSourcei(m_handle, AL_BUFFER, snd);
-		SoundSystem::checkErrors();
-	}
-	else
-	{
-		m_sound_name = "";
-	}
-}
-
-void SoundObject::setSound(SoundName sname)
-{
-	update();
-
-	if (m_sound_name != "")
-	{
-		return;
-	}
-
-	if (sname == "")
-	{
-		m_sound_name = "";
-		return;
-	}
-
-
-	Sound snd = SoundSystem::getSound(sname);
-	if (snd != AL_NONE)
-	{
-		m_sound_name =sname;
-		setSound(snd);
-		play();
-	}
-}
-
-void SoundObject::play()
-{
-	if (m_handle_valid)
-	{
-		alSourcePlay(m_handle);
-		SoundSystem::checkErrors();
-	}
-}
-
-void SoundObject::stop()
-{
-	if (m_handle_valid)
-	{
-		alSourceStop(m_handle);
-		SoundSystem::checkErrors();
-	}
-	m_sound_name="";
-}
-
-void SoundObject::rewind()
-{
-	if (m_handle_valid)
-	{
-		alSourceRewind(m_handle);
-		SoundSystem::checkErrors();
-	}
-}
-
-void SoundObject::update()
-{
-	if (m_handle_valid)
-	{
-		int state;
-		alGetSourcei(m_handle,AL_SOURCE_STATE,&state);
-
-		if (state == AL_STOPPED)
-		{
-			m_sound_name = "";
-			alDeleteSources(1, &m_handle);
-			m_handle_valid = false;
-		}
-	}
-}
-
-bool SoundObject::isPlaying()
-{
-	if (!m_handle_valid)
-		return false;
-	
-	int state;
-	alGetSourcei(m_handle,AL_SOURCE_STATE,&state);
-	if (state == AL_STOPPED)
-		return false;
-	
-	return true;
-}
-
--- a/src/gui/sound.h	Sat Jan 25 11:22:23 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,412 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __SUMWARS_GUI_SOUND_H__
-#define __SUMWARS_GUI_SOUND_H__
-
-#ifdef WIN32
-	#include <al.h>
-#else
-	#include <AL/al.h>
-#endif
-
-#include <AL/alut.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <fstream>
-#include <iostream>
-#include <map>
-#include <queue>
-#include <set>
-
-#include "geometry.h"
-#include <tinyxml.h>
-
-/**
- * \brief Name eines Sounds
- */
-typedef std::string SoundName;
-
-/**
- * \brief Name einer Situation in der ein Sound abgespielt wird
- */
-typedef std::string SoundTarget;
-
-/**
- * \brief OpenAL ID eines Sounds
- */
-typedef ALuint Sound;
-
-class SoundObject;
-
-/**
- * \class SoundSystem
- * \brief Basisklasse fuer Sound
- */
-class SoundSystem
-{
-	public:
-        /**
-         * \brief Structure for a Set of sounds that might be played on a specific occasion
-         */
-        struct SoundSet
-        {
-            /**
-             * \brief probability, that a sound it played at all
-             */
-            float m_probability;
-            
-            /**
-             * \brief Number of weights for the different sounds
-             * The relative values of the weights determine the probability which sound is played, if a sound is played
-             */
-            std::vector<float> m_weights;
-            
-            /**
-             * \brief AL handles of the sounds
-             */
-            std::vector<Sound> m_sounds;
-        };
-        
-		/**
-		 * \fn static void init()
-		 * \brief initialisiert das Soundsystem
-		 */
-		static void init();
-
-		/**
-		 * \fn static Sound getSound(SoundName sname)
-		 * \brief Gibt zu einem gegebenen Name einen Sound aus
-		 * \param sname Name des Sounds
-		 */
-		static Sound getSound(SoundName sname);
-
-		/**
-		 * \brief Laedt ein Soundfile und registriert den Sound unter einen gegebenen Name
-		 */
-		static void loadSoundFile(std::string file, SoundName sname, float weight);
-
-		/**
-		 * \fn static void loadSoundData(const char* pFilename)
-		 * \brief Laedt Daten zu Sounds aus einer XML Datei
-		 * \param pFilename Dateiname
-		 */
-		static void loadSoundData(const char* pFilename);
-
-		/**
-		 * \fn static void setListenerPosition(Vector pos)
-		 * \brief Setzt die Position an der der Schall gehoehrt wird
-		 */
-		static void setListenerPosition(Vector pos);
-		
-		static bool checkErrors();
-
-		/**
-		 * \brief updates the object
-		 */
-		static void update();
-		
-		/**
-		 * \fn static void cleanup()
-		 * \brief gibt Speicher frei
-		 */
-		static void cleanup();
-		
-		/**
-		 * \brief Deletes the buffers only and prepares for reloading
-		 */
-		static void cleanupBuffers();
-		
-		/**
-		 * \fn static void clearObjects()
-		 * \brief Loescht alle SoundObjekte
-		 */
-		static void clearObjects();
-
-		/**
-		 * \fn SoundObject* getSoundObject(std::string name)
-		 * \brief Gibt das SoundObjekt mit dem angegebenen Name aus
-		 * \param name Name
-		 */
-		static SoundObject* getSoundObject(std::string name);
-
-		/**
-		 * \fn static void createSoundObject(std::string name)
-		 * \brief Erzeugt ein SoundObjekt mit dem angegebenen Name
-		 * \param name Name
-		 */
-		static SoundObject* createSoundObject(std::string name);
-
-		/**
-		 * \fn static void deleteSoundObject(std::string name)
-		 * \brief Loescht ein SoundObjekt mit dem angegebenen Name
-		 */
-		static void deleteSoundObject(std::string name);
-
-		/**
-		 * \fn static void deleteSoundObject(SoundObject* object)
-		 * \brief Loescht das angegebene SoundObjekt
-		 * \param object Soundobjekt
-		 */
-		static void deleteSoundObject(SoundObject* object);
-
-		/**
-		 * \brief tries to create a valid OpenAL source handle
-		 * \param handle return parameter, containing the handle
-		 * \return true if the handle is valid
-		 */
-		static bool getSourceHandle(ALuint &handle);
-		
-		/**
-		 * \fn static void setSoundVolume(float vol)
-		 * \brief Stellt die Lautstaerke ein
-		 * \param vol Lautstaerke (0-1)
-		 */
-		static void setSoundVolume(float vol);
-
-		/**
-		 * \fn static float getSoundVolume()
-		 * \brief Gibt die Lautstaerke des Sounds aus
-		 */
-		static float getSoundVolume()
-		{
-			return m_sound_volume;
-		}
-		
-		/**
-		 * \brief Plays an ambient sound
-		 * \param sname Name of the sound
-		 * \param volume Volume of the sound
-		 * \param position Position of the sound
-		 * If position is NULL, the sound is attached to the listener.
-		 */
-		static void playAmbientSound(SoundName sname, float volume = 1.0, Vector* position=0); 
-
-	private:
-
-		static void loadSoundInfos(TiXmlNode* node);
-
-		/**
-		 * \brief Bildet die Name der Sounds auf die OpenAL IDs ab
-		 */
-		static std::map<SoundName, SoundSet> m_sounds;
-
-		/**
-		 * \var static std::map<std::string, SoundObject*> m_sound_objects
-		 * \brief Schallquellen sortiert nach Name
-		 */
-		static std::map<std::string, SoundObject*> m_sound_objects;
-
-		/**
-		 * \var static float m_sound_volume
-		 * \brief Lautstaerke
-		 */
-		static float m_sound_volume;
-		
-		/**
-		 * \brief Sound Device
-		 */
-		static ALCdevice * m_device;
-		
-		/**
-		 * \brief AL Sound Kontext
-		 */
-		static ALCcontext* m_context;
-		
-		/**
-		 * \brief List of background sounds played without specific object
-		 */
-		static std::list<SoundObject*> m_ambient_sounds;
-
-};
-
-/**
- * \class SoundObject
- * \brief Schallquelle
- */
-class SoundObject
-{
-	public:
-		/**
-		 * \fn SoundObject(std::string name, Vector pos = Vector(0,0))
-		 * \brief Konstruktor
-		 * \param pos Position
-		 * \param name Name
-		 */
-		SoundObject(std::string name, Vector pos = Vector(0,0));
-
-		/**
-		 * \fn ~SoundObject()
-		 * \brief Destruktor
-		 */
-		~SoundObject();
-
-		/**
-		 * \fn void setPosition(Vector pos)
-		 * \brief Setzt die Position der Schallquelle
-		 * \param pos neue Position
-		 */
-		void setPosition(Vector pos);
-		
-		/**
-		 * \brief Sets the position relative to the listener
-		 * \param pos relative Position
-		 **/
-		void setPositionRelative(Vector pos);
-
-		/**
-		 * \fn Vector getPosition()
-		 * \brief Gibt die Position der Schallquelle aus
-		 */
-		Vector getPosition();
-
-		/**
-		 * \fn void setSound(Sound snd)
-		 * \brief Setzt den abgespielten Sound der Schallquelle
-		 * \param snd Sound ID
-		 */
-		void setSound(Sound snd);
-
-		/**
-		 * \fn void setSound(SoundName sname)
-		 * \brief Setzt den abgespielten Sound
-		 * \param sname Name des Sounds
-		 */
-		void setSound(SoundName sname);
-
-		/**
-		 * \fn void setVolume(float vol)
-		 * \brief Setzt die Lautstaerke der Schallquelle
-		 * \param vol Lautstaerke (0-1)
-		 */
-		void setVolume(float vol)
-		{
-			if (m_handle_valid) 
-				alSourcef(m_handle, AL_GAIN, vol*m_global_volume);
-			m_volume = vol;
-		}
-		
-		/**
-		 * \fn void setGlobalVolume(float vol)
-		 * \brief Setzt den globalen Faktor der Lautstaerke
-		 * \param vol Lautstaerke (0-1)
-		 */
-		void setGlobalVolume(float vol)
-		{
-			if (m_handle_valid) 
-				alSourcef(m_handle, AL_GAIN, m_volume*vol);
-			m_global_volume = vol;
-		}
-
-		/**
-		 * \fn void play()
-		 * \brief Startet das Abspielen des eingestellten Sounds
-		 */
-		void play();
-
-		/**
-		 * \fn void setPlayOffset(float ms, float tol)
-		 * \brief Setzt den Zeitpunkt des Sounds der gerade abgespielt wird
-		 * \param ms Zeitpunkt in ms seit Beginn
-		 * \param tol Toleranzwert - wenn der aktuelle Zustand weniger als um tol abweicht wird nichts geaendert
-		 */
-		void setPlayOffset(float ms, float tol);
-
-		/**
-		 * \fn void stop()
-		 * \brief Stoppt das Abspielen des eingestellten Sounds
-		 */
-		void stop();
-
-		/**
-		 * \fn void rewind()
-		 * \brief Spult den abgespielten Sound zurueck
-		 */
-		void rewind();
-
-		/**
-		 * \fn SoundName getSoundName()
-		 * \brief Gibt den Name des aktuell abgespielten Sounds aus
-		 */
-		SoundName getSoundName()
-		{
-			return m_sound_name;
-		}
-
-		/**
-		 * \fn void update()
-		 * \brief aktualisiert internen Status
-		 */
-		void update();
-
-
-		/**
-		 * \fn std::string getName()
-		 * \brief gibt den Name aus
-		 */
-		std::string getName()
-		{
-			return m_name;
-		}
-		
-		/**
-		 * \brief indicates if the sound source is playing sound right now
-		 */
-		bool isPlaying();
-
-	private:
-		/**
-		 * \var ALuint m_handle
-		 * \brief OpenAL handle fuer die Soundquelle
-		 **/
-		ALuint m_handle;
-		
-		/**
-		 * \brief true, if the handle belongs to a valid OpenAL Source
-		 */
-		bool m_handle_valid;
-
-		/**
-		 * \var SoundName m_sound_name
-		 * \brief Name des aktuellen Sounds
-		 */
-		SoundName m_sound_name;
-
-		/**
-		 * \var std::string m_name
-		 * \brief Name des Objektes
-		 */
-		std::string m_name;
-		
-		/**
-		 * \brief Zusatzfaktor zum eigenen Lautstaerkewert
-		 */
-		float m_global_volume;
-		
-		/**
-		 * \brief Lautstarke
-		 */
-		float m_volume;
-		
-		/**
-		 * \brief position of the sound source
-		 */
-		Vector m_position;
-};
-
-#endif // __SUMWARS_GUI_SOUND_H__
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui/soundhelper.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,366 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//
+// Includes
+//
+
+// Own header
+#include "soundhelper.h"
+
+// Debugging helper
+#include "debug.h"
+
+// Resource management and control for Ogre.
+#include "OgreArchive.h"
+#include "OgreResourceGroupManager.h"
+
+// Sound library
+#include "gussound.h"
+
+
+// Allow a shorter name for the sound manager.
+using gussound::SoundManager;
+
+
+
+bool SoundHelper::singleThreadedSoundAccess_ = true;
+
+
+///
+/// Load a file (E.g. an XML file) containing sound group definitions.
+///
+bool SoundHelper::loadSoundGroupsFromFile (const std::string& fileName)
+{
+	// TODO: get extension from file. Create parsing implementation based on extension (E.g. XML).
+	// Current assumption: the file is an XML file.
+
+	// Load XML document.
+	TiXmlDocument doc (fileName.c_str ());
+	bool loadOkay = doc.LoadFile();
+
+	if (! loadOkay)
+	{
+		// Failed to load.
+		ERRORMSG ("Failed to load file %s", fileName.c_str ());
+		return false;
+	}
+
+	loadSoundInfos (&doc);
+
+
+	return true;
+}
+
+
+///
+/// Load content from an XML Node.
+///
+void SoundHelper::loadSoundInfos (TiXmlNode* node)
+{
+	// File was loaded... time to parse the contents.
+	TiXmlNode* child;
+	if (node->Type () == TiXmlNode::TINYXML_ELEMENT && !strcmp (node->Value (), "Sound"))
+	{
+		ElementAttrib attr;
+		attr.parseElement (node->ToElement ());
+		
+		std::string groupName;
+		float probability = 0.0f;
+		int sumOfMemberWeights = 0;
+
+		attr.getString ("name", groupName);
+		attr.getFloat ("probability", probability, 1.0);
+
+		// Add the group to the repository.
+		SoundManager::getPtr ()->addSoundGroup (groupName);
+
+		for (child = node->FirstChild (); child != 0; child = child->NextSibling ())
+		{
+			if (child->Type () == TiXmlNode::TINYXML_ELEMENT)
+			{
+				attr.parseElement (child->ToElement ());
+				if (! strcmp (child->Value (), "Soundfile"))
+				{
+					std::string fileName;
+					int weight;
+
+					attr.getString ("source", fileName);
+					attr.getInt ("weight", weight, 1.0);
+
+					sumOfMemberWeights += weight;
+                    
+					DEBUGX ("loading sound file %s for sound %s", fileName.c_str (), groupName.c_str ());
+
+					// Add/load the sound file
+					try
+					{
+						std::string fullPath = getNameWithPathForSoundFile (fileName);
+						SoundManager::getPtr ()->getRepository ()->addSound (fileName.c_str ()  // name
+																		, fullPath.c_str ()  // file & path
+																		, true // load entire sound into memory? don't do it for songs! only for small sounds.
+																		, gussound::GSC_Effect  // a category for the sound; you can change the volume for all sounds in a category.
+																		, false); // want to make sure this sound is only played from one source at one time?
+					}
+					catch (std::exception&)
+					{
+						// An exception is thrown if the sound already exists.
+						// That's ok for us, as we're using the file name as the sound name, so if it exists, it means it's already in the system.
+					}
+
+					// Assign the sound file to the group.
+					SoundManager::getPtr ()->getSoundGroup (groupName)->addSound (fileName.c_str (), weight);
+				}
+			}
+		}
+
+		if (probability < 1.0f)
+		{
+			// the probability is provided only for playable sounds.
+			// we need to add a no-sound entry in this case.
+			int emptySoundWeight = 1;
+			// probability ... sumOfMemberWeights
+			// 1.0 - probability       ... emptySoundWeight
+			emptySoundWeight = sumOfMemberWeights * ((1.0 - probability) / probability);
+			// we need to calculate the weight for this one.
+			SoundManager::getPtr ()->getSoundGroup (groupName)->addEmptySlot (emptySoundWeight);
+
+			SW_DEBUG ("Added for group [%s], probability %f,  member weights %d, final sound weight %d", groupName.c_str (), probability, sumOfMemberWeights, emptySoundWeight);
+		}
+	}
+	else
+	{
+		// Run through the entire tree
+		for ( child = node->FirstChild(); child != 0; child = child->NextSibling())
+		{
+			loadSoundInfos(child);
+		}
+	}
+}
+
+
+
+///
+/// Return the full path to the music file (passing through Ogre resource management), from the received file name.
+///
+std::string SoundHelper::getNameWithPathForMusicTrack (const std::string& trackName)
+{
+	std::string result (trackName);
+
+	Ogre::FileInfoListPtr files;
+	Ogre::FileInfoList::iterator it;
+	files = Ogre::ResourceGroupManager::getSingleton ().findResourceFileInfo ("music", trackName);
+
+	it = files->begin ();
+	if (it != files->end ())
+	{
+		std::string filename;
+		result = it->archive->getName ();
+		result += "/";
+		result += it->filename;
+	}
+
+	return result;
+}
+
+
+
+///
+/// Add a track to a playlist by using only the file name (without the path).
+/// @param playlistName The name of the playlist to add the music track to
+/// @param shortFileName The name of the file containing the track. It doesn't need a path.
+/// @return true of the track is added successfully, false otherwise.
+///
+bool SoundHelper::addPlaylistTrackByShortName (const std::string& playlistName, const std::string& shortFileName)
+{
+	std::string fileName;
+	try
+	{
+		fileName = SoundHelper::getNameWithPathForMusicTrack (shortFileName);
+		// One could call the following function to add an "anonymous" track (with a name such as "track_01").
+		SoundManager::getPtr ()->addPlaylistTrack (playlistName, fileName);
+	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Caught exception while trying to add to playlist [%s] track file [%s]: %s", playlistName.c_str (), fileName.c_str (), e.what ());
+		return false;
+	}
+	return true;
+}
+
+
+
+
+///
+/// Return the full path to the sound file (passing through Ogre resource management), from the received file name.
+///
+std::string SoundHelper::getNameWithPathForSoundFile (const std::string& soundFile)
+{
+	std::string result (soundFile);
+
+	Ogre::FileInfoListPtr files;
+	Ogre::FileInfoList::iterator it;
+	files = Ogre::ResourceGroupManager::getSingleton ().findResourceFileInfo ("sound", soundFile);
+
+	it = files->begin ();
+	if (it != files->end ())
+	{
+		std::string filename;
+		result = it->archive->getName ();
+		result += "/";
+		result += it->filename;
+	}
+
+	return result;
+}
+
+
+
+///
+/// Load a playlist from an XML file.
+/// @param fileName The name of the XML file containing the playlist tracks.
+///
+bool SoundHelper::loadPlaylistFromXMLFile (const std::string& fileName)
+{
+	// Load XML document.
+	TiXmlDocument doc (fileName.c_str ());
+	bool loadOkay = doc.LoadFile();
+
+	if (! loadOkay)
+	{
+		// Failed to load.
+		ERRORMSG ("Failed to load file %s", fileName.c_str ());
+		return false;
+	}
+
+	// Call the actual loading.
+	return loadPlaylistFromXMLNode (&doc);
+}
+
+
+
+///
+/// Load content from an XML Node.
+/// @param node The XML node to load from. Note: currently tied to the tinyxml implementation.
+///
+bool SoundHelper::loadPlaylistFromXMLNode (TiXmlNode* node)
+{
+	bool result = true;
+
+	// File was loaded... time to parse the contents.
+	TiXmlNode* child;
+	if (node->Type () == TiXmlNode::TINYXML_ELEMENT && !strcmp (node->Value (), "Playlist"))
+	{
+		ElementAttrib attr;
+		attr.parseElement (node->ToElement ());
+		
+		std::string playlistName;
+		bool repeatOption;
+		bool shuffleOption;
+		//float probability;
+
+		attr.getString ("name", playlistName);
+		attr.getBool ("repeat", repeatOption, true);
+		attr.getBool ("shuffle", shuffleOption, false);
+
+		// Register the playlist
+		SoundManager::getPtr ()->getMusicPlayer ()->registerPlaylist (playlistName);
+		SoundManager::getPtr ()->getMusicPlayer ()->setPlaylistRepeat (playlistName, repeatOption);
+		SoundManager::getPtr ()->getMusicPlayer ()->setPlaylistShuffle (playlistName, shuffleOption);
+
+		SW_DEBUG ("Got playlist: %s, repeat: %d, shuffle: %d", playlistName.c_str (), repeatOption, shuffleOption);
+
+		for (child = node->FirstChild (); child != 0; child = child->NextSibling ())
+		{
+			if (child->Type () == TiXmlNode::TINYXML_ELEMENT)
+			{
+				attr.parseElement (child->ToElement ());
+				if (! strcmp (child->Value (), "Track"))
+				{
+					// We only need the file name for each playlist track.
+					std::string fileName;
+					attr.getString ("source", fileName);
+                    
+					result &= SoundHelper::addPlaylistTrackByShortName (playlistName, fileName);
+				}
+			}
+		}
+	}
+	else
+	{
+		// Run through the entire tree
+		for ( child = node->FirstChild(); child != 0; child = child->NextSibling())
+		{
+			result &= loadPlaylistFromXMLNode(child);
+		}
+	}
+	return result;
+}
+
+
+
+///
+/// Play a sound for the current player, at his location. (Basically a 2D sound).
+///
+void SoundHelper::playAmbientSoundGroup (const std::string& soundGroupID)
+{
+	try
+	{
+		std::string soundToPlay;
+		soundToPlay = SoundManager::getPtr ()->getSoundGroup (soundGroupID)->getRandomSound ();
+		if (soundToPlay != gussound::EMPTY_SLOT_NAME)
+		{
+			SoundManager::getPtr ()->getRepository ()->getSound (soundToPlay)->play2D ();
+		}
+	}
+	catch (std::exception& e)
+	{
+		SW_DEBUG ("Encountered exception: %s", e.what ());
+	}
+}
+
+
+
+///
+/// Play a sound group at a given location.
+///
+void SoundHelper::playSoundGroupAtPosition (const std::string& soundGroupID, double posX, double posY, double posZ)
+{
+	try
+	{
+		std::string soundToPlay;
+		soundToPlay = SoundManager::getPtr ()->getSoundGroup (soundGroupID)->getRandomSound ();
+		if (soundToPlay != gussound::EMPTY_SLOT_NAME && soundToPlay != gussound::EMPTY_SOUND_FILE)
+		{
+			SoundManager::getPtr ()->getRepository ()->getSound (soundToPlay)->play3D (posX, posY, posZ);
+		}
+	}
+	catch (std::exception& e)
+	{
+		// This can happen if the group name is not valid. Or if the group has missing files. Or if the group is empty.
+		SW_DEBUG ("Caught exception while trying to play sound group [%s]: %s", soundGroupID.c_str (), e.what ());
+	}
+}
+
+
+/// Send a signal to the sound manager so that it knows that it needs to call elapseTime.
+/// Calling this function will do nothing if the sound manager is controlled in a separate thread.
+void SoundHelper::signalSoundManager ()
+{
+	if (singleThreadedSoundAccess_)
+	{
+		SoundManager::getPtr ()->elapseTime ();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui/soundhelper.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,91 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SUMWARS_GUI_SOUNDHELPER_H__
+#define __SUMWARS_GUI_SOUNDHELPER_H__
+
+//
+// Includes
+//
+
+// string support
+#include <string>
+
+// XML help class.
+#include "elementattrib.h"
+
+// Geometry utility functions built into sumwars.
+#include "geometry.h"
+
+
+///
+/// A helper class for sound operations that are not part of the used libraries and don't make sense to be included in the
+/// libraries (E.g. if they would create additional dependencies).
+///
+class SoundHelper
+{
+public:
+
+	/// Load a file (E.g. an XML file) containing sound group definitions.
+	static bool loadSoundGroupsFromFile (const std::string& fileName);
+
+	/// Return the full path to the music file (passing through Ogre resource management), from the received file name.
+	static std::string getNameWithPathForMusicTrack (const std::string& trackName);
+
+	/// Return the full path to the sound file (passing through Ogre resource management), from the received file name.
+	static std::string getNameWithPathForSoundFile (const std::string& soundFile);
+
+	/// Play a sound for the current player, at his location. (Basically a 2D sound).
+	static void playAmbientSoundGroup (const std::string& soundGroupID);
+
+	/// Play a sound group at a given location.
+	static void playSoundGroupAtPosition (const std::string& soundGroupID, double posX, double posY, double posZ);
+	
+	/// Add a track to a playlist by using only the file name (without the path).
+	/// @param playlistName The name of the playlist to add the music track to
+	/// @param shortFileName The name of the file containing the track. It doesn't need a path.
+	/// @return true of the track is added successfully, false otherwise.
+	static bool addPlaylistTrackByShortName (const std::string& playlistName, const std::string& shortFileName);
+
+	/// Load a playlist from an XML file.
+	/// @param fileName The name of the XML file containing the playlist tracks.
+	static bool loadPlaylistFromXMLFile (const std::string& fileName);
+
+	/// Send a signal to the sound manager so that it knows that it needs to call elapseTime.
+	/// Calling this function will do nothing if the sound manager is controlled in a separate thread.
+	static void signalSoundManager ();
+
+protected:
+	/// Load content from an XML Node.
+	/// @param node The XML node to load from. Note: currently tied to the tinyxml implementation.
+	static void loadSoundInfos (TiXmlNode* node);
+
+	/// Load content from an XML Node.
+	/// @param node The XML node to load from. Note: currently tied to the tinyxml implementation.
+	static bool loadPlaylistFromXMLNode (TiXmlNode* node);
+
+
+private:
+	/// Specify whether the sound manager is controlled and accessed in a single thread mode or not.
+	/// Possible values:
+	///	 - true: the sound manager is accessed in a single threaded way. All operations are called from the main thread.
+	///  - false: the sound manager receives play commands from the main thread, but also has a dedicated thread to elapse time. This 
+	///           allows it to also play while the game is loading data.
+	static bool singleThreadedSoundAccess_;
+};
+
+
+#endif // __SUMWARS_GUI_SOUND_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui/soundobject.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,73 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//
+// Includes
+//
+
+// Own header
+#include "soundobject.h"
+
+// Helper for sound operations
+#include "soundhelper.h"
+
+
+// Sound library
+#include "gussound.h"
+
+
+// Allow a shorter name for the sound manager.
+using gussound::SoundManager;
+
+
+SoundObject::SoundObject ()
+{
+}
+
+
+SoundObject::SoundObject (const std::string& name, Vector pos)
+	: m_name (name)
+	, m_pos (pos)
+	, m_soundData ("")
+{
+}
+
+
+SoundObject::~SoundObject ()
+{
+}
+
+
+void SoundObject::setPosition (Vector pos)
+{
+	m_pos = pos;
+}
+
+
+Vector SoundObject::getPosition ()
+{
+	return m_pos;
+}
+
+void SoundObject::setSoundData (const std::string& data)
+{
+	SW_DEBUG ("Setting sound data for [%s] to : [%s]", m_name.c_str (), data.c_str ());
+	m_soundData = data;
+}
+
+void SoundObject::play ()
+{
+	SoundHelper::playSoundGroupAtPosition (m_soundData, m_pos.m_x, m_pos.m_y, 0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui/soundobject.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,110 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SUMWARS_GUI_SOUNDOBJECT_H__
+#define __SUMWARS_GUI_SOUNDOBJECT_H__
+
+//
+// Includes
+//
+
+// use std::string
+#include <string>
+
+// Geometry utility functions built into sumwars.
+#include "geometry.h"
+
+
+///
+/// Class used to map 3D objects in the game to sounds that need to be played.
+/// This means in effect storing the sources of the sounds. Keep in mind though that these sources are taken from a pool of available
+/// sources in the lower level libraries. As a result, they will not be available for play all at the same time, running into
+/// platform specific limitations.
+/// The sounds are played only as needed, according to the location settings provided in the sound object.
+///
+class SoundObject
+{
+public:
+	/**
+	 * @fn SoundObject (const std::string& name, Vector pos = Vector (0, 0))
+	 * @brief Constructor.
+	 * @param name Name used to identify this sound object. // TODO: check if needed!!!
+	 * @param pos Position of the sound.
+	 */
+	SoundObject (const std::string& name, Vector pos = Vector (0, 0));
+
+	// Default constructor
+	SoundObject ();
+
+	/**
+	 * @fn ~SoundObject()
+	 * @brief Destructor. Nothing special.
+	 */
+	~SoundObject();
+
+
+	/**
+	 * @fn void setPosition(Vector pos)
+	 * @brief Set the position (source) of the sound
+	 * @param pos new position to use.
+	 */
+	void setPosition (Vector pos);
+	
+	/**
+	 * @brief Sets the position relative to the listener
+	 * @param pos relative Position
+	 */
+	//void setPositionRelative (Vector pos);
+
+
+	/**
+	 * \fn Vector getPosition()
+	 * \brief Gibt die Position der Schallquelle aus
+	 */
+	Vector getPosition();
+		
+	/**
+	 * \fn void setSoundData(SoundName sname)
+	 * \brief Setzt den abgespielten Sound
+	 * \param sname Name des Sounds
+	 */
+	void setSoundData (const std::string& data);
+
+	/**
+	 * \fn std::string getName()
+	 * \brief gibt den Name aus
+	 */
+	std::string getName()
+	{
+		return m_name;
+	}
+
+	/**
+	 * \fn void play()
+	 * \brief Startet das Abspielen des eingestellten Sounds
+	 */
+	void play();
+
+protected:
+	std::string m_name;
+
+	std::string m_soundData;
+
+	Vector m_pos;
+};
+
+
+#endif // __SUMWARS_GUI_SOUNDOBJECT_H__
+
--- a/src/gui/tooltip.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/tooltip.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -16,6 +16,9 @@
 #include "tooltip.h"
 #include <iostream>
 
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
 Tooltip::Tooltip ( CEGUI::Window* parent, std::string name, float fadeInTime, float fadeOutTime, float visibilityTime, float targetAlpha, TooltipType type)
 {
     m_FadeInTime = fadeInTime;
@@ -61,10 +64,10 @@
 
     tt->setPosition( position );
 
-    tt->setSize( size );
+	CEGUIUtility::setWidgetSize (tt, size);
     tt->setAlpha(0.0f);
     assert(m_Parent);
-    m_Parent->addChildWindow(tt);
+	CEGUIUtility::addChildWidget (m_Parent, tt);
 }
 
 
@@ -114,8 +117,9 @@
         if (m_FadeOutTime < m_CurrentFadeOutTime)
         {
 			m_IsDead = true;
-            m_Parent->removeChildWindow(m_Name);
-            CEGUI::WindowManager::getSingleton().destroyWindow(m_Name);
+			CEGUI::Window* wndTemp = CEGUIUtility::getWindow (m_Name);
+			CEGUIUtility::removeChildWidget (m_Parent, wndTemp);
+            CEGUI::WindowManager::getSingleton().destroyWindow (wndTemp);
         }
     }
 }
--- a/src/gui/tooltipmanager.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/tooltipmanager.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -16,6 +16,7 @@
 #include "tooltipmanager.h"
 #include "ceguiutility.h"
 #include "config.h"
+#include "debug.h"
 
 template<> TooltipManager* Ogre::Singleton<TooltipManager>::SUMWARS_OGRE_SINGLETON = 0;
 
@@ -26,14 +27,16 @@
 	m_timeVisible(0),
 	m_fadeInTime(0),
 	m_fadeOutTime(0),
-	m_toolTipsCreatedCount(0),
-	m_DefaultFont(CEGUI::System::getSingleton().getDefaultFont())
-{}
+	m_toolTipsCreatedCount(0)
+{
+	m_DefaultFont = CEGUIUtility::getDefaultFont ();
+}
 
-void TooltipManager::createTooltip ( CEGUI::Window* win, std::list< std::string > list, float timeVisible, CEGUI::Font* font, Tooltip::TooltipType type )
+void TooltipManager::createTooltip ( CEGUI::Window* win, std::list< std::string > textlist, float timeVisible, const CEGUI::Font* font, Tooltip::TooltipType type )
 {
-	CEGUI::Window *gamescreen = CEGUI::WindowManager::getSingleton().getWindow("GameScreen");
-    std::string msg;
+	SW_DEBUG ("Creating a tooltip for duration: %.2f", timeVisible);
+	CEGUI::Window *gamescreen = CEGUIUtility::getWindow ("SW");
+    std::string msg ("");
     CEGUI::UVector2 size;
     std::ostringstream windowName;
     windowName << "Tooltip__" << m_toolTipsCreatedCount;
@@ -41,13 +44,18 @@
 
     if ( font )
     {
-        size = CEGUIUtility::getWindowSizeForText ( list, font, msg );
-        tempFont = font;
+        size = CEGUIUtility::getWindowSizeForText ( textlist, font, msg );
+        tempFont = const_cast<CEGUI::Font*> (font);
     }
     else
-        size = CEGUIUtility::getWindowSizeForText ( list, m_DefaultFont, msg );
-
-    CEGUI::Vector2 mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
+	{
+        size = CEGUIUtility::getWindowSizeForText ( textlist, m_DefaultFont, msg );
+	}
+	//DEBUG ("Tooltip font is %s, which looks best at %.2f x %.2f", tempFont->getName ().c_str (), tempFont->getNativeResolution ().d_width, tempFont->getNativeResolution ().d_height);
+	//DEBUG ("Message to display is [%s]", msg.c_str ());
+	// TODO: maybe store mouse position using own class?
+	CEGUIUtility::Vector2f mousePos = CEGUIUtility::getMouseCursorPosition (m_CEGUISystem);
+    //CEGUI::Vector2 mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
     CEGUI::Renderer *rend = m_CEGUISystem->getRenderer();
     CEGUI::UVector2 position = CEGUI::UVector2 ( CEGUI::UDim ( 0, 20 ), CEGUI::UDim ( 0, 20 ) );
 
@@ -56,11 +64,11 @@
 
     if ( type == Tooltip::Main )
     {
-		Tooltip *tt = new Tooltip ( gamescreen, windowName.str(), m_fadeInTime, m_fadeOutTime, m_timeVisible, 0.7f );
+		Tooltip *tt = new Tooltip ( gamescreen, windowName.str(), m_fadeInTime, m_fadeOutTime, timeVisible, 0.7f );
         fadeAllOut();
         m_CurrentMain = tt;
         tt->create ( msg, position, size, tempFont );
-        win->subscribeEvent ( CEGUI::Window::EventMouseLeaves, CEGUI::Event::Subscriber ( &TooltipManager::handleMouseLeave, this ) );
+        win->subscribeEvent (CEGUIUtility::EventMouseLeavesWindowArea (), CEGUI::Event::Subscriber ( &TooltipManager::handleMouseLeave, this ) );
         m_Tooltips[windowName.str() ] = tt;
         m_toolTipsCreatedCount++;
     }
@@ -167,9 +175,13 @@
 
         if ( tt->isDead() )
         {
-            CEGUI::WindowManager::getSingleton().destroyWindow ( tt->getName() );
-            m_Tooltips.erase ( iter++ );
-            delete tt;
+			if (CEGUIUtility::isWindowPresent (tt->getName ()))
+			{
+				CEGUI::Window* ttWnd = CEGUIUtility::getWindow (tt->getName ());
+				CEGUI::WindowManager::getSingleton().destroyWindow (ttWnd);
+			}
+			m_Tooltips.erase ( iter++ );
+			delete tt;
         }
         else
 		{
--- a/src/gui/tooltipmanager.h	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/tooltipmanager.h	Thu Mar 20 19:04:28 2014 +0100
@@ -38,7 +38,7 @@
 	TooltipManager ( );
 	
 	/**
-	 * \fn void createTooltip(CEGUI::Window *win, std::list<std::string> list, float timeVisible = 0.0f, CEGUI::Font *font = 0, Tooltip::TooltipType type = Tooltip::Main)
+	 * \fn void createTooltip(CEGUI::Window *win, std::list<std::string> list, float timeVisible = 0.0f, const CEGUI::Font *font = 0, Tooltip::TooltipType type = Tooltip::Main)
 	 * \brief Creates a Tooltip
 	 * \param win parent CEGUI window 
 	 * \param list Text contents for the window as std::list
@@ -46,7 +46,7 @@
 	 * \param font CEGUI font for the Tooltip
 	 * \param type the Tooltip type
 	 */
-	void createTooltip (CEGUI::Window *win, std::list<std::string> list, float timeVisible = 0.0f, CEGUI::Font *font = 0, Tooltip::TooltipType type = Tooltip::Main);
+	void createTooltip (CEGUI::Window *win, std::list<std::string> list, float timeVisible = 0.0f, const CEGUI::Font *font = 0, Tooltip::TooltipType type = Tooltip::Main);
 	
 	/**
 	 * \fn void createTooltip(CEGUI::Window *win, std::string text, float timeVisible = 0.0f, CEGUI::Font *font = 0, Tooltip::TooltipType type = Tooltip::Main)
--- a/src/gui/tradewindow.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/tradewindow.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,457 +1,443 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "tradewindow.h"
-#include "ceguiutility.h"
-
-TradeWindow::TradeWindow (Document* doc, const std::string& ceguiSkinName)
-	: ItemWindow(doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	DEBUGX("setup trade");
-
-	m_big_sheet =0;
-	m_medium_sheet =0;
-	m_small_sheet =0;
-	
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-
-	// Rahmen fuer Inventar Fenster
-	CEGUI::FrameWindow* trade = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout("tradewindow.layout");
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tradewindow.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+
+TradeWindow::TradeWindow (Document* doc, const std::string& ceguiSkinName)
+	: ItemWindow(doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	DEBUGX("setup trade");
+
+	m_big_sheet =0;
+	m_medium_sheet =0;
+	m_small_sheet =0;
+	
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+
+	// Rahmen fuer Inventar Fenster
+	CEGUI::FrameWindow* trade = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("tradewindow.layout");
 	if (!trade)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "tradewindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "tradewindow.layout");
 	}
-	CEGUI::Window* trade_holder = win_mgr.loadWindowLayout( "tradewindow_holder.layout" );
+	CEGUI::Window* trade_holder = CEGUIUtility::loadLayoutFromFile ("tradewindow_holder.layout");
 	if (!trade_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "tradewindow_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "tradewindow_holder.layout");
+	}
+
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (trade_holder, "TradeWindow_Holder");
+	CEGUI::Window* wndTrade = CEGUIUtility::getWindowForLoadedLayoutEx (trade, "TradeWindow");
+	if (wndHolder && wndTrade)
+	{
+		CEGUIUtility::addChildWidget (wndHolder, wndTrade);
+	}
+	else
+	{
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for trade.");
+		if (!wndTrade) SW_DEBUG ("ERROR: Unable to get the window for trade.");
 	}
-
-	CEGUI::Window* wndHolder = win_mgr.getWindow("TradeWindow_Holder");
-	CEGUI::Window* wndTrade = win_mgr.getWindow("TradeWindow");
-	if (wndHolder && wndTrade)
-	{
-		wndHolder->addChildWindow (wndTrade);
-	}
-	else
-	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for trade.");
-		if (!wndTrade) DEBUG ("ERROR: Unable to get the window for trade.");
-	}
-
-	m_window = trade_holder;
-
-	CEGUI::Window* tradeContent = 0;
-	if (win_mgr.isWindowPresent ("tradewindow_aux"))
-	{
-		tradeContent = win_mgr.getWindow ("tradewindow_aux");
-	}
-	else
-	{
-		tradeContent = win_mgr.getWindow ("TradeWindow");
-	}
-	
-	trade->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeAreaMouseButtonPressed, this));
-	trade->setWantsMultiClickEvents(false);
-
-	// Bestandteile des Charakterfensters hinzufuegen
-	CEGUI::PushButton* btn;
-	CEGUI::Window* label;
-
-	int i,j;
-
-	// Label fuer grosse Items
-	std::ostringstream outStream;
-
-	// Store the WIDTH specific dividers for the various items.
-	double ratioOfInventory = 0.95;
-	double dividerForBigItems = ratioOfInventory / 5;
-	double dividerForMedItems = ratioOfInventory / 7;
-	double dividerForSmallItems = ratioOfInventory / 10;
-	
-	for (j=0;j<3;j++)
-	{
-		for (i=0;i<5;i++)
-		{
-			outStream.str("");
-			outStream << "TraderBigItem" << j*5+i<< "Label";
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
-			tradeContent->addChildWindow(label);
-			label->setPosition (CEGUI::UVector2 (cegui_reldim (i * dividerForBigItems), cegui_reldim (j * 0.13f)));
-			label->setSize (CEGUI::UVector2 (cegui_reldim (dividerForBigItems), cegui_reldim (0.13f)));
-			label->setID(Equipement::BIG_ITEMS+j*5+i);
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
-			label->setWantsMultiClickEvents(false);
-		}
-	}
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeBigPrevButton"));
-	btn->setID(0);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeBigNextButton"));
-	btn->setID(1);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-
-	
-	for (j=0;j<3;j++)
-	{
-		for (i=0;i<7;i++)
-		{
-			outStream.str("");
-			outStream << "TraderMediumItem" << j*7+i<< "Label";
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
-			tradeContent->addChildWindow(label);
-			label->setPosition(CEGUI::UVector2 (cegui_reldim (i * dividerForMedItems), cegui_reldim (0.39f + 0.096*j)));
-			label->setSize (CEGUI::UVector2 (cegui_reldim (dividerForMedItems), cegui_reldim (0.096f)));
-			label->setID(Equipement::MEDIUM_ITEMS+j*7+i);
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
-			label->setWantsMultiClickEvents(false);
-		}
-	}
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeMediumPrevButton"));
-	btn->setID(2);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeMediumNextButton"));
-	btn->setID(3);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-	
-	for (j=0;j<3;j++)
-	{
-		for (i=0;i<10;i++)
-		{
-			outStream.str("");
-			outStream << "TraderSmallItem" << j*10+i<< "Label";
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
-			tradeContent->addChildWindow(label);
-			label->setPosition (CEGUI::UVector2 (cegui_reldim(i * dividerForSmallItems), cegui_reldim (0.68f + 0.075 * j)));
-			label->setSize (CEGUI::UVector2 (cegui_reldim (dividerForSmallItems), cegui_reldim (0.065f)));
-			label->setID(Equipement::SMALL_ITEMS+j*10+i);
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
-			label->subscribeEvent(CEGUI::Window::EventMouseEnters, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
-			label->setWantsMultiClickEvents(false);
-		}
-	}
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeSmallPrevButton"));
-	btn->setID(4);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeSmallNextButton"));
-	btn->setID(5);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
-	
-	
-	// Both a regular button and an auto-close button are available.
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeCloseButton"));
-	btn->setID(5);
-	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onCloseTrade, this));
-
-	if (win_mgr.isWindowPresent ("TradeWindow__auto_closebutton__"))
+
+	m_window = trade_holder;
+
+	CEGUI::Window* tradeContent = 0;
+	tradeContent = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux");
+	
+	trade->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeAreaMouseButtonPressed, this));
+	trade->setWantsMultiClickEvents(false);
+
+	// Bestandteile des Charakterfensters hinzufuegen
+	CEGUI::PushButton* btn;
+	CEGUI::Window* label;
+
+	int i,j;
+
+	// Label fuer grosse Items
+	std::ostringstream outStream;
+
+	// Store the WIDTH specific dividers for the various items.
+	double ratioOfInventory = 0.95;
+	double dividerForBigItems = ratioOfInventory / 5;
+	double dividerForMedItems = ratioOfInventory / 7;
+	double dividerForSmallItems = ratioOfInventory / 10;
+	
+	for (j=0;j<3;j++)
 	{
-		CEGUI::Window* autoCloseButton;
-		autoCloseButton = win_mgr.getWindow ("TradeWindow__auto_closebutton__");
-		if (autoCloseButton)
+		for (i=0;i<5;i++)
+		{
+			outStream.str("");
+			outStream << "TraderBigItem" << j*5+i<< "Label";
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
+			CEGUIUtility::addChildWidget (tradeContent, label);
+			label->setPosition (CEGUI::UVector2 (cegui_reldim (i * dividerForBigItems), cegui_reldim (j * 0.13f)));
+			CEGUIUtility::setWidgetSizeRel (label, dividerForBigItems, 0.13f);
+
+			label->setID(Equipement::BIG_ITEMS+j*5+i);
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
+			label->setWantsMultiClickEvents(false);
+		}
+	}
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeBigPrevButton"));
+	btn->setID(0);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeBigNextButton"));
+	btn->setID(1);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+
+	
+	for (j=0;j<3;j++)
+	{
+		for (i=0;i<7;i++)
 		{
-			autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&TradeWindow::onCloseTrade, this));
+			outStream.str("");
+			outStream << "TraderMediumItem" << j*7+i<< "Label";
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
+			CEGUIUtility::addChildWidget (tradeContent, label);
+			label->setPosition(CEGUI::UVector2 (cegui_reldim (i * dividerForMedItems), cegui_reldim (0.39f + 0.096*j)));
+			CEGUIUtility::setWidgetSizeRel (label, dividerForMedItems, 0.096f);
+			label->setID(Equipement::MEDIUM_ITEMS+j*7+i);
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
+			label->setWantsMultiClickEvents(false);
+		}
+	}
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeMediumPrevButton"));
+	btn->setID(2);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeMediumNextButton"));
+	btn->setID(3);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+	
+	for (j=0;j<3;j++)
+	{
+		for (i=0;i<10;i++)
+		{
+			outStream.str("");
+			outStream << "TraderSmallItem" << j*10+i<< "Label";
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "BackgroundButton"), outStream.str());
+			CEGUIUtility::addChildWidget (tradeContent, label);
+			label->setPosition (CEGUI::UVector2 (cegui_reldim(i * dividerForSmallItems), cegui_reldim (0.68f + 0.075 * j)));
+			CEGUIUtility::setWidgetSizeRel (label, dividerForSmallItems, 0.065f);
+			label->setID(Equipement::SMALL_ITEMS+j*10+i);
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonPressed, this));
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&TradeWindow::onTradeItemMouseButtonReleased,  this));
+			label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&TradeWindow::onTradeItemHover,  this));
+			label->setWantsMultiClickEvents(false);
 		}
 	}
-
-
-	updateTranslation();
-}
-
-void TradeWindow::update()
-{
-	m_silent_current_update = m_silent;
-	
-	Player* player = m_document->getLocalPlayer();
-	if (player ==0)
-		return;
-	
-	Creature* npc = player->getTradePartner();
-	
-	if (npc ==0)
-	{
-		return;
-	}
-		
-	Equipement* equ = npc->getEquipement();
-	if (equ ==0)
-	{
-		return;
-	}
-	
-	//int gold = player->getEquipement()->getGold();
-	//bool stashtrade = false;
-	if (player->getId() == npc->getId())
-	{
-		equ = player->getStash();
-		//stashtrade = true;
-		//gold = -1;
-	}
-	
-	std::ostringstream out_stream;
-	
-	int nbig = equ->getMaxItemNumber(Item::BIG);
-	int nmedium = equ->getMaxItemNumber(Item::MEDIUM);
-	int nsmall = equ->getMaxItemNumber(Item::SMALL);
-	
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	bool vis;
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeBigPrevButton"));
-	vis = (m_big_sheet >0);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeBigNextButton"));
-	vis = (m_big_sheet < nbig/15);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeMediumPrevButton"));
-	vis = (m_medium_sheet >0);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeMediumNextButton"));
-	vis = (m_medium_sheet < nmedium/21);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeSmallPrevButton"));
-	vis = (m_small_sheet >0);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeSmallNextButton"));
-	vis = (m_small_sheet < nsmall/30);
-	if (btn->isVisible() != vis)
-		btn->setVisible(vis);
-	
-	CEGUI::Window* img;
-	int i;
-	Item* it;
-	
-	// Inventar: grosse Items
-	for (i=0;i<15;i++)
-	{
-		out_stream.str("");
-		out_stream << "TraderBigItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
-		it = equ->getItem(Equipement::BIG_ITEMS+i + m_big_sheet*15);
-		updateItemWindow(img,it,player,player->getEquipement()->getGold());
-	}
-	
-	for (i=0;i<21;i++)
-	{
-		out_stream.str("");
-		out_stream << "TraderMediumItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
-		it = equ->getItem(Equipement::MEDIUM_ITEMS+i + m_medium_sheet*21);
-		updateItemWindow(img,it,player,player->getEquipement()->getGold());
-	}
-	
-	for (i=0;i<30;i++)
-	{
-		out_stream.str("");
-		out_stream << "TraderSmallItem" << i<< "Label";
-		img =  win_mgr.getWindow(out_stream.str().c_str());
-		it = equ->getItem(Equipement::SMALL_ITEMS+i + m_small_sheet*30);
-		updateItemWindow(img,it,player,player->getEquipement()->getGold());
-	}
-}
-
-void TradeWindow::updateTranslation()
-{
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::PushButton* btn;
-	CEGUI::Window* label;
-	
-	if (win_mgr.isWindowPresent ("TradeLabel"))
-	{
-		label =  win_mgr.getWindow("TradeLabel");
-		label->setText((CEGUI::utf8*) gettext("Chest"));
-	}
-	else if (win_mgr.isWindowPresent ("TradeWindow"))
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeSmallPrevButton"));
+	btn->setID(4);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeSmallNextButton"));
+	btn->setID(5);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onTradeNextItems, this));
+	
+	
+	// Both a regular button and an auto-close button are available.
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeCloseButton"));
+	btn->setID(5);
+	btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TradeWindow::onCloseTrade, this));
+
+	CEGUI::Window* autoCloseButton;
+	autoCloseButton = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/__auto_closebutton__");
+	if (autoCloseButton)
+	{
+		autoCloseButton->subscribeEvent (CEGUI::Window::EventMouseClick, CEGUI::Event::Subscriber (&TradeWindow::onCloseTrade, this));
+	}
+
+
+	updateTranslation();
+}
+
+void TradeWindow::update()
+{
+	m_silent_current_update = m_silent;
+	
+	Player* player = m_document->getLocalPlayer();
+	if (player ==0)
+		return;
+	
+	Creature* npc = player->getTradePartner();
+	
+	if (npc ==0)
+	{
+		return;
+	}
+		
+	Equipement* equ = npc->getEquipement();
+	if (equ ==0)
+	{
+		return;
+	}
+	
+	//int gold = player->getEquipement()->getGold();
+	//bool stashtrade = false;
+	if (player->getId() == npc->getId())
 	{
-		label =  win_mgr.getWindow("TradeWindow");
-		if (label->isPropertyPresent ("Text"))
-		{
-			label->setProperty ("Text", (CEGUI::utf8*) gettext("Chest"));
-		}
+		equ = player->getStash();
+		//stashtrade = true;
+		//gold = -1;
+	}
+	
+	std::ostringstream out_stream;
+	
+	int nbig = equ->getMaxItemNumber(Item::BIG);
+	int nmedium = equ->getMaxItemNumber(Item::MEDIUM);
+	int nsmall = equ->getMaxItemNumber(Item::SMALL);
+	
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	bool vis;
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeBigPrevButton"));
+	vis = (m_big_sheet >0);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeBigNextButton"));
+	vis = (m_big_sheet < nbig/15);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeMediumPrevButton"));
+	vis = (m_medium_sheet >0);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeMediumNextButton"));
+	vis = (m_medium_sheet < nmedium/21);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeSmallPrevButton"));
+	vis = (m_small_sheet >0);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeSmallNextButton"));
+	vis = (m_small_sheet < nsmall/30);
+	if (btn->isVisible() != vis)
+		btn->setVisible(vis);
+	
+	CEGUI::Window* img;
+	int i;
+	Item* it;
+	
+	// Inventar: grosse Items
+	for (i=0;i<15;i++)
+	{
+		out_stream.str("");
+		out_stream << "TradeWindow/tradewindow_aux/TraderBigItem" << i<< "Label";
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
+		it = equ->getItem(Equipement::BIG_ITEMS+i + m_big_sheet*15);
+		updateItemWindow(img,it,player,player->getEquipement()->getGold());
+	}
+	
+	for (i=0;i<21;i++)
+	{
+		out_stream.str("");
+		out_stream << "TradeWindow/tradewindow_aux/TraderMediumItem" << i<< "Label";
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
+		it = equ->getItem(Equipement::MEDIUM_ITEMS+i + m_medium_sheet*21);
+		updateItemWindow(img,it,player,player->getEquipement()->getGold());
+	}
+	
+	for (i=0;i<30;i++)
+	{
+		out_stream.str("");
+		out_stream << "TradeWindow/tradewindow_aux/TraderSmallItem" << i<< "Label";
+		img =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, out_stream.str().c_str());
+		it = equ->getItem(Equipement::SMALL_ITEMS+i + m_small_sheet*30);
+		updateItemWindow(img,it,player,player->getEquipement()->getGold());
+	}
+}
+
+void TradeWindow::updateTranslation()
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::PushButton* btn;
+	CEGUI::Window* label;
+	
+	label =  CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow");
+	if (label->isPropertyPresent ("Text"))
+	{
+		label->setProperty ("Text", (CEGUI::utf8*) gettext("Chest"));
 	}
-
-	btn = static_cast<CEGUI::PushButton*>(win_mgr.getWindow("TradeCloseButton"));
-	btn->setText((CEGUI::utf8*) gettext("Ok"));
-}
-
-
-void TradeWindow::reset()
-{
-	m_big_sheet =0;
-	m_medium_sheet =0;
-	m_small_sheet =0;
-}
-
-bool TradeWindow::onTradeItemHover(const CEGUI::EventArgs& evt)
-{
-	
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	if (id >=Equipement::BIG_ITEMS && id < Equipement::MEDIUM_ITEMS)
-		id += 15* m_big_sheet;
-	if (id >=Equipement::MEDIUM_ITEMS && id < Equipement::SMALL_ITEMS)
-		id += 21*m_medium_sheet;
-	if (id >=Equipement::SMALL_ITEMS)
-		id += 30* m_small_sheet;
-	
-	Player* player = m_document->getLocalPlayer();
-	if (player ==0)
-		return true;
-	
-	Creature* npc = player->getTradePartner();
-	
-	if (npc ==0)
-	{
-		return true;
-	}
-		
-	Equipement* equ = npc->getEquipement();
-	if (equ ==0)
-	{
-		return true;
-	}
-	
-	int gold = player->getEquipement()->getGold();
-	//bool stashtrade = false;
-	if (player->getId() == npc->getId())
-	{
-		equ = player->getStash();
-		//stashtrade = true;
-		gold = -1;
-	}
-	
-	updateItemWindowTooltip(we.window,equ->getItem(id) ,player,gold);
-	
-	return true;
-}
-
-bool TradeWindow::onTradeItemMouseButtonPressed(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	short pos = id;
-	
-	if (pos>= Equipement::BIG_ITEMS && pos <  Equipement::MEDIUM_ITEMS)
-	{
-		id += m_big_sheet * 15;
-	}
-	if (pos>= Equipement::MEDIUM_ITEMS && pos < Equipement::SMALL_ITEMS)
-	{
-		id += m_medium_sheet * 21;
-	}
-	if (pos>= Equipement::SMALL_ITEMS)
-	{
-		id += m_small_sheet * 30;
-	}
-	
-	if (we.button == CEGUI::LeftButton)
-	{
-		m_document->onTradeItemLeftClick((short) id);
-	}
-
-	if (we.button == CEGUI::RightButton)
-	{
-		m_document->onTradeItemRightClick((short) id);
-	}
-
-	
-	return true;
-}
-
-bool TradeWindow::onTradeAreaMouseButtonPressed(const CEGUI::EventArgs& evt)
-{
-	m_document->onTradeSellClicked();
-	return true;
-}
-
-bool TradeWindow::onTradeItemMouseButtonReleased(const CEGUI::EventArgs& evt)
-{
-	
-	return true;
-}
-
-bool TradeWindow::onTradeNextItems(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-		static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	if (id ==0) 
-	{
-		m_big_sheet--;
-	}
-	else if (id ==1) 
-	{
-		m_big_sheet++;
-	}
-	else if (id ==2) 
-	{
-		m_medium_sheet--;
-	}
-	else  if (id ==3) 
-	{
-		m_medium_sheet++;
-	}
-	else  if (id ==4) 
-	{
-		m_small_sheet--;
-	}
-	else  if (id ==5) 
-	{
-		m_small_sheet++;
-	}
-	
-	setSilent(true);
-	update();
-	setSilent(false);
-	
-	return true;
-}
-
-bool TradeWindow::onCloseTrade(const CEGUI::EventArgs& evt)
-{
-	m_document->onButtonCloseTrade();
-	return true;
-	
-}
-
-
-
+
+	btn = static_cast<CEGUI::PushButton*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "TradeWindow/tradewindow_aux/TradeCloseButton"));
+	btn->setText((CEGUI::utf8*) gettext("Ok"));
+}
+
+
+void TradeWindow::reset()
+{
+	m_big_sheet =0;
+	m_medium_sheet =0;
+	m_small_sheet =0;
+}
+
+bool TradeWindow::onTradeItemHover(const CEGUI::EventArgs& evt)
+{
+	
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	if (id >=Equipement::BIG_ITEMS && id < Equipement::MEDIUM_ITEMS)
+		id += 15* m_big_sheet;
+	if (id >=Equipement::MEDIUM_ITEMS && id < Equipement::SMALL_ITEMS)
+		id += 21*m_medium_sheet;
+	if (id >=Equipement::SMALL_ITEMS)
+		id += 30* m_small_sheet;
+	
+	Player* player = m_document->getLocalPlayer();
+	if (player ==0)
+		return true;
+	
+	Creature* npc = player->getTradePartner();
+	
+	if (npc ==0)
+	{
+		return true;
+	}
+		
+	Equipement* equ = npc->getEquipement();
+	if (equ ==0)
+	{
+		return true;
+	}
+	
+	int gold = player->getEquipement()->getGold();
+	//bool stashtrade = false;
+	if (player->getId() == npc->getId())
+	{
+		equ = player->getStash();
+		//stashtrade = true;
+		gold = -1;
+	}
+	
+	updateItemWindowTooltip(we.window,equ->getItem(id) ,player,gold);
+	
+	return true;
+}
+
+bool TradeWindow::onTradeItemMouseButtonPressed(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	short pos = id;
+	
+	if (pos>= Equipement::BIG_ITEMS && pos <  Equipement::MEDIUM_ITEMS)
+	{
+		id += m_big_sheet * 15;
+	}
+	if (pos>= Equipement::MEDIUM_ITEMS && pos < Equipement::SMALL_ITEMS)
+	{
+		id += m_medium_sheet * 21;
+	}
+	if (pos>= Equipement::SMALL_ITEMS)
+	{
+		id += m_small_sheet * 30;
+	}
+	
+	if (we.button == CEGUI::LeftButton)
+	{
+		m_document->onTradeItemLeftClick((short) id);
+	}
+
+	if (we.button == CEGUI::RightButton)
+	{
+		m_document->onTradeItemRightClick((short) id);
+	}
+
+	
+	return true;
+}
+
+bool TradeWindow::onTradeAreaMouseButtonPressed(const CEGUI::EventArgs& evt)
+{
+	m_document->onTradeSellClicked();
+	return true;
+}
+
+bool TradeWindow::onTradeItemMouseButtonReleased(const CEGUI::EventArgs& evt)
+{
+	
+	return true;
+}
+
+bool TradeWindow::onTradeNextItems(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+		static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	if (id ==0) 
+	{
+		m_big_sheet--;
+	}
+	else if (id ==1) 
+	{
+		m_big_sheet++;
+	}
+	else if (id ==2) 
+	{
+		m_medium_sheet--;
+	}
+	else  if (id ==3) 
+	{
+		m_medium_sheet++;
+	}
+	else  if (id ==4) 
+	{
+		m_small_sheet--;
+	}
+	else  if (id ==5) 
+	{
+		m_small_sheet++;
+	}
+	
+	setSilent(true);
+	update();
+	setSilent(false);
+	
+	return true;
+}
+
+bool TradeWindow::onCloseTrade(const CEGUI::EventArgs& evt)
+{
+	m_document->onButtonCloseTrade();
+	return true;
+	
+}
+
+
+
--- a/src/gui/worldmap.cpp	Sat Jan 25 11:22:23 2014 +0100
+++ b/src/gui/worldmap.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -1,215 +1,224 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "worldmap.h"
-#include "ceguiutility.h"
-
-Worldmap::Worldmap (Document* doc, const std::string& ceguiSkinName)
-	: Window (doc)
-	, m_ceguiSkinName (ceguiSkinName)
-{
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "worldmap.h"
+
+// Utility for CEGUI cross-version compatibility
+#include "ceguiutility.h"
+
+
+Worldmap::Worldmap (Document* doc, const std::string& ceguiSkinName)
+	: Window (doc)
+	, m_ceguiSkinName (ceguiSkinName)
+{
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	
 	// The World map window and holder
-	CEGUI::Window* worldmap = (CEGUI::FrameWindow*) win_mgr.loadWindowLayout( "worldmapwindow.layout" );
+	CEGUI::Window* worldmap = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("worldmapwindow.layout");
 	if (!worldmap)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow.layout");
 	}
 
-	CEGUI::Window* worldmap_holder = win_mgr.loadWindowLayout( "worldmapwindow_holder.layout" );
+	CEGUI::Window* worldmap_holder = CEGUIUtility::loadLayoutFromFile ("worldmapwindow_holder.layout");
 	if (!worldmap_holder)
 	{
-		DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow_holder.layout");
+		SW_DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow_holder.layout");
 	}
 	
-	CEGUI::Window* wndHolder = win_mgr.getWindow("WorldmapWindow_Holder");
-	CEGUI::Window* wndHolderAux = win_mgr.getWindow("WorldmapWindow_Holder_aux");
-	CEGUI::Window* wndHeldWindow = win_mgr.getWindow("WorldmapWindow");
+	CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (worldmap_holder, "WorldmapWindow_Holder");
+	CEGUI::Window* wndHolderAux = CEGUIUtility::getWindowForLoadedLayoutEx (worldmap_holder, "WorldmapWindow_Holder_aux");
+	CEGUI::Window* wndHeldWindow = CEGUIUtility::getWindowForLoadedLayoutEx (worldmap, "WorldmapWindow");
 	if (wndHolder && wndHeldWindow && wndHolderAux)
 	{
-		wndHolderAux->addChildWindow (wndHeldWindow);
+		CEGUIUtility::addChildWidget (wndHolderAux, wndHeldWindow);
 	}
 	else
 	{
-		if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen.");
-		if (!wndHeldWindow) DEBUG ("ERROR: Unable to get the window for the worldmap screen.");
+		if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen.");
+		if (!wndHeldWindow) SW_DEBUG ("ERROR: Unable to get the window for the worldmap screen.");
 	}
 
 	m_window = worldmap_holder;
-}
-
-void Worldmap::update()
-{
-	Player* player = m_document->getLocalPlayer();
-	
-	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
-	CEGUI::FrameWindow* worldmap = (CEGUI::FrameWindow*) win_mgr.getWindow("WorldmapWindow");
-	
-	static int ncount =0;
-	static bool tpset = false;
-	
-	std::map<short,WaypointInfo>& winfos = World::getWorld()->getWaypointData();
-	std::map<short,WaypointInfo>::iterator it;
-	
-	std::ostringstream stream;
-	int cnt =0;
-	
-	CEGUI::Window* label;
-	Vector pos;
-	
-	// Schleife ueber alle Wegpunkte
-	for (it = winfos.begin(); it != winfos.end(); ++it)
-	{
-		// nur Wegpunkte die der Spieler schon gefunden hat
-		if (!player->checkWaypoint(it->first))
-			continue;
-		
-		stream.str("");
-		stream << "WaypointImage"<<cnt;
-		
-		if (cnt >= ncount)
-		{
-			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-			worldmap->addChildWindow(label);
-			label->setProperty("FrameEnabled", "false");
-			label->setProperty("BackgroundEnabled", "false");
-			//label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
-			label->setSize(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim( 0.02f)));
-			label->setProperty("Image", "set:SumWarsExtras image:WaypointMark"); 
-			label->setInheritsAlpha (false);
-			label->setAlwaysOnTop(true);
-			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Worldmap::onWaypointClicked, this));
-			
-			ncount ++;
-		}
-		else
-		{
-			label = win_mgr.getWindow(stream.str());
-		}
-		
-		pos = it->second.m_world_coord;
-		
-		label->setID(it->first);
-		label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x), cegui_reldim(pos.m_y)));
-		label->setVisible(true);
-		label->setTooltipText((CEGUI::utf8*) dgettext("sumwars",it->second.m_name.c_str()));
-		cnt++;
-	}
-	
-	
-	// restliche Label verstecken
-	for (; cnt <ncount; cnt++)
-	{
-		stream.str("");
-		stream << "WaypointImage";
-		stream << cnt;
-			
-		label = win_mgr.getWindow(stream.str());
-		label->setVisible(false);
-	}
-	RegionLocation& portal = player->getPortalPosition();
-	if (portal.first != "")
-	{
-		short id = World::getWorld()->getRegionId(portal.first);
-		it = winfos.find(id);
-		
-		if (it != winfos.end())
-		{
-		
-			stream.str("");
-			stream << "TownPortalImage";
-			
-			if (tpset==false)
-			{
-				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
-				worldmap->addChildWindow(label);
-				label->setProperty("FrameEnabled", "false");
-				label->setProperty("BackgroundEnabled", "true");
-
-				if (label->isPropertyPresent ("BackgroundColours"))
-				{
-					label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
-				}
-				else if (label->isPropertyPresent ("BackgroundColour"))
-				{
-					label->setProperty("BackgroundColour", "00000000");
-				}
-				label->setSize(CEGUI::UVector2(cegui_reldim(0.023f), cegui_reldim( 0.023f)));
-				label->setProperty("Image", "set:SumWarsExtras image:TownPortalSymbol");
-				label->setInheritsAlpha (false);
-				label->setAlwaysOnTop(true);
-				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Worldmap::onWaypointClicked, this));
-				
-				tpset = true;
-			}
-			else
-			{
-				label = win_mgr.getWindow(stream.str());
-			}
-			
-			
-			pos = it->second.m_world_coord;
-			
-			label->setID(-999);
-			if (player->checkWaypoint(id))
-			{
-				label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x+0.015f), cegui_reldim(pos.m_y)));
-			}
-			else
-			{
-				label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x), cegui_reldim(pos.m_y)));				
-			}
-			label->setVisible(true);
-			std::stringstream stream;
-			stream << dgettext("sumwars","Town Portal") << "\n";
-			stream << dgettext("sumwars",it->second.m_name.c_str());
-			label->setTooltipText((CEGUI::utf8*) stream.str().c_str());
-		}
-		else
-		{
-			ERRORMSG("region %s has no world position", portal.first.c_str());
-		}
-	}
-	else {
-		if(tpset == true) {
-			stream.str("");
-			stream << "TownPortalImage";
-			label = win_mgr.getWindow(stream.str());
-			label->setVisible(false);
-		}
-
-	}
-}
-
-void Worldmap::updateTranslation()
-{
-	
-}
-
-
-bool Worldmap::onWaypointClicked(const CEGUI::EventArgs& evt)
-{
-	const CEGUI::MouseEventArgs& we =
-			static_cast<const CEGUI::MouseEventArgs&>(evt);
-	unsigned int id = we.window->getID();
-	
-	DEBUGX("waypoint %i clicked",id);
-	m_document->onButtonWaypointClicked(id);
-	
-	return true;
-}
-
+}
+
+void Worldmap::update()
+{
+	Player* player = m_document->getLocalPlayer();
+	
+	CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton();
+	CEGUI::FrameWindow* worldmap = (CEGUI::FrameWindow*) CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "WorldmapWindow_Holder_aux/WorldmapWindow");
+	
+	static int ncount =0;
+	static bool tpset = false;
+	
+	std::map<short,WaypointInfo>& winfos = World::getWorld()->getWaypointData();
+	std::map<short,WaypointInfo>::iterator it;
+	
+	std::ostringstream stream;
+	int cnt =0;
+	
+	CEGUI::Window* label;
+	Vector pos;
+	
+	// Schleife ueber alle Wegpunkte
+	for (it = winfos.begin(); it != winfos.end(); ++it)
+	{
+		// nur Wegpunkte die der Spieler schon gefunden hat
+		if (!player->checkWaypoint(it->first))
+			continue;
+		
+		stream.str("");
+		stream << "WaypointImage"<<cnt;
+		
+		if (cnt >= ncount)
+		{
+			label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+			CEGUIUtility::addChildWidget (worldmap, label);
+
+			label->setProperty("FrameEnabled", "false");
+			label->setProperty("BackgroundEnabled", "false");
+			//label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
+			CEGUIUtility::setWidgetSizeRel (label, 0.02f, 0.02f);
+			label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("SumWarsExtras", "WaypointMark")); 
+			label->setInheritsAlpha (false);
+			label->setAlwaysOnTop(true);
+			label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Worldmap::onWaypointClicked, this));
+			
+			ncount ++;
+		}
+		else
+		{
+			stream.str("");
+			stream << "WorldmapWindow_Holder_aux/WorldmapWindow/WaypointImage"<<cnt;
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		}
+		
+		pos = it->second.m_world_coord;
+		
+		label->setID(it->first);
+		label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x), cegui_reldim(pos.m_y)));
+		label->setVisible(true);
+		label->setTooltipText((CEGUI::utf8*) dgettext("sumwars",it->second.m_name.c_str()));
+		cnt++;
+	}
+	
+	
+	// restliche Label verstecken
+	for (; cnt <ncount; cnt++)
+	{
+		stream.str("");
+		stream << "WorldmapWindow_Holder_aux/WorldmapWindow/WaypointImage"<<cnt;
+			
+		label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+		label->setVisible(false);
+	}
+	RegionLocation& portal = player->getPortalPosition();
+	if (portal.first != "")
+	{
+		short id = World::getWorld()->getRegionId(portal.first);
+		it = winfos.find(id);
+		
+		if (it != winfos.end())
+		{
+		
+			stream.str("");
+			stream << "TownPortalImage";
+			
+			if (tpset==false)
+			{
+				label = win_mgr.createWindow (CEGUIUtility::getWidgetWithSkin (m_ceguiSkinName, "StaticImage"), stream.str());
+				CEGUIUtility::addChildWidget (worldmap, label);
+
+				label->setProperty("FrameEnabled", "false");
+				label->setProperty("BackgroundEnabled", "true");
+
+				if (label->isPropertyPresent ("BackgroundColours"))
+				{
+					label->setProperty("BackgroundColours", "tl:00000000 tr:00000000 bl:00000000 br:00000000"); 
+				}
+				else if (label->isPropertyPresent ("BackgroundColour"))
+				{
+					label->setProperty("BackgroundColour", "00000000");
+				}
+				CEGUIUtility::setWidgetSizeRel (label, 0.023f, 0.023f);
+
+				label->setProperty("Image", CEGUIUtility::getImageNameWithSkin ("SumWarsExtras", "TownPortalSymbol"));
+				label->setInheritsAlpha (false);
+				label->setAlwaysOnTop(true);
+				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Worldmap::onWaypointClicked, this));
+				
+				tpset = true;
+			}
+			else
+			{
+				stream.str ("");
+				stream << "WorldmapWindow_Holder_aux/WorldmapWindow/TownPortalImage";
+				label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+			}
+			
+			
+			pos = it->second.m_world_coord;
+			
+			label->setID(-999);
+			if (player->checkWaypoint(id))
+			{
+				label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x+0.015f), cegui_reldim(pos.m_y)));
+			}
+			else
+			{
+				label->setPosition(CEGUI::UVector2(cegui_reldim(pos.m_x), cegui_reldim(pos.m_y)));				
+			}
+			label->setVisible(true);
+			std::stringstream stream;
+			stream << dgettext("sumwars","Town Portal") << "\n";
+			stream << dgettext("sumwars",it->second.m_name.c_str());
+			label->setTooltipText((CEGUI::utf8*) stream.str().c_str());
+			//label->setTooltip (); //XXX
+		}
+		else
+		{
+			ERRORMSG("region %s has no world position", portal.first.c_str());
+		}
+	}
+	else {
+		if(tpset == true) {
+			stream.str ("");
+			stream << "WorldmapWindow_Holder_aux/WorldmapWindow/TownPortalImage";
+			label = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, stream.str());
+			label->setVisible(false);
+		}
+
+	}
+}
+
+void Worldmap::updateTranslation()
+{
+	
+}
+
+
+bool Worldmap::onWaypointClicked(const CEGUI::EventArgs& evt)
+{
+	const CEGUI::MouseEventArgs& we =
+			static_cast<const CEGUI::MouseEventArgs&>(evt);
+	unsigned int id = we.window->getID();
+	
+	DEBUGX("waypoint %i clicked",id);
+	m_document->onButtonWaypointClicked(id);
+	
+	return true;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/goggstreamedsound.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,645 @@
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//    Audio utility class.
+
+// The abstract sound interface
+#include <gussound.h>
+
+//
+// Add guslib inclusions... unless we're dealing with the standalone version
+//
+
+#ifdef GUSSOUND_STANDALONE
+
+// Tracing utility
+#include <gussoundutil/trace.h>
+
+// String parsing utility.
+#include <gussoundutil/stringutil.h>
+
+#else
+
+// Tracing utility
+#include <guslib/trace/trace.h>
+
+// String parsing utility.
+#include <guslib/util/stringutil.h>
+
+#endif // GUSSOUND_STANDALONE
+
+#include <AL/alut.h>
+
+// The OGG bound implementation.
+#include <goggstreamedsound.h>
+
+// Some of the definitions are generic to GOpenAl
+#include <gopenal.h>
+
+
+//
+// Default trace level. TODO: remove?
+//
+#define ATLVL 4
+
+namespace GOpenAl
+{
+
+	
+	// ------------------------------------------ GOggStreamedSound -----------------------------------------
+
+	/// Constructor
+	GOggStreamedSound::GOggStreamedSound (OpenAlSoundRepository* repoPtr, const std::string & id)
+		: EffectableSound (id)
+		, sampleRate_ (0)
+		, oggFilePtr_ (0)
+		, vorbisInfo_ (0)
+		, vorbisComment_ (0)
+		, source_ (0)
+		, estimatedDurationInSeconds_ (0)
+		, volume_ (1.0f)
+		, m_initialized (false)
+		, elapsedFromStart_ (0)
+		, repositoryPtr_ (repoPtr)
+	{
+		GTRACE (4, "GOggStreamedSound CTor");
+		buffers_ [0] = 0;
+		buffers_ [1] = 0;
+	}
+#if 0
+		, buffer_ (0)
+		, cachedBufferLength_ (0)
+#endif
+
+	/// Destructor
+	GOggStreamedSound::~GOggStreamedSound ()
+	{
+		if (m_initialized)
+		{
+			oggcheck ("dtor");
+		}
+		GTRACE (4, "GOggStreamedSound DTor");
+	}
+
+
+	void GOggStreamedSound::open (const std::string& fileName)
+	{
+		GTRACE (4, "GOggStreamedSound opening [" << fileName << "]");
+		sourceFile_ = fileName;
+
+		int error = alGetError ();
+
+		if (error != AL_NO_ERROR)
+		{
+			std::string errMessage ("Error on opening Ogg stream: ");
+			errMessage.append (makeAlErrorString (error));
+			throw SoundException (errMessage.c_str ());
+		}
+
+		int result;
+		oggFilePtr_ = fopen (fileName.c_str (), "rb");
+		if (! oggFilePtr_)
+		{
+			std::string errMessage ("Failed to load Ogg file: ");
+			errMessage.append (fileName);
+			throw SoundException (errMessage.c_str ());
+		}
+
+		if((result = ov_open (oggFilePtr_, &oggStream_, NULL, 0)) < 0)
+		{
+			fclose (oggFilePtr_);
+        
+			std::string errText ("Could not open Ogg stream. ");
+			errText.append (makeOggErrorString (result));
+			throw SoundException (errText.c_str ());
+		}
+	
+		vorbisInfo_ = ov_info (&oggStream_, -1);
+		vorbisComment_ = ov_comment (&oggStream_, -1);
+		if (vorbisComment_)
+		{
+			GTRACE (6, "Displaying vorbis comment info");
+			GTRACE (7, "Vendor: [" << vorbisComment_->vendor << "]");
+			for (int i = 0; i < vorbisComment_->comments; i ++)
+			{
+				GTRACE (7, "Comment [" << i << "] is : [" << (vorbisComment_->user_comments[i]) << "]");
+			}
+		}
+
+		GTRACE (4, "Loaded vorbis file information for file [" << fileName << "]");
+
+		long myBitRate = ov_bitrate (&oggStream_, -1);
+		GTRACE(5, "Bitrate = " << myBitRate);
+
+		// get the file size.
+		std::ifstream inFile (fileName.c_str (), std::ifstream::in | std::ifstream::binary);
+	    inFile.seekg (0, std::ifstream::end);
+		GTRACE (5, "File size = " << inFile.tellg ());
+
+		// The bit rate is in bits, the file size is in bytes, so adjust by a factor of 8.
+		if (myBitRate)
+		{
+			estimatedDurationInSeconds_ = 8 * inFile.tellg () / myBitRate;
+			GTRACE (5, "Ogg content duration: " << estimatedDurationInSeconds_ << " (sec.)");
+		}
+
+		if (vorbisInfo_->channels == 1)
+		{
+			format_ = AL_FORMAT_MONO16;
+		}
+		else
+		{
+			format_ = AL_FORMAT_STEREO16;
+		}
+        
+		GTRACE (5, "GOggStreamedSound creating 2 buffers for [" << getId () << "]");
+		alGenBuffers (2, buffers_);
+
+		oggcheck ("open");
+	}
+
+
+	void GOggStreamedSound::release ()
+	{
+		alSourceStop (source_);
+		oggcheck ("release");
+		
+		emptyBuffers ();
+		oggcheck ("release(1)");
+		
+		alDeleteBuffers (2, buffers_);
+		oggcheck ("release(2)");
+
+		ov_clear (&oggStream_);
+		oggcheck ("release(3)");
+	}
+
+
+	void GOggStreamedSound::play2D (ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		GTRACE (7, "GOggStreamedSound::playback for [" << getId () << "]. Buffers are [" << buffers_[0] << "] and [" << buffers_[1] << "]");
+		if (0 == repositoryPtr_)
+		{
+			GTRACE (2, "ERROR: NULL repository ptr");
+			return;
+		}
+		if (repeatContinuously)
+		{
+			GTRACE (2, "WARNING: GOggStreamedSound::play received parameter [repeatContinuously] as true, but function will ignore it and treat is as hardcoded FALSE");
+		}
+
+		try
+		{
+			// Get a free source (an exception is thrown if none is available).
+			source_ = repositoryPtr_->getAvailableSourceForPlay (GSC_Music);
+
+			alSource3f (source_, AL_POSITION,        0.0, 0.0, 0.0);
+			alSource3f (source_, AL_VELOCITY,        0.0, 0.0, 0.0);
+			alSource3f (source_, AL_DIRECTION,       0.0, 0.0, 0.0);
+			alSourcef (source_, AL_ROLLOFF_FACTOR,  0.0          );
+			alSourcei (source_, AL_SOURCE_RELATIVE, AL_TRUE      );
+			SoundVolume myVol = getCombinedVolumeModifiers ();
+			alSourcef (source_, AL_GAIN, myVol);
+		}
+		catch (std::exception &e)
+		{
+			GTRACE (2, "OggStream failed to play. " << e.what ());
+		}
+
+		switch (getState ())
+		{
+		case GPLS_Playing:
+			//if (playing ())
+			//{
+				switch( actionIfPlaying )
+				{
+				case ActionRestart:
+					GTRACE (6, "Sound [" << getId () << "] already playing. Rewiding (close & reopen).");
+					rewind ();
+					doPlay (repeatContinuously);
+					state_ = GPLS_Playing;
+					break;
+				case ActionParallelPlay:
+					//not supported at this level
+					break;
+				case ActionEnqueue:
+					//not supported at this level
+					break;
+				case ActionDoNothing:
+				default:
+					break;
+				}
+			//}
+			//else
+			//{
+			//	GTRACE(2, "WARNING: Sound internal state corruption (obj state=playing; stream not playing)!");
+			//	// normally this shouldn't happen, we have some internal state problems.
+			//	doPlay( repeatContinuously );
+			//	state_ = GPLS_Playing;
+			//}
+			return; // already playing.
+		case GPLS_Stopped:
+			{
+				GTRACE (6, "Sound [" << getId () << "] was stopped. Rewiding (close & reopen).");
+				rewind ();
+				doPlay( repeatContinuously );
+				state_ = GPLS_Playing;
+				return;
+			}
+		case GPLS_Paused:
+			{
+				doResume ();
+				state_ = GPLS_Playing;
+				return;
+			}
+		default:
+			return;
+		}
+
+		return;// true;
+	}
+
+
+	void GOggStreamedSound::doPlay (bool repeatContinuously)
+	{
+		GTRACE (5, "GOggStreamedSound::doPlay triggered. Buffers are [" << buffers_[0] << "] and [" << buffers_[1] << "]");
+
+		if (!stream (buffers_[0]))
+		{
+			return;// false;
+		}
+        
+		if (!stream (buffers_[1]))
+		{
+			return;// false;
+		}
+    
+		alSourceQueueBuffers (source_, 2, buffers_);
+		alSourcePlay (source_);
+		oggcheck ("doPlay");
+	}
+
+	void GOggStreamedSound::doResume (bool repeatContinuously)
+	{
+		alSourcePlay (source_);
+		oggcheck ("doResume");
+		/*
+		alSourcei (source_, AL_BUFFERS_PROCESSED, &processed);
+		*/
+		//doPlay (repeatContinuously);
+	}
+
+
+	// TODO: is this function obsolete?
+	bool GOggStreamedSound::playing ()
+	{
+		ALenum state;
+    
+		alGetSourcei (source_, AL_SOURCE_STATE, &state);
+    
+		return (state == AL_PLAYING);
+	}
+
+
+	bool GOggStreamedSound::update ()
+	{
+		//GTRACE (8, "GOggStreamedSound::update [" << getId () << "]");
+		int processed = 0;
+		bool active = true;
+
+		alGetSourcei (source_, AL_BUFFERS_PROCESSED, &processed);
+		GTRACE (8, "GOggStreamedSound::update [" << getId () << "], processed so far from source: "<< processed);
+		oggcheck ("update");
+		while (processed>0)
+		{
+			processed--;
+			ALuint buffer;
+        
+			alSourceUnqueueBuffers (source_, 1, &buffer);
+			oggcheck ("update (2)");
+
+			active = stream (buffer);
+
+			alSourceQueueBuffers (source_, 1, &buffer);
+			oggcheck ("update (3)");
+		}
+
+		if (state_ == GPLS_Playing)
+		{
+			if (! playing ())
+			{
+				GTRACE (8, "[" << getId () << "] active and not playing... triggering play");
+				alSourcePlay (source_);
+				ALenum myErr = alGetError ();
+				if (myErr)
+				{
+					GTRACE (4, "ERROR while playing: " << makeAlErrorString (myErr));
+				}
+			}
+		}
+#if 0
+		if (active && !playing ())
+		{
+			GTRACE (8, "[" << getId () << "] active and not playing... triggering play");
+			//XXX, TODO, play
+			alSourcePlay (source_);
+			ALenum myErr = alGetError ();
+			if (myErr)
+			{
+				GTRACE (4, "ERROR while playing: " << makeAlErrorString (myErr));
+			}
+		}
+#endif
+
+		return active;
+	}
+
+
+	bool GOggStreamedSound::stream (ALuint buffer)
+	{
+		static const int BUFFER_SIZE = 4096 * 16;
+		//static const int BUFFER_SIZE = 4096;
+		//TODO:XXX:investigate buffer sizes.
+
+		char pcm [BUFFER_SIZE];
+		int  size = 0;
+		int  section;
+
+		while(size < BUFFER_SIZE)
+		{
+			int  result;
+			result = ov_read (&oggStream_, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
+    
+			if(result > 0)
+				size += result;
+			else
+				if(result < 0)
+					throw makeOggErrorString (result);
+				else
+					break;
+		}
+    
+		if (size == 0)
+		{
+			return false;
+		}
+    
+		if (! alIsBuffer (buffer))
+		{
+			GTRACE (3, "Ogg Stream received non-buffer data to stream from!");
+			return false;
+		}
+		alBufferData (buffer, format_, pcm, size, vorbisInfo_->rate);
+		oggcheck ("stream");
+    
+		return true;
+	}
+
+
+
+	void GOggStreamedSound::rewind ()
+	{
+		GTRACE (8, "GOggStreamedSound::rewind ()");
+#if 0
+		alSourceRewind (source_);
+#else
+		release ();
+
+		open (sourceFile_);
+#endif
+	}
+
+
+
+	void GOggStreamedSound::stop()
+	{
+		GTRACE (6, "GOggStreamedSound::stop()");
+
+		alSourceStop (source_);
+		state_ = GPLS_Stopped;
+		elapsedFromStart_ = 0;
+		oggcheck ("stop");
+	}
+
+
+	void GOggStreamedSound::setOutputVolume (const SoundVolume & volume)
+	{
+		SoundVolume sentVolume (volume); // the volume to send to the device.
+		if (sentVolume < gussound::min_volume) sentVolume = gussound::min_volume;
+		if (sentVolume > gussound::max_volume) sentVolume = gussound::max_volume;
+
+		if (source_)
+		{
+			GTRACE (8, "Setting low level output volume for [" << getId () << "] to: " << sentVolume);
+			alSourcef (source_, AL_GAIN, sentVolume);
+		}
+	}
+
+
+	void GOggStreamedSound::seekToTime (const SoundDuration & duration)
+	{
+		GTRACE(6, "GOggStreamedSound::seekToTime ()");
+		//TODO: implement
+
+		//if (outstreamptr_)
+		//{
+		//	if (outstreamptr_->isSeekable() && sampleRate_)
+		//	{
+		//		if (getDuration() == 0)
+		//		{
+		//			return;
+		//		}
+		//		SoundDuration ftemp = outstreamptr_->getLength() * duration / getDuration();
+		//		int nPosition = (int)ftemp;
+		//		GTRACE (6, "inner calc: seek to pos=" << nPosition << ", from len=" << outstreamptr_->getLength ());
+		//		outstreamptr_->setPosition (nPosition);
+		//	}
+		//}
+	}
+
+	SoundDuration GOggStreamedSound::getDuration ()
+	{
+		// TODO: simplify
+		return 1000 * getEstimatedDurationInSeconds ();
+	}
+
+
+	SoundDuration GOggStreamedSound::getSeekDuration ()
+	{
+		if (getDuration () == 0)
+		{
+			return 0;
+		}
+
+		return elapsedFromStart_;
+
+		//SoundDuration rValue = getStreamElapsedTime (); // OR: elapsedtime * length / length ?
+		//return rValue;
+	}
+
+
+
+	void GOggStreamedSound::emptyBuffers ()
+	{
+		int queued;
+    
+		alGetSourcei (source_, AL_BUFFERS_QUEUED, &queued);
+    
+		while (queued --)
+		{
+			ALuint buffer;
+    
+			alSourceUnqueueBuffers (source_, 1, &buffer);
+			oggcheck ("emptybuf");
+		}
+	}
+
+
+
+	void GOggStreamedSound::pause ()
+	{
+		if (getState () == GPLS_Playing)
+		{
+			alSourcePause (source_);
+			state_ = GPLS_Paused;
+			GTRACE (ATLVL, "Paused low level sound." << id_);
+		}
+		else
+		{
+			GTRACE (ATLVL, id_ << "; Warning: received command to pause while state is: " << getState ());
+		}
+	}
+
+
+
+	/// Utility function to retrieve the time that is currently elapsed from the stream.
+	SoundDuration GOggStreamedSound::getStreamElapsedTime ()
+	{
+		float elapsed;
+		alGetSourcef (source_, AL_SEC_OFFSET, &elapsed);
+		return elapsed;
+	}
+
+
+	bool GOggStreamedSound::loadFrom (const gussound::AudioDeviceSmartPtr & devicePtr, const std::string &fileName, bool loadInMem, bool onlyOneInstance )
+	{
+		GTRACE (2, "GOggStreamedSound. Loading from file [" << fileName << "]");
+		if (loadInMem)
+		{
+			GTRACE (2, "WARNING: GOggStreamedSound::loadFrom received param [loadInMem] as TRUE, but param is hard-coded by design to be FALSE in this class");
+			return false;
+		}
+
+		if (!onlyOneInstance)
+		{
+			GTRACE (2, "WARNING: GOggStreamedSound::loadFrom received param [onlyOneInstance] as FALSE, but param is hard-coded by design to be TRUE in this class");
+			return false;
+		}
+
+		onlyOneInstance_ = onlyOneInstance;
+		streamed_ = true;
+		
+		this->open (fileName.c_str ());
+		return true; // TODO: make checks
+	}
+
+	void GOggStreamedSound::elapseTime (const guslib::TimeUnits & time)
+	{
+		GTRACE (9, "GOggStreamedSound::elapseTime, " << getId () << ", units: " << time);
+		// Call parent implementation.
+		EffectableSound::elapseTime (time);
+		
+		if (GPLS_Playing == state_)
+		{
+			GTRACE (9, "Elapsed from start for ["<< getId () << "] is: " << elapsedFromStart_);
+			elapsedFromStart_ += time;// = getStreamElapsedTime ();
+			
+			update ();
+		}
+	}
+
+
+
+	void GOggStreamedSound::oggcheck (const std::string& comment)
+	{
+		int error = alGetError ();
+
+		if (error != AL_NO_ERROR)
+		{
+			// TODO: add error msg.
+			GTRACE (2, "oggcheck failed (" << makeAlErrorString (error) << "); " << this->getId () << "; " << comment);
+		}
+	}
+
+
+	std::string GOggStreamedSound::makeOggErrorString (int code)
+	{
+		// Show a bit more than alGetString.
+		switch(code)
+		{
+			case OV_EREAD:
+				return std::string ("Read from media.");
+			case OV_ENOTVORBIS:
+				return std::string ("Not Vorbis data.");
+			case OV_EVERSION:
+				return std::string ("Vorbis version mismatch.");
+			case OV_EBADHEADER:
+				return std::string ("Invalid Vorbis header.");
+			case OV_EFAULT:
+				return std::string ("Internal logic fault (bug or heap/stack corruption.");
+			default:
+				{
+					std::stringstream ss;
+					ss << "Unknown Ogg error (" << code << ")";
+					return ss.str ();
+				}
+		}
+	}
+
+
+
+	std::string GOggStreamedSound::makeAlErrorString (ALuint code)
+	{
+		// Show a bit more than alGetString.
+		switch(code)
+		{
+			case AL_INVALID_NAME:
+				return std::string ("Invalid name parameter.");
+			case AL_INVALID_ENUM:
+				return std::string ("Invalid enum parameter value.");
+			case AL_INVALID_VALUE:
+				return std::string ("Invalid parameter.");
+			case AL_INVALID_OPERATION:
+				return std::string ("Illegal call.");
+			case AL_OUT_OF_MEMORY:
+				return std::string ("Unable to allocate memory.");
+			default:
+				{
+					std::stringstream ss;
+					ss << "Unknown OpenAL error (" << code << ")";
+					return ss.str ();
+				}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/goggstreamedsound.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,169 @@
+#pragma once
+
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//    Gusty's Serpents is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+//    Audio utility class.
+
+// The API abstraction layer.
+#include <gussound.h>
+
+// The implementation is based on OpenAL.
+#include <al.h>
+#include <alc.h>
+
+// Add support for ogg files.
+#include <vorbis/vorbisfile.h>
+
+// Add support for vectors
+#include <vector>
+
+
+// definition for the float type expected to be used by the underlying sound lib.
+
+using namespace gussound;
+namespace GOpenAl
+{
+	// forward class defs
+	class OpenAlSoundRepository;
+
+	///
+	/// A helper class to encapsulate Ogg streaming functionality.
+	/// Note: using some of the guidelines and techniques mentioned here:
+	/// http://devmaster.net/posts/2895/openal-lesson-8-oggvorbis-streaming-using-the-source-queue
+	///
+	class GOggStreamedSound
+		: public EffectableSound
+	{
+	public:
+		/// Constructor
+		GOggStreamedSound (OpenAlSoundRepository* repoPtr, const std::string & id = "");
+		
+		/// Destructor
+		~GOggStreamedSound ();
+    
+		/// Open a file.
+		void open (const std::string& fileName);
+
+		void release();
+		void display ();
+
+		/// Commence the low-level sound play. Note that certain actions may be performed if the sound is already
+		/// playing, but not all possible actions are supported at this low level.
+		virtual void play2D (ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false);
+
+		bool playing ();
+		bool update ();
+		
+		void setVolume (float volume)
+		{
+			if (playing ())
+			{
+				alSourcef (source_, AL_GAIN,volume);
+			}
+			volume_ = volume;
+		}
+
+
+		const SoundDuration getEstimatedDurationInSeconds () const
+		{
+			return estimatedDurationInSeconds_;
+		}
+
+		virtual SoundVolume getOutputVolume(){ return volume_; }
+
+		virtual SoundDuration getSeekDuration();
+
+		/// Tell whether the sound received the play command with the repeat flag, meaning it will
+		/// play continuously until a stop is issued.
+		virtual bool isRepeating () { return false; }
+
+		/// Pause the sound.
+		virtual void pause ();
+
+		virtual SoundDuration getDuration();
+
+		virtual SampleRate getSampleRate(){ return sampleRate_; }
+
+		virtual void seekToTime (const SoundDuration & duration);
+
+		virtual void setOutputVolume (const SoundVolume & volume);
+
+		virtual void stop();
+
+		virtual void rewind ();
+
+	protected:
+
+		/// A pointer to the sound repository is stored here. 
+		/// Do not change this to a smart pointer, as the repository is likely to store the sounds as smart pointers and that would produce issues.
+		OpenAlSoundRepository* repositoryPtr_;
+
+		std::string sourceFile_;
+
+		bool stream (ALuint buffer);
+
+		/// Empty the currently loaded buffers.
+		void emptyBuffers ();
+
+		/// Perform some check-ups for ogg stream commands.
+		void oggcheck (const std::string& comment);
+
+		virtual bool loadFrom (const gussound::AudioDeviceSmartPtr & devicePtr
+					, const std::string &fileName, bool loadInMemory, bool onlyOneInstance = true);
+		/// Utility function to retrieve the time that is currently elapsed from the stream.
+		virtual SoundDuration getStreamElapsedTime ();
+
+		virtual void elapseTime (const guslib::TimeUnits & time);
+
+		virtual void doPlay (bool repeatContinuously = false);
+		virtual void doResume (bool repeatContinuously = false);
+
+		std::string makeAlErrorString (ALuint code);
+		std::string makeOggErrorString (int code);
+
+		SoundDuration estimatedDurationInSeconds_;
+
+		/// The sample rate for the loaded sound.
+		SampleRate sampleRate_;
+
+		/// The duration in milliseconds that passed since this sound began playing.
+		SoundDuration elapsedFromStart_;
+
+	private:
+
+		FILE*           oggFilePtr_;
+		OggVorbis_File  oggStream_;
+		vorbis_info*    vorbisInfo_;
+		vorbis_comment* vorbisComment_;
+
+		// For ogg, we have 2 buffers dedicated to the stream
+		// There is a buffer being played and one waiting to be played. When the buffer being played has finished the next one starts. 
+		// While the next buffer is being played, the first one is refilled with a new chunk of data from the stream and is set to play 
+		// once the one playing is finished.
+		ALuint buffers_[2];
+
+		ALuint source_;
+		ALenum format_;
+		float volume_;
+		bool m_initialized;
+	};
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gopenal.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,694 @@
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//    Audio utility class.
+
+// The abstract sound interface
+#include <gussound.h>
+
+
+//
+// Add guslib inclusions... unless we're dealing with the standalone version
+//
+
+#ifdef GUSSOUND_STANDALONE
+
+// Tracing util
+#include <gussoundutil/trace.h>
+
+// String parsing utility.
+#include <gussoundutil/stringutil.h>
+
+#else
+
+// Tracing util
+#include <guslib/trace/trace.h>
+
+// String parsing utility.
+#include <guslib/util/stringutil.h>
+
+#endif
+
+#include <AL/alut.h>
+
+// The audiere bound implementation.
+#include "gopenal.h"
+
+#include "goggstreamedsound.h"
+
+#define GOPENAL_MAJOR_VERSION 1
+#define GOPENAL_MINOR_VERSION 0
+#define GOPENAL_PATCH_VERSION 1
+
+
+
+
+#ifdef _WINDOWS
+//#ifdef _DEBUG
+//#pragma comment(lib, "libvorbis-static-mt-debug.lib")
+//#pragma comment(lib, "libogg-static-mt-debug.lib")
+//#else
+//// Link to the openal and vorbis lib files.
+//#pragma comment(lib, "libvorbis-static-mt.lib")
+//#pragma comment(lib, "libogg-static-mt.lib")
+//#endif
+//
+//#pragma comment(lib, "openal32.lib")
+//#pragma comment(lib, "alut.lib")
+//
+#else
+#pragma message("You should link to the OpenAL, ALUT, libogg and libvorbis runtime lib.")
+#endif //_WINDOWS
+
+#define ATLVL 4
+
+namespace GOpenAl
+{	
+	// ------------------------------------------ GOpenAlDevice -----------------------------------------
+
+	GOpenAlDevice::GOpenAlDevice ()
+		: gussound::AudioDevice ()
+		, alcContext_ (0)
+		, alcDevice_ (0)
+	{
+		ALenum myErr;
+
+		bool b = alutInitWithoutContext (NULL,NULL);
+		if (!b)
+		{
+			throw SoundException ("Unable to initialize alut!");
+		}
+		alcDevice_ = alcOpenDevice (NULL);
+
+		if (!alcDevice_)
+		{
+			throw SoundException ("Unable to open OpenAL device!");
+		}
+
+		alcContext_ = alcCreateContext (alcDevice_, NULL);
+		if (!alcContext_)
+		{
+			alcCloseDevice (alcDevice_);
+			throw SoundException ("Unable to create OpenAL context!");
+		}
+
+		b = alcMakeContextCurrent (alcContext_);
+		myErr = alGetError ();
+		if (!b)
+		{
+			throw SoundException ("Unable to make the current context current!");
+		}
+
+		GTRACE (2, "Using OpenAL, version: " << alGetString (AL_VERSION) 
+			<< "; vendor: " << alGetString (AL_VENDOR) 
+			<< "; renderer: " << alGetString (AL_RENDERER));
+
+		alDistanceModel (AL_LINEAR_DISTANCE_CLAMPED);
+		myErr = alGetError ();
+		if (myErr)
+		{
+			throw SoundException ("Unable to set the distance model to: AL_LINEAR_DISTANCE_CLAMPED");
+		}
+	}
+
+
+	GOpenAlDevice::~GOpenAlDevice ()
+	{
+		GTRACE (2, "Destroying OpenAL device, clearing callbacks, etc.");
+		
+		if (alcContext_)
+		{
+			alcDestroyContext (alcContext_);
+		}
+
+		if (alcDevice_)
+		{
+			alcCloseDevice (alcDevice_);
+		}
+		alutExit ();
+		GTRACE (2, "Destroyed OpenAL device");
+	}
+
+
+	// ------------------------------------------ GOpenAlSound -----------------------------------------
+
+
+
+	GOpenAlSound::GOpenAlSound (OpenAlSoundRepository* repoPtr, const std::string & id)
+		: EffectableSound (id)
+		, sampleRate_ (0)
+		, repeating_ (false)
+		, elapsedFromStart_ (0)
+		, source_ (0)
+		, buffer_ (0)
+		, cachedBufferLength_ (0)
+		, repositoryPtr_ (repoPtr)
+	{
+	}
+
+
+	GOpenAlSound::~GOpenAlSound ()
+	{
+		if (getState () != GPLS_Stopped)
+		{
+			stop ();
+		}
+
+		// Delete the sound buffer
+		if (NULL != buffer_)
+		{
+			alDeleteBuffers (1, &buffer_);
+		}
+
+		// Note: the sound sources are managed and deleted by the repository.
+		GTRACE (8, "Low lvl sound destruction");
+	}
+
+	//
+	// Retrieve a source that can be used for playing. In case no available sources can be found
+	// a new source is created.
+	//
+	ALuint GOpenAlSound::getAvailableSourceForPlay ()
+	{
+		if (! repositoryPtr_)
+		{
+			return 0;
+		}
+		try
+		{
+			// Get a free source (an exception is thrown if none is available).
+			ALuint availableSource = repositoryPtr_->getAvailableSourceForPlay ();
+
+			// The source is not guaranteed to have the current buffer attahced to it.
+			alSourcei (availableSource, AL_BUFFER, buffer_);
+			
+			// Return it.
+			return availableSource;
+		}
+		catch (std::exception &e)
+		{
+			GTRACE (2, "Could not get a source to play sound!" << e.what ());
+			return 0;
+		}
+	}
+
+
+	/// Utility function to retrieve the time that is currently elapsed from the stream.
+	SoundDuration GOpenAlSound::getStreamElapsedTime ()
+	{
+		if (0 == source_)
+		{
+			return 0;
+		}
+		float elapsed;
+		alGetSourcef (source_, AL_SEC_OFFSET, &elapsed);
+		return elapsed;
+	}
+
+
+	/// Utility function to retrieve the length of the stream.
+	SoundDuration GOpenAlSound::getStreamLength ()
+	{
+		return cachedBufferLength_;
+	}
+
+
+	/// Utility function to calculate and retrieve the length of the stream.
+	SoundDuration GOpenAlSound::calculateAndRetrieveStreamLength ()
+	{
+		ALint bufferSize, frequency, bitsPerSample, channels;
+		ALenum myErr;
+
+		alGetBufferi (buffer_, AL_SIZE, &bufferSize);
+		myErr = alGetError ();
+		if (myErr)
+		{
+			GTRACE (2, "Warning: AL error encountered while trying to get buffer size: " << alGetString (myErr));
+			std::string errorMessage ("Failed to calculate stream data for: ");
+			errorMessage.append (getId ());
+			throw SoundException (errorMessage.c_str ());
+		}
+
+		alGetBufferi (buffer_, AL_FREQUENCY, &frequency);
+		myErr = alGetError ();
+		if (myErr)
+		{
+			GTRACE (2, "Warning: AL error encountered while trying to get frequency: " << alGetString (myErr));
+			std::string errorMessage ("Failed to calculate stream data for: ");
+			errorMessage.append (getId ());
+			throw SoundException (errorMessage.c_str ());
+		}
+
+		alGetBufferi (buffer_, AL_CHANNELS, &channels);    
+		myErr = alGetError ();
+		if (myErr)
+		{
+			GTRACE (2, "Warning: AL error encountered while trying to get channels: " << alGetString (myErr));
+			std::string errorMessage ("Failed to calculate stream data for: ");
+			errorMessage.append (getId ());
+			throw SoundException (errorMessage.c_str ());
+		}
+
+		alGetBufferi (buffer_, AL_BITS, &bitsPerSample); 
+		myErr = alGetError ();
+		if (myErr)
+		{
+			GTRACE (2, "Warning: AL error encountered while trying to get bits per sample: " << alGetString (myErr));
+			std::string errorMessage ("Failed to calculate stream data for: ");
+			errorMessage.append (getId ());
+			throw SoundException (errorMessage.c_str ());
+		}
+
+		SoundDuration duration = ((SoundDuration)bufferSize)/(frequency*channels*(bitsPerSample/8));
+		cachedBufferLength_ = duration;
+		sampleRate_ = bitsPerSample;
+
+		GTRACE (4, "Calculating stream/buffer information for sound [" << getId () << "]. Channels = [" << channels << "] frequency = ["
+			<< frequency << "] duration = [" << duration << "] samplerate = [" << sampleRate_ << "]");
+
+		return duration;
+	}
+
+
+	SoundDuration GOpenAlSound::getSeekDuration ()
+	{
+		if (getStreamLength () == 0)
+		{
+			return 0;
+		}
+		
+		SoundDuration rValue = getStreamElapsedTime ();
+		return rValue;
+	}
+
+
+	SoundDuration GOpenAlSound::getDuration ()
+	{
+		return getStreamLength ();
+	}
+
+
+	bool GOpenAlSound::loadFrom (const gussound::AudioDeviceSmartPtr & devicePtr, const std::string &fileName, bool loadInMem, bool onlyOneInstance )
+	{
+		onlyOneInstance_ = onlyOneInstance;
+		
+		GTRACE (2, "Loading from file [" << fileName << "]. only one instance? : " << onlyOneInstance_);
+
+		// Get the extension from the file name
+		std::string extension = guslib::stringutil::getExtensionFromFileName (fileName);
+		GTRACE (3, "Extension: " << extension);
+
+		ALenum myErr;
+
+		streamed_ = !loadInMem;
+		buffer_ = alutCreateBufferFromFile (fileName.c_str ());
+
+		myErr = alGetError ();
+		if (myErr)
+		{
+			GTRACE (2, "Error encountered while trying to load AL sound from [" << fileName << "]: " << alGetString (myErr));
+		}
+
+		source_ = 0;
+
+		calculateAndRetrieveStreamLength ();
+
+		return (buffer_ != 0);
+	}
+
+
+	void GOpenAlSound::pause ()
+	{
+		if (getState() == GPLS_Playing)
+		{
+			// store the location of the pause in case a resume is desired.
+
+			elapsedFromStart_ = getStreamElapsedTime ();
+
+			alSourcePause (source_);
+			state_ = GPLS_Paused;
+			GTRACE (ATLVL, "Paused low level sound." << id_);
+		}
+		else
+		{
+			GTRACE (ATLVL, id_ << "; Warning: received command to pause while state is: " << getState ());
+		}
+	}
+
+	bool GOpenAlSound::doPlay3D (double posX, double posY, double posZ, bool repeatContinuously)
+	{
+		GTRACE (8, "doPlay3D entered for [" << posX << ", " << posY << ", " << posZ << "]");
+		source_ = getAvailableSourceForPlay ();
+		if (0 == source_)
+		{
+			return false;
+		}
+		SoundVolume volumeToUse = getCombinedVolumeModifiers ();
+
+		if (posX && posY && posZ)
+		{
+			ALfloat spos[3] = {0.0, 0.0, 0.0};
+			spos[0] = (ALfloat)posX;
+			spos[1] = (ALfloat)posY;
+			spos[2] = (ALfloat)posZ;
+			alSourcefv (source_, AL_POSITION, spos);
+			alSourcei (source_, AL_SOURCE_RELATIVE, AL_FALSE);
+
+			alSourcef (source_, AL_REFERENCE_DISTANCE, 5);
+			alSourcef (source_, AL_ROLLOFF_FACTOR, 0.5);
+			alSourcef (source_,AL_MAX_DISTANCE , 20);
+
+		}
+	
+
+		alSourcei (source_, AL_BUFFER, buffer_);
+		alSourcef (source_, AL_GAIN, volumeToUse);
+		alSourceRewind (source_);
+		alSourcePlay (source_);
+		return true;
+	}
+
+	void GOpenAlSound::doResume (bool repeatContinuously)
+	{
+		GTRACE(6, id_ << "; received command to resume");
+		if (elapsedFromStart_ > 0)
+		{
+			//repeating_ = repeatContinuously;
+			//source_ = getAvailableSourceForPlay ();
+			SoundVolume volumeToUse = getCombinedVolumeModifiers ();
+			alSourcei (source_, AL_BUFFER, buffer_);
+			alSourcef (source_, AL_GAIN, volumeToUse);
+			alSourcePlay (source_);
+		}
+	}
+
+	void GOpenAlSound::play2D (ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		play3D (0, 0, 0, actionIfPlaying, repeatContinuously);
+	}
+
+
+
+	void GOpenAlSound::play3D (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		GTRACE(ATLVL, id_ << "; GOpenAlSound::play3D ... currentstate=" << getState ());
+		//GTRACE(ATLVL, "one inst? " << onlyOneInstance_ << ", buf: " << buffer_ << ", state: " << getState ());
+
+		if (onlyOneInstance_)
+		{
+			if (buffer_)
+			{
+				switch (getState ())
+				{
+				case GPLS_Playing:
+					switch (actionIfPlaying)
+					{
+					case ActionRestart:
+						stop ();
+						if (doPlay3D (posX, posY, posZ, repeatContinuously))
+						{
+							state_ = GPLS_Playing;
+						}
+						break;
+					case ActionParallelPlay:
+						if (doPlay3D (posX, posY, posZ, repeatContinuously))
+						{
+							state_ = GPLS_Playing;
+						}
+						break;
+					case ActionEnqueue:
+						//not supported at this level
+						break;
+					case ActionDoNothing:
+					default:
+						break;
+					}
+					return; // already playing.
+				case GPLS_Stopped:
+					{
+						if (doPlay3D (posX, posY, posZ, repeatContinuously))
+						{
+							state_ = GPLS_Playing;
+						}
+						return;
+					}
+				case GPLS_Paused:
+					{
+						doResume ();
+						state_ = GPLS_Playing;
+						return;
+					}
+				default:
+					return;
+				}
+			}
+		}
+		else
+		{
+			// effect
+			if (buffer_)
+			{
+				if (doPlay3D (posX, posY, posZ))
+				{
+					state_ = GPLS_Playing;
+				}
+			}
+		}
+	}
+
+
+
+	///
+	/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+	/// This allows you to update the source of the sound after the play command is launched.
+	///
+	int GOpenAlSound::play3Dnamed (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		play3D (posX, posY, posZ, actionIfPlaying, repeatContinuously);
+
+		return source_;
+	}
+
+
+
+	void GOpenAlSound::setOutputVolume (const SoundVolume & volume)
+	{
+		SoundVolume sentVolume (volume); // the volume to send to the device.
+		if (sentVolume < gussound::min_volume) sentVolume = gussound::min_volume;
+		if (sentVolume > gussound::max_volume) sentVolume = gussound::max_volume;
+
+		if (buffer_ && source_)
+		{
+			GTRACE (8, "Setting low level output volume to: " << sentVolume);
+			alSourcef (source_, AL_GAIN, sentVolume);
+		}
+	}
+
+	void GOpenAlSound::seekToTime (const SoundDuration & duration)
+	{
+		GTRACE(6, "GOpenAlSound::seekToTime () - NOT SUPPORTED");
+	}
+
+	void GOpenAlSound::stop ()
+	{
+		GTRACE(6, "GOpenAlSound::stop()");
+
+		alSourceStop (source_);
+		source_ = 0;
+		state_ = GPLS_Stopped;
+		elapsedFromStart_ = 0;
+	}
+
+
+	// ----------------------------------------------- OpenAlSoundRepository -------------------------------------------------
+
+	OpenAlSoundRepository::OpenAlSoundRepository ()
+		: SoundRepository ()
+		, maximumConcurrentSounds_ (28)
+		, reservedMusicSources_ (3)
+	{
+		setAudioDevice (new GOpenAlDevice ());
+	}
+
+	OpenAlSoundRepository::~OpenAlSoundRepository ()
+	{
+		GTRACE (3, "destroying audiere sound repository");
+
+		// Destroy the sources
+		for (std::vector <ALuint>::iterator it = soundSources_.begin ();
+			it != soundSources_.end (); ++ it)
+		{
+			alDeleteSources (1, &(*it));
+		}
+		for (std::vector <ALuint>::iterator it = musicSources_.begin ();
+			it != musicSources_.end (); ++ it)
+		{
+			alDeleteSources (1, &(*it));
+		}
+	}
+
+
+	EffectableSound * OpenAlSoundRepository::createSound (const std::string & id, const std::string& fileExtension)
+	{
+		GTRACE (4, "OpenAL repository: creating sound with id [" << id << "] and extension [" << fileExtension << "]");
+
+		// TODO: add factory. For the time being, a hard-coded version is in place.
+		// TODO: make lowercase only!!!
+		std::string localFileExt (fileExtension);
+
+		if (localFileExt == "ogg")
+		{
+			return new GOggStreamedSound (this, id);
+		}
+
+		return new GOpenAlSound (this, id);
+	}
+
+
+	///
+	/// Internal function used to get an available (non-playing and non-paused) sound source.
+	/// @see getAvailableSourceForPlay
+	///
+	ALuint OpenAlSoundRepository::getAvailableSoundSourceForPlay ()
+	{
+		ALenum state;
+		// Create new source or use available source in the vector?
+		for (std::vector <ALuint>::iterator it = soundSources_.begin ();
+			it != soundSources_.end (); ++ it)
+		{
+			alGetSourcei (*it, AL_SOURCE_STATE, &state);
+			if (state != AL_PLAYING && state != AL_PAUSED)
+			{
+				return *it;
+			}
+		}
+
+		// Ran through all sources and all are playing. Check whether we can add a new sound source.
+		if (soundSources_.size () >= maximumConcurrentSounds_)
+		{
+			throw SoundException ("Maximum amount of sound sources reached!");
+		}
+
+		// Create a new source
+		GTRACE (4, "Creating new sound source for the repository. Current count: " << (soundSources_.size () + 1));
+		
+		ALuint newSource;
+		alGenSources (1, &newSource);
+		soundSources_.push_back (newSource);
+
+		return newSource;
+	}
+
+
+	///
+	/// Internal function used to get an available (non-playing and non-paused) music source.
+	/// @see getAvailableSourceForPlay
+	///
+	ALuint OpenAlSoundRepository::getAvailableMusicSourceForPlay ()
+	{
+		ALenum state;
+		// Create new source or use available source in the vector?
+		for (std::vector <ALuint>::iterator it = musicSources_.begin ();
+			it != musicSources_.end (); ++ it)
+		{
+			alGetSourcei (*it, AL_SOURCE_STATE, &state);
+			if (state != AL_PLAYING)
+			{
+				return *it;
+			}
+		}
+
+		// Ran through all sources and all are playing. Check whether we can add a new sound source.
+		if (musicSources_.size () >= reservedMusicSources_)
+		{
+			std::stringstream ss;
+			ss << "Maximum amount of music sources reached! ";
+			ss << "Reserved sources: " << reservedMusicSources_ << "; current music sources: " << musicSources_.size ();
+			throw SoundException (ss.str ().c_str ());
+		}
+
+		// Create a new source
+		GTRACE (4, "Creating new music source for the repository. Current count: " << (musicSources_.size () + 1));
+		
+		ALuint newSource;
+		alGenSources (1, &newSource);
+		musicSources_.push_back (newSource);
+		return newSource;
+	}
+	
+
+
+	///
+	/// Get a source that can be used for a play command. In case no available sources can be found:
+	/// - if the maximum amount of sound sources has not been reached yet, a new source is created.
+	/// - if the maximum amount of sound sources has been reached, an exception is thrown.
+	///
+	ALuint OpenAlSoundRepository::getAvailableSourceForPlay (SoundCategory categ)
+	{
+		if (categ == GSC_Music)
+		{
+			return getAvailableMusicSourceForPlay ();
+		}
+		return getAvailableSoundSourceForPlay ();
+	}
+
+	// ----------------------------------------------- OpenAlManagerUtil -------------------------------------------------
+
+	OpenAlManagerUtil::OpenAlManagerUtil ()
+		: SoundManagerUtil (new OpenAlSoundRepository ())
+	{
+		GTRACE (3, "OpenAL (sound) Manager Utility construction");
+	}
+
+	SoundManagerUtil * OpenAlManagerUtil::createSoundManager ()
+	{
+		return new OpenAlManagerUtil ();
+	}
+
+	
+	OpenAlManagerUtil::~OpenAlManagerUtil ()
+	{
+		GTRACE (1, "Destroying OpenAlManagerUtil");
+	}
+
+
+	/// Create and return a string containing the version of the sound library
+	std::string OpenAlManagerUtil::getVersion () const
+	{
+		std::stringstream ss;
+		ss << "OpenAlManagerUtil-" << GOPENAL_MAJOR_VERSION << "." << GOPENAL_MINOR_VERSION << "." << GOPENAL_PATCH_VERSION;
+		ss << " (" << SoundManagerUtil::getVersion () << ")";
+		return ss.str ();
+	}
+
+
+	/// Set the listener position
+	void OpenAlManagerUtil::setListenerPosition (double posX, double posY, double posZ)
+	{
+		ALfloat listenerPos[3] = {0.0, 0.0, 0.0};
+		listenerPos[0] = (ALfloat)posX;
+		listenerPos[1] = (ALfloat)posY;
+		listenerPos[2] = (ALfloat)posZ;
+		alListenerfv (AL_POSITION, listenerPos);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gopenal.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,252 @@
+#pragma once
+
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//    Gusty's Serpents is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+//    Audio utility class.
+
+// The API abstraction layer.
+#include <gussound.h>
+
+// The implementation is based on OpenAL.
+#include <al.h>
+#include <alc.h>
+
+// Add support for ogg files.
+#include <vorbis/vorbisfile.h>
+
+// Add support for vectors
+#include <vector>
+
+// Implementation of singleton
+//#include <guslib/common/singleton.hpp>// TODO: remove
+
+// definition for the float type expected to be used by the underlying sound lib.
+
+using namespace gussound;
+namespace GOpenAl
+{
+	class GOpenAlDevice
+		: public gussound::AudioDevice
+	{
+	protected:
+		ALCcontext* alcContext_;
+
+		ALCdevice * alcDevice_;
+
+	public:
+		GOpenAlDevice ();
+		virtual ~GOpenAlDevice ();
+
+		virtual const ALCcontext* getALCcontext () { return alcContext_; }
+		virtual const ALCdevice* getALCdevice () { return alcDevice_; }
+	};
+
+	typedef GSmartPtr <GOpenAlDevice> GOpenAlDeviceSmartPtr;
+
+	// fwd class defs.
+	class GOpenAlSound;
+	class OpenAlSoundRepository;
+
+
+
+	/**
+		A low level sound class. This one is tied to the audiere engine.
+	*/
+	class GOpenAlSound
+		: public EffectableSound
+	{
+	protected:
+		/// The duration in milliseconds that passed since this sound began playing.
+		SoundDuration elapsedFromStart_;
+
+		/// The source of the sound.
+		ALuint source_;
+
+		/// Additional sources to be used for the sound.
+		//std::vector <ALuint> secondarySources_;
+
+		/// The buffered content of the sound.
+		ALuint buffer_;
+
+		/// Flag that says wether the sound was started with a repeat.
+		/// This might be useful for short sounds that can be combined via a repeat.
+		bool repeating_;
+
+		/// The sample rate for the loaded sound.
+		SampleRate sampleRate_;
+
+		/// The sound can also store a list of tags
+		TagList tags_;
+
+		/// Will store the length of the buffer.
+		SoundDuration cachedBufferLength_;
+
+		/// A pointer to the sound repository is stored here. 
+		/// Do not change this to a smart pointer, as the repository is likely to store the sounds as smart pointers and that would produce issues.
+		OpenAlSoundRepository* repositoryPtr_;
+
+		virtual ALuint getAvailableSourceForPlay ();
+
+		virtual bool doPlay3D (double posX = 0, double posY = 0, double posZ = 0, bool repeatContinuously = false);
+		virtual void doResume (bool repeatContinuously = false);
+
+		virtual bool loadFrom (const gussound::AudioDeviceSmartPtr & devicePtr
+					, const std::string &fileName, bool loadInMemory, bool onlyOneInstance = true);
+
+		/// Utility function to retrieve the time that is currently elapsed from the stream.
+		virtual SoundDuration getStreamElapsedTime ();
+
+		/// Utility function to retrieve the length of the stream.
+		virtual SoundDuration getStreamLength ();
+
+		/// Utility function to calculate and retrieve the length of the stream.
+		virtual SoundDuration calculateAndRetrieveStreamLength ();
+
+	public:
+		GOpenAlSound (OpenAlSoundRepository* repoPtr, const std::string & id = "");
+		virtual ~GOpenAlSound();
+
+		virtual SoundVolume getOutputVolume(){ return volume_; }
+
+		virtual SoundDuration getSeekDuration();
+
+		virtual bool isRepeating(){ return repeating_; }
+
+		virtual void pause();
+
+		/// Commence the low-level sound play. Note that certain actions may be performed if the sound is already
+		/// playing, but not all possible actions are supported at this low level.
+		virtual void play2D (ActionIfPlayingEnum actionIfPlaying = ActionParallelPlay, bool repeatContinuously = false );
+
+		/// Commence the low-level sound play with 3D positioning. Note that certain actions may be performed if the sound is already
+		/// playing, but not all possible actions are supported at this low level. Will default to 2D play unless overridden.
+		virtual void play3D (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false);
+
+		/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+		/// This allows you to update the source of the sound after the play command is launched.
+		virtual int play3Dnamed (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false);
+
+		virtual SoundDuration getDuration();
+
+		virtual SampleRate getSampleRate(){ return sampleRate_; }
+
+		virtual const TagList & getTags() const { return tags_;}
+
+		virtual void seekToTime (const SoundDuration & duration);
+
+		virtual void setOutputVolume (const SoundVolume & volume);
+
+		virtual void stop();
+	};
+
+
+
+
+	
+
+	class OpenAlSoundRepository
+		: public SoundRepository
+	{
+	protected:
+		/// The sound sources available to the engine
+		std::vector <ALuint> soundSources_;
+
+		std::vector <ALuint> musicSources_;
+
+		/// The maximum number of sources allowed to play at one time.
+		/// Note: if you exceed the hardware/software limit, you may get no error, but still be unable to play any sounds
+		unsigned int maximumConcurrentSounds_;
+
+		/// The amount of sources reserved for music.
+		unsigned int reservedMusicSources_;
+
+		/// Internal function used to get an available (non-playing and non-paused) sound source.
+		/// @see getAvailableSourceForPlay
+		virtual ALuint getAvailableSoundSourceForPlay ();
+
+		/// Internal function used to get an available (non-playing and non-paused) music source.
+		/// @see getAvailableSourceForPlay
+		virtual ALuint getAvailableMusicSourceForPlay ();
+
+	public:
+		/// Constructor.
+		OpenAlSoundRepository ();
+		
+		/// Destructor.
+		virtual ~OpenAlSoundRepository ();
+
+		/// Sound creation function. It is designed to be placed as a function pointer in an abstract factory.
+		virtual EffectableSound * createSound (const std::string& id = "", const std::string& fileExtension = "");
+
+		/// Get a source that can be used for a play command. In case no available sources can be found:
+		/// - if the maximum amount of sound sources has not been reached yet, a new source is created.
+		/// - if the maximum amount of sound sources has been reached, an exception is thrown.
+		virtual ALuint getAvailableSourceForPlay (SoundCategory categ = GSC_Effect);
+
+	};
+
+
+	///
+	/// A custom implementation (OpenAL specific) of the sound manager.
+	///
+	class OpenAlManagerUtil
+		: public SoundManagerUtil
+	{
+	protected:
+		/// Constructor. A call from a singleton to the function createSoundManager is preferred.
+		OpenAlManagerUtil ();
+
+	public:
+		/// Destructor.
+		virtual ~OpenAlManagerUtil ();
+
+		/// Object instantiation function.
+		static SoundManagerUtil * createSoundManager ();
+
+		/// Create and return a string containing the version of the sound library
+		virtual std::string getVersion () const;
+
+		/// Set the listener position
+		virtual void setListenerPosition (double posX, double posY, double posZ);
+
+		/// Declare the singleton to be a friend for easy access..
+		friend class guslib::Singleton <OpenAlManagerUtil>;
+	};
+
+
+
+
+
+	//typedef guslib::Singleton<GAudiere::AudiereManagerUtil> AudiereSoundManager;
+}
+
+
+// ------------- LUA bindings begin -------------------
+#ifdef GOPENAL_LUA_FUNCS
+#include <lua.hpp>
+
+	static int l_soundPlay( lua_State *L )
+	{
+		std::string s( luaL_checkstring(L, 1) );
+		GSOUND_PLAY(s);
+		return 0;
+	}
+#endif// GAUDIERE_LUA_FUNCS
+// ------------- LUA bindings end -------------------
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussound.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,1703 @@
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+
+// The abstract sound interface
+#include <gussound.h>
+
+//
+// Add guslib inclusions... unless we're dealing with the standalone version
+//
+
+#ifdef GUSSOUND_STANDALONE
+
+// Tracing util
+#include <gussoundutil/trace.h>
+
+// Random numbers.
+#include <gussoundutil/random.h>
+
+// String parsing utility
+#include <gussoundutil/stringutil.h>
+
+#else
+
+// Tracing util
+#include <guslib/trace/trace.h>
+
+// Random numbers.
+#include <guslib/system/random.h>
+
+// String parsing utility
+#include <guslib/util/stringutil.h>
+
+#endif // GUSSOUND_STANDALONE
+
+#define GUSSOUND_MAJOR_VERSION 1
+#define GUSSOUND_MINOR_VERSION 2
+#define GUSSOUND_PATCH_VERSION 0
+
+namespace gussound
+{
+	SoundException::SoundException (const char* text)
+	{
+        this->exceptionMessage_ = text;
+    }
+
+    SoundException::~SoundException() throw()
+    {
+    }
+
+    const char* SoundException::what () const throw()
+	{
+		return this->exceptionMessage_.c_str ();
+	}
+
+	// ----------------------------------------------- AudioDevice -------------------------------------------------
+
+	AudioDevice::AudioDevice ()
+	{
+	}
+
+	AudioDevice::~AudioDevice ()
+	{
+		GTRACE (3, "Audio device dtor");
+	}
+
+
+
+	// --------------------------------------------- AbstractSound -------------------------------------------------
+
+
+
+	///
+	/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+	/// This is a fire & forget function. You cannot update the source of the sound after it is launched.
+	///
+	void AbstractSound::play3D (double , double , double , ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		GTRACE (7, "Abstract sound play3D entered. Not supported. Forwarding to 2D implementation");
+		play2D (actionIfPlaying, repeatContinuously);
+	}
+
+
+	///
+	/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+	/// This allows you to update the source of the sound after the play command is launched.
+	///
+	int AbstractSound::play3Dnamed (double , double , double , ActionIfPlayingEnum actionIfPlaying, bool repeatContinuously)
+	{
+		GTRACE (7, "Abstract sound play3D entered. Not supported. Forwarding to 2D implementation");
+		play2D (actionIfPlaying, repeatContinuously);
+		return 0;
+	}
+
+
+
+	// ----------------------------------------------- SoundEffect -------------------------------------------------
+
+
+	SoundEffect::SoundEffect (EffectableSoundSmartPtr & target, guslib::TimeUnits startFrom, guslib::TimeUnits stopAt)
+		: ptrToSound_ (target)
+		, startFrom_ (startFrom)
+		, stopAt_ (stopAt)
+		, internalTimer_ (startFrom)
+		, ended_ (false)
+		, targetLength_ (0)
+	{
+		GTRACE (6, "SoundEffect ctor from " << startFrom << " to " << stopAt << " for " << target->getId ());
+	}
+
+	SoundEffect::~SoundEffect ()
+	{
+		GTRACE(6, "SoundEffect dtor");
+	}
+
+	void SoundEffect::applyEffect ()
+	{
+		//dummy
+	}
+
+	void SoundEffect::elapseTime (const guslib::TimeUnits & time)
+	{
+		if (ended_)
+		{
+			return;
+		}
+		// see how much time has passed.
+		internalTimer_ = (guslib::TimeUnits) ptrToSound_->getSeekDuration();
+
+		// if the allowed time for the effect has ended, kill it.
+		if (internalTimer_ >= stopAt_)
+		{
+			endEffect ();
+			ended_ = true;
+			ptrToSound_->onEffectEnded (*this);
+			return;
+		}
+
+		// if the effect is not dead yet, check to see if it can be applied.
+		if (internalTimer_ >= startFrom_ && internalTimer_ <= stopAt_)
+		{
+			applyEffect();
+		}
+	}
+
+
+	void SoundEffect::endEffect(bool)
+	{
+		//dummy
+	}
+
+
+	bool SoundEffect::equals (const SoundEffect & rhs)
+	{
+		if (rhs.ended_ != ended_
+			|| rhs.internalTimer_ != internalTimer_
+			|| rhs.ptrToSound_ != ptrToSound_
+			|| rhs.startFrom_ != startFrom_
+			|| rhs.stopAt_ != stopAt_
+			|| rhs.targetLength_ != targetLength_)
+		{
+			return false;
+		}
+		return true;
+	}
+
+
+	void SoundEffect::reset()
+	{
+		internalTimer_ = 0; 
+		ended_ = false;
+	}
+
+
+	void SoundEffect::stop ()
+	{
+		internalTimer_ = 0;
+		ended_ = true;
+		ptrToSound_->onEffectEnded(*this);
+	}
+
+
+	//-------------------------------------- FadeInEffect --------------------------------
+
+	FadeInEffect::FadeInEffect (EffectableSoundSmartPtr & target
+		, const guslib::TimeUnits & duration
+		, const SoundVolume & minVolume)
+
+		: SoundEffect (target, 0, duration)
+		, minVolume_ (minVolume)
+	{
+		GTRACE (6, "FadeInEffect ctor1: from " << 0 << ", to " << duration);
+		GTRACE (6, "FadeInEffect ctor1: target (" << target->getId () << ") at " << target->getSeekDuration ());
+	}
+
+	FadeInEffect::FadeInEffect (EffectableSoundSmartPtr & target
+		, const guslib::TimeUnits & fromTime
+		, const guslib::TimeUnits & duration
+		, const SoundVolume & minVolume)
+
+		: SoundEffect (target, fromTime, fromTime + duration)
+		, minVolume_ (minVolume)
+	{
+		GTRACE (6, "FadeInEffect ctor2: from " << fromTime << ", to " << fromTime + duration);
+		GTRACE (6, "FadeInEffect ctor2: target (" << target->getId () << ") at " << target->getSeekDuration ());
+	}
+
+
+	FadeInEffect::~FadeInEffect ()
+	{
+		GTRACE (6, "FadeInEffect dtor.");
+	}
+
+	void FadeInEffect::applyEffect ()
+	{
+		GTRACE (7, "FadeInEffect applyEffect.");
+		if (stopAt_ == startFrom_)
+		{
+			// nothing to apply.
+			stop ();
+			return;
+		}
+
+		// see how much time has passed and apply a liniar value based on it.
+		SoundDuration fractionPassed;
+		fractionPassed = (SoundDuration)(internalTimer_-startFrom_) / (SoundDuration)(stopAt_ - startFrom_);
+		GTRACE (7, "FadeInEffect applyEffect, fraction passed=" << fractionPassed 
+			<< "; itimer=" <<internalTimer_ << "; start:" <<startFrom_ <<"; stop:" << stopAt_);
+		SoundVolume newVol = (SoundVolume) (fractionPassed * (max_volume - minVolume_));
+		ptrToSound_->setVolumeExtraModifier (newVol);
+	}
+
+
+	/// Define action to be taken when the effect ends (for instance, a fade-in would make sure that the sound level is appropriate at the end.
+	/// @param force Ignored
+	void FadeInEffect::endEffect (bool)
+	{
+		GTRACE (7, "FadeInEffect endEffect; applying final volume")
+		SoundVolume newVol = (SoundVolume) (max_volume - minVolume_);
+		ptrToSound_->setVolumeExtraModifier (newVol);
+	}
+
+
+	//----------------
+	FadeOutEffect::FadeOutEffect (EffectableSoundSmartPtr & target
+		, const guslib::TimeUnits & duration
+		, const SoundVolume & minVolume
+		, bool stopAtEnd)
+
+		: SoundEffect (target, (guslib::TimeUnits) (target->getDuration () - duration)
+					, (guslib::TimeUnits)target->getDuration ())
+		, stopOnEnd_ (stopAtEnd)
+		, minVolume_ (minVolume)
+	{
+		GTRACE(6, "FadeOutEffect ctor1");
+	}
+
+	FadeOutEffect::FadeOutEffect (EffectableSoundSmartPtr & target
+		, const guslib::TimeUnits & startFrom
+		, const guslib::TimeUnits & stopAt
+		, const SoundVolume & minVolume
+		, bool stopAtEnd)
+
+		: SoundEffect (target, startFrom, stopAt)
+		, stopOnEnd_ (stopAtEnd)
+		, minVolume_ (minVolume)
+	{
+		GTRACE (6, "FadeOutEffect ctor2");
+	}
+
+	FadeOutEffect::~FadeOutEffect ()
+	{
+		GTRACE (5, "FadeOutEffect Destr.");
+	}
+
+	void FadeOutEffect::applyEffect ()
+	{
+		GTRACE (7, "FadeOutEffect applyEffect.");
+		if (stopAt_ <= startFrom_)
+		{
+			GTRACE (7, "fade-out: start and stop are the same or reverted; FadeOutEffect applyEffect.");
+			stop ();
+			return;
+		}
+		SoundDuration fractionPassed;
+		fractionPassed = (SoundDuration)(internalTimer_ - startFrom_) / (SoundDuration)(stopAt_ - startFrom_);
+		GTRACE (7, "FadeOutEffect applyEffect, fraction passed=" << fractionPassed 
+			<< "; itimer=" <<internalTimer_ << "; start:" <<startFrom_ <<"; stop:" << stopAt_);
+		SoundVolume newVol = (SoundVolume)((1-fractionPassed) * (max_volume - minVolume_));
+		ptrToSound_->setVolumeExtraModifier( newVol );
+	}
+
+
+	///
+	/// Define action to be taken when the effect ends (for instance, a fade-out would stop the sound at the end.
+	/// @param force If the force flag is set to true, the stop commands for the sound are suppressed.
+	/// This is performed in order to prevent fade-in and fade-out effects running for the same sound and performing
+	/// an unplanned stop operation when the fade-out is finished.
+	///
+	void FadeOutEffect::endEffect (bool force)
+	{
+		GTRACE (GUSSNDTLVL, "fadeout effect ending...");
+		ptrToSound_->setVolumeExtraModifier (1.0f);
+		if (stopOnEnd_)
+		{
+			if (! force)
+			{
+				GTRACE (GUSSNDTLVL, "fadeout effect stopping on end.");
+				ptrToSound_->stop ();
+			}
+			else
+			{
+				GTRACE (GUSSNDTLVL, "Force flag suppresses stop operation of effect.");
+			}
+		}
+		else
+		{
+			GTRACE (GUSSNDTLVL, "fadeout effect pausing on end.");
+			ptrToSound_->pause ();
+		}
+	}
+
+
+
+	// ----------------------------------------------- Sound -------------------------------------------------
+
+
+	EffectableSound::EffectableSound(const std::string & id)
+		: volume_ (max_volume)
+		, effectVolume_ (max_volume)
+		, categoryVolume_ (max_volume)
+		, tracker_ (NULL)
+		, trackerTime_ (0)
+		, category_ (GSC_None)
+		, state_ (GPLS_Stopped)
+		, id_ (id)
+		, onlyOneInstance_ (true)
+		, streamed_ (false)
+
+	{
+		GTRACE(7, "EffectableSound ctor " << id_);
+	}
+
+
+	EffectableSound::~EffectableSound()
+	{
+		GTRACE(7, "EffectableSound dtor " << id_);
+	}
+
+
+    void EffectableSound::addEffect( SoundEffectPtr effect )
+	{
+		GTRACE(6, " EffectableSound::addEffect... to " << id_);
+		tempEffectList_.push_back( effect );
+		effect->applyEffect();
+	}
+
+
+	void EffectableSound::clearAllEffects ()
+	{
+		GTRACE (6, "Clearing all effects... from " << id_);
+		for (SoundEffectList::iterator it = tempEffectList_.begin ();
+			it != tempEffectList_.end (); ++it)
+		{
+			(*it)->endEffect (true);
+		}
+		tempEffectList_.clear ();
+		effectVolume_ = max_volume;
+	}
+
+
+	void EffectableSound::elapseTime (const guslib::TimeUnits & time)
+	{
+		if (state_ != GPLS_Playing)
+			return;
+
+		for (SoundEffectList::iterator iter = deletionList_.begin ();
+			iter != deletionList_.end (); ++iter)
+		{
+			for( SoundEffectList::iterator iter2 = tempEffectList_.begin ();
+				iter2 != tempEffectList_.end (); ++iter2 )
+			{
+				if(* iter == * iter2)
+				{
+					GTRACE(7, "EffectableSound::elapseTime removing effect");
+					tempEffectList_.erase( iter2 );
+					break;
+				}
+			}
+			deletionList_.erase(iter);
+			break;
+		}
+
+		for (SoundEffectList::iterator iter = tempEffectList_.begin ();
+			iter != tempEffectList_.end (); ++iter)
+		{
+			(*iter)->elapseTime (time);
+		}
+
+		if (tracker_)
+		{
+			if (getSeekDuration () >= trackerTime_)
+			{
+				GTRACE (5, "seek dur=" <<getSeekDuration () << "; tracker time: " <<trackerTime_ << "; making sound event");
+
+				SoundFinishingTrackerInterface * localTracker = tracker_;
+				clearTracker ();
+				if (0 != localTracker)
+				{
+					localTracker->onSoundEvent ();
+				}
+			}
+		}
+	}
+
+
+	SoundVolume EffectableSound::getCombinedVolumeModifiers ()
+	{
+		SoundVolume temp = effectVolume_ * volume_ * categoryVolume_;
+		return temp;
+	}
+
+
+	void EffectableSound::onEffectEnded (const SoundEffect & effect)
+	{
+		for( SoundEffectList::const_iterator iter = tempEffectList_.begin();
+			iter != tempEffectList_.end(); ++iter )
+		{
+			if (*iter && (*iter)->equals (effect))
+			{
+				deletionList_.push_back (*iter);
+				GTRACE(6, "EffectableSound::onEffectEnded (exit, effect added to deletion list)");
+				return;
+			}
+		}
+	}
+
+	void EffectableSound::setTracker (SoundFinishingTrackerInterface * ptr, SoundDuration dur)
+	{
+		GTRACE(7, "EffectableSound tracker set for time =" << dur);
+		tracker_ = ptr;
+		trackerTime_ = dur;
+	}
+
+
+	void EffectableSound::clearTracker ()
+	{
+		 tracker_ = NULL;
+	}
+
+
+	void EffectableSound::setVolume (const SoundVolume & volume)
+	{
+		volume_ = volume;
+		setOutputVolume (getCombinedVolumeModifiers ());
+	}
+
+	void EffectableSound::setVolumeCategoryModifier (const SoundVolume & volume)
+	{
+		GTRACE (6, id_ << " got volume for category " << getCategory () << " as " << volume);
+		categoryVolume_ = volume;
+		setOutputVolume (getCombinedVolumeModifiers ());
+	}
+
+	void EffectableSound::setVolumeExtraModifier (const SoundVolume & volume)
+	{
+		effectVolume_ = volume;
+		GTRACE (7, id_ << " setting sound volume:" << getCombinedVolumeModifiers ());
+		GTRACE (7, id_ << " effectVolume_:" << effectVolume_);
+		GTRACE (7, id_ << " categoryVolume_:" << categoryVolume_);
+		GTRACE (7, id_ << " volume_:" << volume_);
+		setOutputVolume (getCombinedVolumeModifiers ());
+	}
+
+	// -------------------------------------- SoundGroup ----------------------------------------------
+	
+	SoundGroup::SoundGroup()
+		: currentWeightSum_(0)
+	{
+	}
+
+	SoundGroup::~SoundGroup()
+	{
+		GTRACE (5, "Sound group dtor");
+		// release all map entries.
+		sounds_.clear();
+	}
+
+
+	void SoundGroup::addEmptySlot (int weight)
+	{
+		GTRACE (4, "Adding an empty slot for sound " << " with weight " << weight);
+		addSound (EMPTY_SLOT_NAME, weight);
+	}
+
+
+	void SoundGroup::addSound (const std::string & soundName, int weight)
+	{
+		std::map<std::string, int>::iterator iter = sounds_.find (soundName);
+		if (iter != sounds_.end ())
+		{
+			throw SoundException ("SoundGroup: attempting to add an already existing sound!");
+		}
+
+		sounds_.insert (std::make_pair (soundName, weight));
+		currentWeightSum_ += weight;
+	}
+
+
+	void SoundGroup::removeEmptySlot ()
+	{
+		removeSound ("_");
+	}
+
+
+
+	void SoundGroup::removeSound (const std::string & soundName)
+	{
+		std::map<std::string, int>::iterator iter = sounds_.find( soundName );
+		if( iter == sounds_.end() )
+		{
+			throw SoundException ("SoundGroup: attempting to remove a non-existent sound!");
+		}
+		int weight = iter->second;
+		sounds_.erase( iter );
+
+		currentWeightSum_ -= weight;
+	}
+
+
+	std::string SoundGroup::getRandomSound() const
+	{
+		// get a random number between 0 and currentWeightSum_-1;
+
+		long randomValue = 0;
+		bool found = false;
+		randomValue = guslib::Random::getPtr ()->getValueUpTo( currentWeightSum_ );
+
+		// now simply decrease the weight for each item until the negative value is passed, or the first item is encountered.
+		std::map<std::string, int>::const_iterator iter = sounds_.begin();
+		//randomValue -= iter->second;
+		//found = (randomValue < 0);
+		while( iter != sounds_.end() && !found )
+		{
+			randomValue -= iter->second;
+			found = (randomValue < 0);
+			if( ! found )
+				++iter;
+		}
+
+		if (! found)
+		{
+			return std::string (EMPTY_SOUND_FILE);
+		}
+
+		return iter->first;
+	}
+
+	// ----------------------------------------------- Playlist -------------------------------------------------
+
+	Playlist::Playlist()
+		: fadeInAtPlay_(true)
+		, fadeOutAtPause_(true)
+		, fadeOutAtStop_(true)
+		, currentTrack_("")
+		, currentTrackIdx_(-1)
+		, repeat_(false)
+		, shuffle_(false)
+		, ptrToRepository_(NULL)
+		, autoSkipToNextTrack_(true)
+		, fadeDuration_(standard_fade_duration)
+	{
+		GTRACE(6, "Playlist ctor1");
+		playCount_.clear();
+		playOrder_.clear();
+		tracks_.clear();
+	}
+
+	Playlist::Playlist (const SoundRepositorySmartPtr & repository_
+		, PlaylistListener * listener
+		, const std::string & id)
+		: fadeInAtPlay_(true)
+		, fadeOutAtPause_(true)
+		, fadeOutAtStop_(true)
+		, currentTrack_("")
+		, currentTrackIdx_(-1)
+		, repeat_(false)
+		, shuffle_(false)
+		, ptrToRepository_(repository_)
+		, autoSkipToNextTrack_(true)
+		, ptrToListener_ (listener)
+		, id_ (id)
+		, fadeDuration_(standard_fade_duration)
+	{
+		GTRACE(6, "Playlist ctor2");
+		playCount_.clear();
+		playOrder_.clear();
+		tracks_.clear();
+	}
+
+
+	Playlist::Playlist( const Playlist & rhs )
+		: fadeInAtPlay_(rhs.fadeInAtPlay_)
+		, fadeOutAtPause_(rhs.fadeOutAtPause_)
+		, fadeOutAtStop_(rhs.fadeOutAtStop_)
+		, currentTrack_( rhs.currentTrack_)
+		, currentTrackIdx_( rhs.currentTrackIdx_)
+		, repeat_( rhs.repeat_ )
+		, shuffle_(rhs.shuffle_ )
+		, ptrToRepository_( rhs.ptrToRepository_ )
+		, autoSkipToNextTrack_(true)
+		, ptrToListener_(rhs.ptrToListener_)
+	{
+		tracks_ = rhs.tracks_;
+		playCount_ = rhs.playCount_;
+		GTRACE(6, "Playlist copyctor");
+	}
+
+	Playlist::~Playlist()
+	{
+		GTRACE(6, "Playlist dtor: " << id_);
+	}
+
+	void Playlist::addTrack(const std::string &trackName)
+	{
+		if( !ptrToRepository_ )
+		{
+			throw SoundException ("Failure by addTrack for playlist (no access to repository)");
+		}
+		if( ! tracks_.empty() )
+		{
+			for( std::vector<std::string>::iterator iter = tracks_.begin();
+				iter != tracks_.end(); ++iter )
+			{
+				if( *iter == trackName )
+				{
+					throw SoundException ("Already using track ");
+				}
+			}
+		}
+		tracks_.push_back( trackName );
+		playCount_.push_back(0);
+		if( currentTrackIdx_ == -1 )
+		{
+			currentTrackIdx_ = 0;
+		}
+	}
+
+
+	void Playlist::pause()
+	{
+		GTRACE (GUSSNDTLVL, "Playlist pause: " << id_);
+		if( tracks_.empty() )
+			return;
+		if( currentTrackIdx_ < 0 )
+			return;
+		if( fadeOutAtPause_ )
+		{
+			GTRACE(GUSSNDTLVL, id_ << ": Pausing playlist with a fade-out effect.");
+			SoundEffectPtr tempPtr = new FadeOutEffect
+				(ptrToRepository_->getSound (tracks_[currentTrackIdx_])
+				, (guslib::TimeUnits) ptrToRepository_->getSound (tracks_[currentTrackIdx_])->getSeekDuration ()
+				, (guslib::TimeUnits) (ptrToRepository_->getSound(tracks_[currentTrackIdx_])->getSeekDuration() 
+						+ getFadeDuration())
+				, 0
+				, false); 
+			ptrToRepository_->getSound(tracks_[currentTrackIdx_] )->addEffect (tempPtr);
+			//TODO: investigate possible conflicts
+			state_ = GPLS_Paused;
+		}
+		else
+		{
+			GTRACE(GUSSNDTLVL, "Pausing playlist w/o effects.");
+			ptrToRepository_->getSound (tracks_[currentTrackIdx_])->pause ();
+			state_ = GPLS_Paused;
+		}
+	}
+
+
+	void Playlist::play ()
+	{
+		GTRACE (GUSSNDTLVL, "[" << id_ << "] Playlist received play command");
+		if (tracks_.empty ())
+		{
+			return;
+		}
+
+		if (currentTrackIdx_ < 0 || currentTrackIdx_ >= (int)tracks_.size ())
+		{
+			throw SoundException ("Playlist play with current track idx outside bounds!");
+		}
+
+		// clear all the previous effects that may be still active on this sound.
+
+		ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->clearAllEffects ();
+		if (fadeInAtPlay_)
+		{
+			if (state_ == GPLS_Stopped || state_ == GPLS_Playing)
+			{
+				GTRACE (GUSSNDTLVL, id_ << ": Playlist playing (starting from stop) with fade-in");
+				ptrToRepository_->getSound (tracks_ [currentTrackIdx_] )->addEffect (
+					GSmartPtr <SoundEffect>(
+						new FadeInEffect (ptrToRepository_->getSound (tracks_ [currentTrackIdx_])
+						, (guslib::TimeUnits)getFadeDuration ())));
+			}
+			else // paused
+			{
+				//ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->clearAllEffects (); // TODO: re-enable if needed.
+				GTRACE (GUSSNDTLVL, id_ << " Playlist playing (resuming from pause) with fade-in");
+				ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->addEffect (
+					GSmartPtr<SoundEffect>(
+						new FadeInEffect (ptrToRepository_->getSound (tracks_ [currentTrackIdx_])
+										, (guslib::TimeUnits) ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->getSeekDuration ()
+										, (guslib::TimeUnits) getFadeDuration ()
+										, 0)));
+			}
+		}
+
+		ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->play2D ();
+		if (state_ == GPLS_Stopped)
+		{
+			ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->setTracker (this
+				, ptrToRepository_->getSound (tracks_[currentTrackIdx_])->getDuration () - 
+					ptrToRepository_->getSound (tracks_[currentTrackIdx_])->getSeekDuration () -
+					getFadeDuration ());
+		}
+		else
+		{
+			ptrToRepository_->getSound (tracks_[currentTrackIdx_])->setTracker (this
+				, ptrToRepository_->getSound (tracks_[currentTrackIdx_])->getDuration () - getFadeDuration ());
+		}
+		playCount_ [currentTrackIdx_] ++;
+
+		if (playOrder_.empty ())
+		{
+			playOrder_.push_back (currentTrackIdx_);
+		}
+
+		state_ = GPLS_Playing;
+		currentTrack_ = tracks_[currentTrackIdx_];
+		if( ptrToListener_ )
+		{
+			ptrToListener_->OnTrackPlay (currentTrack_);
+		}
+	}
+
+
+
+	void Playlist::removeTrack (const std::string & trackName)
+	{
+		// if a track is removed from the list, but playing, the play cmd is kept.
+		int idx=-1;
+		for( std::vector<std::string>::iterator iter = tracks_.begin();
+			iter != tracks_.end(); ++iter, ++idx )
+		{
+			if( *iter == trackName )
+			{
+				tracks_.erase(iter);
+				if( currentTrackIdx_ == idx )
+				{
+					currentTrackIdx_ --;
+				}
+				return;
+			}
+		}
+		throw SoundException ("Not using track.");
+	}
+
+
+
+	void Playlist::setFade (bool atPlay, bool atStop, bool atPause)
+	{
+		fadeInAtPlay_ = atPlay;
+		fadeOutAtStop_ = atStop;
+		fadeOutAtPause_ = atPause;
+	}
+
+
+	/// Move the iterator to the next item in the list. The play state is maintained.
+	void Playlist::skipToNextTrack ()
+	{
+		GTRACE(5, "Playlist::skipToNextTrack()");
+		// if there are no tracks, there's nowhere to skip to.
+		if( playCount_.empty() )
+		{
+			return;
+		}
+
+		// If the playlist contains a single track, skipping to the next track means playing the same track all over again.
+		// The question is: how does one handle cross-fading in this scenario?
+		// Let's just get rid of it in this case.
+		if (playCount_.size () == 1)
+		{
+			if (state_ == GPLS_Playing)
+			{
+				stop (false);
+        play ();
+			}
+			if (ptrToListener_)
+			{
+				ptrToListener_->OnTrackChange (currentTrack_);
+			}
+			return;
+		}
+
+
+		PlayState temp = state_;
+		if( state_ == GPLS_Playing || state_ == GPLS_Paused )
+		{
+			GTRACE(5, "Playlist::skipToNextTrack() while in pause or play.");
+			stop ();
+		}
+
+		int newPos = 0;
+		if( shuffle_ )
+		{
+			// get the minimum value of playcounts.
+			int minPlayCount = playCount_[0];
+			for( unsigned i=0; i< playCount_.size(); ++i )
+			{
+				if( playCount_[i] < minPlayCount )
+				{
+					minPlayCount = playCount_[i];
+				}
+			}
+			std::vector<int> indices;
+			for( unsigned i=0; i<playCount_.size(); ++i )
+			{
+				if( playCount_[i] == minPlayCount )
+				{
+					indices.push_back(i);
+				}
+			}
+			if( repeat_ )
+			{
+				newPos = guslib::Random::getPtr()->getValueUpTo( (long)indices.size() );
+				// if the play record is full, remove the oldest item.
+				if( playOrder_.size() >= playCount_.size() )
+				{
+					playOrder_.erase(playOrder_.begin());
+				}
+				newPos = indices[newPos];
+				playOrder_.push_back(newPos);
+			}
+			else
+			{
+				// no repeat
+				if( minPlayCount == playCount_[0] && minPlayCount == 0 )
+				{
+					currentTrackIdx_ = 0;
+					if( ptrToListener_ )
+					{
+						ptrToListener_->OnPlaylistEnd();
+					}
+					return;
+				}
+				else
+				{
+					newPos = guslib::Random::getPtr ()->getValueUpTo( (long)indices.size() );
+					playOrder_.push_back(indices[newPos]);
+				}
+			}
+		}
+		else
+		{
+			newPos = currentTrackIdx_ + 1;
+			if( newPos >= (int)tracks_.size() )
+			{
+				newPos = 0;
+				if( ! repeat_ )
+				{
+					currentTrackIdx_ = 0;
+					if( ptrToListener_ )
+					{
+						ptrToListener_->OnPlaylistEnd();
+					}
+					return;
+				}
+			}
+		}
+
+		currentTrack_ = tracks_[newPos];
+		currentTrackIdx_ = newPos;
+
+		if( temp == GPLS_Playing )
+		{
+			play ();
+		}
+		if( ptrToListener_ )
+		{
+			ptrToListener_->OnTrackChange( currentTrack_ );
+		}
+	}
+
+
+	void Playlist::skipToPreviousTrack()
+	{
+		GTRACE(5, "Playlist::skipToPrevTrack()");
+		// if there are no tracks, there's nowhere to skip to.
+		if( playCount_.empty() )
+		{
+			return;
+		}
+
+		PlayState temp = state_;
+		if( state_ == GPLS_Playing || state_ == GPLS_Paused )
+		{
+			GTRACE(5, "Playlist::skipToPreviousTrack() while in pause or play.");
+			stop ();
+		}
+
+		if( shuffle_ )
+		{
+			for( unsigned i=0; i<playOrder_.size(); ++i )
+			{
+				GTRACE(7, "(before) play order["<<i<<"]="<<playOrder_[i]<<"; out of "<<playOrder_.size());
+			}
+			// to see where the skip should occur, we should check the track before
+			// the last position in the play order.
+			if( playOrder_.size() >1 )
+			{
+				currentTrackIdx_ = playOrder_[playOrder_.size()-2];
+				GTRACE(6, "Should skip to track:"<<currentTrackIdx_);
+				playOrder_.pop_back();
+			}
+			else if( playOrder_.size() ==1 )
+			{
+				//there is only one element;remove it
+				
+				currentTrackIdx_ = playOrder_[playOrder_.size()-1];
+				GTRACE(6, "Should skip to track:"<<currentTrackIdx_);
+				playOrder_.pop_back();
+				//also don't resume play
+				ptrToListener_->OnPlaylistEnd();
+				return;
+			}
+
+			//else nothing can be done.
+			for( unsigned i=0; i<playOrder_.size(); ++i )
+			{
+				GTRACE(7, "(after) play order["<<i<<"]="<<playOrder_[i]<<"; out of "<<playOrder_.size());
+			}
+		}
+		else // (non-shuffle)
+		{
+			currentTrackIdx_ --;
+			if(currentTrackIdx_ < 0 )
+			{
+				currentTrackIdx_ = (int)playCount_.size()-1;
+			}
+			currentTrack_ = tracks_[currentTrackIdx_];
+		}
+		if( temp == GPLS_Playing )
+		{
+			GTRACE(7, "resuming play");
+			play ();
+		}
+		if( ptrToListener_ )
+		{
+			ptrToListener_->OnTrackChange( currentTrack_ );
+		}
+	}
+
+
+	void Playlist::setRepeat( bool value )
+	{
+		repeat_ = value;
+	}
+
+	void Playlist::setShuffle( bool value )
+	{
+		shuffle_ = value;
+		playOrder_.clear();
+		for( unsigned i=0; i<playCount_.size(); ++i )
+		{
+			playCount_[i] = 0;
+		}
+	}
+
+
+	void Playlist::stop ()
+	{
+		GTRACE (GUSSNDTLVL, "[" << id_ << "] Playlist received stop command");
+		if (tracks_.empty ())
+		{
+			return;
+		}
+		
+		if (currentTrackIdx_ < 0 || currentTrackIdx_ >= (int)tracks_.size ())
+		{
+			return;
+		}
+
+		if (fadeOutAtStop_)
+		{
+			ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->addEffect ( 
+				GSmartPtr<SoundEffect> (
+					new FadeOutEffect (ptrToRepository_->getSound(tracks_[currentTrackIdx_])
+					, (guslib::TimeUnits) (ptrToRepository_->getSound(tracks_ [currentTrackIdx_])->getSeekDuration ())
+					, (guslib::TimeUnits) (ptrToRepository_->getSound(tracks_ [currentTrackIdx_])->getSeekDuration () + getFadeDuration ())
+					, 0
+					, true) 
+					) 
+				);
+			//state_ = GPLS_PlayingButStopping;
+		}
+		else
+		{
+			ptrToRepository_->getSound (tracks_[currentTrackIdx_])->stop ();
+		}
+		GTRACE (GUSSNDTLVL, id_ << " Playlist has stopped state.");
+		state_ = GPLS_Stopped;
+	}
+
+
+
+	void Playlist::stop (bool fadeOut)
+	{
+		GTRACE (GUSSNDTLVL, "[" << id_ << "] Playlist received stop command");
+		if (tracks_.empty ())
+		{
+			return;
+		}
+		
+		if (currentTrackIdx_ < 0 || currentTrackIdx_ >= (int)tracks_.size ())
+		{
+			return;
+		}
+
+		if (fadeOut)
+		{
+			ptrToRepository_->getSound (tracks_ [currentTrackIdx_])->addEffect ( 
+				GSmartPtr<SoundEffect> (
+					new FadeOutEffect (ptrToRepository_->getSound(tracks_[currentTrackIdx_])
+					, (guslib::TimeUnits) (ptrToRepository_->getSound(tracks_ [currentTrackIdx_])->getSeekDuration ())
+					, (guslib::TimeUnits) (ptrToRepository_->getSound(tracks_ [currentTrackIdx_])->getSeekDuration () + getFadeDuration ())
+					, 0
+					, true) 
+					) 
+				);
+			//state_ = GPLS_PlayingButStopping;
+		}
+		else
+		{
+			ptrToRepository_->getSound (tracks_[currentTrackIdx_])->stop ();
+		}
+		GTRACE (GUSSNDTLVL, id_ << " Playlist has stopped state.");
+		state_ = GPLS_Stopped;
+	}
+
+
+	void Playlist::onSoundEvent()
+	{
+		if( state_ == GPLS_Stopped )
+			return;
+		GTRACE(5, "Playlist::onSoundEvent()");
+
+		if (autoSkipToNextTrack_)
+		{
+			GTRACE(5, "Playlist::onSoundEvent() skip to next track");
+			skipToNextTrack ();
+		}
+	}
+
+	// ------------------------------------- SoundRepository ------------------------------------------
+
+
+	SoundRepository::SoundRepository()
+	{
+		GTRACE(6, "SoundRepository ctor");
+		for( int i=GSC_Effect; i<GSC_None; ++i )
+		{
+			categoryVolumes_.push_back(0.5);
+		}
+	}
+
+	SoundRepository::~SoundRepository()
+	{
+		GTRACE(6, "SoundRepository dtor");
+		sounds_.clear ();
+		GTRACE (6, "done clearing list");
+	}
+
+
+
+	void SoundRepository::addSound (const std::string &soundName, const std::string & fileName, bool loadIntoMemory, SoundCategory cat, bool onlyOneInstance)
+	{
+		GTRACE (4, "Adding sound named [" << soundName << "] from file [" << fileName << "] in categ [" << cat << "]");
+		// search for the given name.
+		SoundMap::iterator iter = sounds_.find (soundName);
+		if( iter != sounds_.end() )
+		{
+			throw SoundException ("Tried to add a sound with a name already in use!");
+		}
+
+		// Get the extension from the file name
+		std::string extension = guslib::stringutil::getExtensionFromFileName (fileName);
+
+		EffectableSoundSmartPtr mySound = createSound(soundName, extension);
+		mySound->loadFrom (audioDevice_, fileName, loadIntoMemory, onlyOneInstance);
+		mySound->setCategory (cat);
+
+		// Also set the volume for the sound according to the category.
+		SoundVolume vol = getVolumeForCategory(cat);
+		if (cat != GSC_Master)
+		{
+			vol *= getVolumeForCategory(GSC_Master);
+		}
+		mySound->setVolumeCategoryModifier (vol);
+		
+		sounds_.insert( std::make_pair( soundName, mySound ) );
+	}
+
+
+	void SoundRepository::elapseTime (const guslib::TimeUnits & time)
+	{
+		GTRACE (9, "Repository, elapsing time for sounds: " << time);
+		for (SoundMap::iterator iter = sounds_.begin (); iter != sounds_.end (); ++iter)
+		{
+			iter->second->elapseTime (time);
+		}
+	}
+
+
+	EffectableSoundSmartPtr & SoundRepository::getSound (const std::string &soundName)
+	{
+		SoundMap::iterator iter = sounds_.find (soundName);
+		if (iter == sounds_.end ())
+		{
+			GTRACE (2, "EXCEPTION! Tried to get an inexistent sound: [" << soundName << "]");
+			// Also log the existing sounds. Might be useful for a comparison.
+			if (soundName.compare (EMPTY_SOUND_FILE) != 0)
+			{
+				GTRACE (3, "Current list of sounds:");
+				for (SoundMap::iterator it2 = sounds_.begin(); 
+					it2 != sounds_.end(); ++it2 )
+				{
+					GTRACE(3, " -> [" << it2->first << "]");
+				}
+			}
+			throw SoundException ("Tried to get an inexistent sound!");
+		}
+		return iter->second;
+	}
+
+
+	void SoundRepository::removeSound (const std::string &soundName)
+	{
+		SoundMap::iterator iter = sounds_.find (soundName);
+		if (iter == sounds_.end ())
+		{
+			GTRACE (2, "EXCEPTION! Tried to remove an inexistent sound: " << soundName);
+			throw SoundException ("Tried to remove an inexistent sound!");
+		}
+
+		sounds_.erase (iter);
+	}
+
+
+	SoundVolume SoundRepository::getVolumeForCategory (SoundCategory categ) const
+	{
+		return categoryVolumes_[categ];
+	}
+
+
+	void SoundRepository::setVolumeForCategory (SoundCategory categ, SoundVolume vol)
+	{
+		if (categ == GSC_None)
+		{
+			GTRACE (3, "WARNING: Trying to set volume for category [none]. Not allowed.");
+			return;
+		}
+
+		// store it.
+		categoryVolumes_[categ] = vol;
+		GTRACE (5, "Volume for category [" << categ << " is now " << vol);
+
+		// treat it differently: master will affect everything.
+
+		if (categ == GSC_Master)
+		{
+			for (SoundMap::iterator iter = sounds_.begin();
+				iter != sounds_.end(); ++iter)
+			{
+				SoundVolume catVol = categoryVolumes_[iter->second->getCategory()];
+				iter->second->setVolumeCategoryModifier (vol * catVol);
+			}
+		}
+		else
+		{
+			// non-master will only affect only the given category. Also take the master volume into account.
+
+			SoundVolume masterVol = categoryVolumes_[GSC_Master];
+
+			for (SoundMap::iterator iter = sounds_.begin();
+				iter != sounds_.end(); ++iter)
+			{
+				if (iter->second->getCategory() == categ)
+				{
+					GTRACE (6, "Setting cat volume for " << iter->second->getId());
+					iter->second->setVolumeCategoryModifier (vol * masterVol);
+				}
+			}
+		}
+
+	}
+
+
+
+
+	// ----------------------------------------------- MusicPlayer -------------------------------------------------
+
+
+	MusicPlayer::MusicPlayer (const std::string & id)
+		: ptrToRepository_ (NULL)
+		, playstate_ (GPLS_Stopped)
+		, shuffle_ (false)
+		, repeat_ (true)
+		, volume_ (max_volume)
+		, skipToNextTrackAutomatically_ (true)
+		, fadeInAtPlay_ (true)
+		, fadeOutAtStop_ (true)
+		, fadeOutAtPause_ (true)
+		, currentList_ ("")
+		, keepPlayingAtListChange (true)
+		, listenerPtr_ (NULL)
+		, id_ (id)
+		, fadeDuration_ (standard_fade_duration)
+	{
+		GTRACE(6, "MusicPlayer ctor");
+	}
+
+	MusicPlayer::~MusicPlayer ()
+	{
+		// handle the destruction of all managed lists.
+		GTRACE (5, "MusicPlayer dtor");
+		// make sure to manually call the playlists clear first
+		// this is done because they have callbacks to the listener interface, which is our object.
+		// 
+		playlists_.clear ();
+		GTRACE (5, "(destroying player: " << id_ << ")");
+	}
+
+	bool MusicPlayer::isPlaylistRegistered (const std::string& name)
+	{
+		PlaylistMapping::iterator iter = playlists_.find (name);
+		return iter != playlists_.end ();
+	}
+
+	void MusicPlayer::registerPlaylist (const std::string & name)
+	{
+		GTRACE (5, "MusicPlayer registering playlist [" << name << "]");
+		if (!ptrToRepository_)
+		{
+			throw SoundException ("MusicPlayer: not initialized! (no repository registered). Attempting to register a playlist.");
+		}
+
+		PlaylistMapping::iterator iter = playlists_.find (name);
+		if (iter != playlists_.end ())
+		{
+			// There is a playlist already registered.
+			throw SoundException ("MusicPlayer: attempting to re-register a playlist!");
+		}
+
+		GTRACE (6, "MusicPlayer registerPlaylist added [" << name << "]");
+		// store a temporary pointer, so that we may assign some values to the playlist.
+		// these values are general and belong to the music player, so they need to be transferred to the playlist.
+		Playlist * myPlaylistPtr = new Playlist (ptrToRepository_, this, name);
+		myPlaylistPtr->setFadeDuration (fadeDuration_);
+		myPlaylistPtr->setRepeat (repeat_);
+		playlists_.insert (std::make_pair (name, PlaylistSmartPtr (myPlaylistPtr)));
+		
+
+		// If this is the first list registered, make it the current list automatically
+
+		if (currentList_ == "")
+		{
+			currentList_ = name;
+		}
+		GTRACE (6, "MusicPlayer registerPlaylist currentList_ [" << currentList_ << "]");
+	}
+
+
+	void MusicPlayer::unregisterPlaylist( const std::string & name )
+	{
+		PlaylistMapping::iterator iter = playlists_.find( name );
+		if( iter == playlists_.end() )
+		{
+			throw SoundException ("MusicPlayer: attempting to un-register a non-existent playlist!");
+		}
+
+		// If we're unregistering the playlist that we're currently playing, make sure to set the current list to be empty
+		// (so that we don't try to play it).
+		if (currentList_ == name)
+		{
+			currentList_ = "";
+		}
+
+		playlists_.erase( iter );
+
+		// If there are no more registered playlists left, clear the current list.
+
+		if( playlists_.begin() == playlists_.end() )
+		{
+			currentList_ = "";
+		}
+	}
+
+
+	void MusicPlayer::addTrackToPlaylist (const std::string & playlistName, const std::string & trackName)
+	{
+		PlaylistMapping::iterator iter = playlists_.find (playlistName);
+		if (iter == playlists_.end ())
+		{
+			if (playlistName.compare ("") != 0)
+			{
+				// Also log the existing playlists. Might be useful for a comparison.
+				GTRACE (3, "Could not find playlist [" << playlistName << "]. Current list of playlists:");
+				for (PlaylistMapping::const_iterator it2 = playlists_.begin (); 
+					it2 != playlists_.end (); ++it2 )
+				{
+					GTRACE (3, " -> [" << it2->first << "]");
+				}
+			}
+			throw SoundException ("MusicPlayer: attempting to add a track to a non-existent playlist!");
+		}
+
+		playlists_[playlistName]->addTrack (trackName);
+	}
+
+
+
+	void MusicPlayer::removeTrackFromPlaylist( const std::string & playlistName, const std::string & trackName )
+	{
+		PlaylistMapping::iterator iter = playlists_.find( playlistName );
+		if( iter == playlists_.end() )
+		{
+			throw SoundException("MusicPlayer: attempting to remove a track from a non-existent playlist!");
+		}
+
+		playlists_[playlistName]->removeTrack( trackName );
+	}
+
+
+
+	void MusicPlayer::nextTrack()
+	{
+		GTRACE(5, "MusicPlayer::nextTrack");
+		// Ask for next track in the current playlist.
+
+		if( currentList_ != "" )
+		{
+			playlists_[currentList_]->skipToNextTrack();
+		}
+	}
+
+	void MusicPlayer::stop ()
+	{
+		GTRACE (GUSSNDTLVL, "MusicPlayer received stop command");
+
+		// Stop the current playlist.
+
+		if( currentList_ != "" )
+		{
+			playlists_[currentList_]->stop ();
+		}
+	}
+
+	void MusicPlayer::play ()
+	{
+		GTRACE (GUSSNDTLVL, "MusicPlayer received play command");
+
+		// Play the current playlist.
+
+		if( currentList_ != "" )
+		{
+			playlists_[currentList_]->play ();
+		}
+	}
+
+	void MusicPlayer::pause()
+	{
+		GTRACE (GUSSNDTLVL, "MusicPlayer received pause command");
+
+		// Pause the current playlist.
+
+		if( currentList_ != "" )
+		{
+			playlists_[currentList_]->pause();
+		}
+	}
+	
+	void MusicPlayer::previousTrack()
+	{
+		// Ask for previous track in the current playlist.
+
+		if( currentList_ != "" )
+		{
+			playlists_[currentList_]->skipToPreviousTrack();
+		}
+	}
+
+	void MusicPlayer::setFadePreferrences (bool atPlay, bool atStop, bool atPause)
+	{
+		fadeInAtPlay_ = atPlay;
+		fadeOutAtStop_ = atStop;
+		fadeOutAtPause_ = atPause;
+	}
+
+
+	void MusicPlayer::setFadeDuration (SoundDuration dur)
+	{
+		fadeDuration_ = dur;
+
+		for( PlaylistMapping::iterator iter = playlists_.begin();
+				iter != playlists_.end(); ++iter )
+		{
+			iter->second->setFadeDuration( dur );
+		}
+	}
+
+	void MusicPlayer::setRepeat (bool value)
+	{
+		repeat_ = value;
+		for( PlaylistMapping::iterator iter = playlists_.begin();
+				iter != playlists_.end(); ++iter )
+		{
+			iter->second->setRepeat( value );
+		}
+	}
+
+
+	void MusicPlayer::setShuffle (bool value)
+	{
+		for( PlaylistMapping::iterator iter = playlists_.begin();
+				iter != playlists_.end(); ++iter )
+		{
+			iter->second->setShuffle( value );
+		}
+	}
+
+
+
+
+	void MusicPlayer::setPlaylistRepeat (const std::string& playlistName, bool value)
+	{
+		PlaylistMapping::iterator iter = playlists_.find (playlistName);
+		if (iter == playlists_.end ())
+		{
+			if (playlistName.compare ("") != 0)
+			{
+				// Also log the existing playlists. Might be useful for a comparison.
+				GTRACE (3, "Could not find playlist [" << playlistName << "]. Current list of playlists:");
+				for (PlaylistMapping::const_iterator it2 = playlists_.begin (); 
+					it2 != playlists_.end (); ++it2 )
+				{
+					GTRACE (3, " -> [" << it2->first << "]");
+				}
+			}
+			throw SoundException ("MusicPlayer: attempting set repeat property to a non-existent playlist!");
+		}
+
+		playlists_[playlistName]->setRepeat (value);
+	}
+	
+
+	
+	void MusicPlayer::setPlaylistShuffle (const std::string& playlistName, bool value)
+	{
+		PlaylistMapping::iterator iter = playlists_.find (playlistName);
+		if (iter == playlists_.end ())
+		{
+			if (playlistName.compare ("") != 0)
+			{
+				// Also log the existing playlists. Might be useful for a comparison.
+				GTRACE (3, "Could not find playlist [" << playlistName << "]. Current list of playlists:");
+				for (PlaylistMapping::const_iterator it2 = playlists_.begin (); 
+					it2 != playlists_.end (); ++it2 )
+				{
+					GTRACE (3, " -> [" << it2->first << "]");
+				}
+			}
+			throw SoundException ("MusicPlayer: attempting set shuffle property to a non-existent playlist!");
+		}
+
+		playlists_[playlistName]->setShuffle (value);
+	}
+
+
+
+	void MusicPlayer::setListener (MusicPlayerListener * listener)
+	{
+		listenerPtr_ = listener;
+	}
+
+
+	void MusicPlayer::switchToPlaylist( const std::string & playlistName, bool pauseExisting )
+	{
+		PlaylistMapping::iterator iter = playlists_.find (playlistName);
+		if (iter == playlists_.end ())
+		{
+			GTRACE (5, id_ << " MusicPlayer: attempting to switch to a non-existent playlist: " << playlistName);
+			throw SoundException ("MusicPlayer: attempting to switch to a non-existent playlist!");
+		}
+
+		GTRACE (5, id_ << " MusicPlayer switching to playlist " << playlistName);
+
+		if (playlistName == currentList_)
+		{
+			GTRACE (5, "MusicPlayer already playing from playlist " << playlistName);
+			return;
+		}
+
+		if (currentList_ == "")
+		{
+			return;
+		}
+
+		if (pauseExisting)
+		{
+			GTRACE (5, "Pausing existing playlist: " << currentList_);
+			playlists_[currentList_]->pause ();
+		}
+		else
+		{
+			GTRACE (5, "Stopping existing playlist: " << currentList_);
+			playlists_[currentList_]->stop ();
+		}
+
+		currentList_ = playlistName;
+		GTRACE (5, "MusicPlayer issuing play to current playlist " << currentList_);
+		play ();
+	}
+
+	void MusicPlayer::OnTrackPlay (const std::string & newTrack)
+	{
+		GTRACE (7, "MusicPlayer notifying listener of a new track being played: " << newTrack);
+
+		if (listenerPtr_)
+		{
+			listenerPtr_->OnTrackPlay (newTrack);
+		}
+	}
+
+	void MusicPlayer::OnTrackChange (const std::string & newTrack)
+	{
+		GTRACE (7, "MusicPlayer notifying listener of a track change occuring: " << newTrack);
+		if (listenerPtr_)
+		{
+			listenerPtr_->OnTrackChange (newTrack);
+		}
+	}
+
+
+	void MusicPlayer::OnPlaylistEnd ()
+	{
+		GTRACE (6, "MusicPlayer notifying listener of a playlist end");
+		if (listenerPtr_)
+		{
+			listenerPtr_->OnPlaylistEnd ();
+		}
+	}
+
+
+	// ------------------------------ SoundManagerUtil -----------------------------------------------
+
+	SoundManagerUtil::SoundManagerUtil (const SoundRepositorySmartPtr & repos)
+		: repository_ (repos)
+		, player_ (MusicPlayerSmartPtr (new MusicPlayer ("s-util")))
+	{
+		GTRACE(6, "SoundManagerUtil ctor");
+		player_->setRepository (repository_);
+		GTRACE(6, "SoundManagerUtil ctor opened device, prepared repository");
+	}
+
+	SoundManagerUtil::~SoundManagerUtil()
+	{
+		GTRACE(6, "SoundManagerUtil dtor");
+		groups_.clear ();
+		GTRACE (6, "SoundManagerUtil cleared custom.");
+	}
+
+
+	void SoundManagerUtil::addSoundGroup (const std::string& groupName)
+	{
+		SoundGroupMapping::iterator iter = groups_.find( groupName );
+		if( iter != groups_.end() )
+		{
+			throw SoundException ("Tried to re-create existent group!");
+		}
+		groups_.insert (std::make_pair (groupName, SoundGroupSmartPtr(new SoundGroup ())));
+	}
+
+	void SoundManagerUtil::addPlaylistTrack (const std::string & playlistName, const std::string & trackName)
+	{
+		GTRACE (4, "Adding anon. track [" << trackName << "] to playlist [" << playlistName << "]");
+		std::string tempName = gussound::hidden::getAnonymousTrackName ();
+		getRepository ()->addSound (tempName, trackName, false, GSC_Music, true);
+		getMusicPlayer ()->addTrackToPlaylist (playlistName, tempName);
+	}
+
+
+
+	SoundGroupSmartPtr & SoundManagerUtil::getSoundGroup (const std::string& groupName)
+	{
+		SoundGroupMapping::iterator iter = groups_.find (groupName);
+		if (iter == groups_.end ())
+		{
+			GTRACE (3, "Current list of groups:");
+			for (SoundGroupMapping::const_iterator it2 = groups_.begin ();
+				it2 != groups_.end (); ++it2)
+			{
+				GTRACE (3, " -> [" << it2->first << "]");
+			}
+
+			throw SoundException ("Tried to access inexistent group!");
+		}
+		return iter->second;
+	}
+
+
+
+	/// Create and return a string containing the version of the sound library
+	std::string SoundManagerUtil::getVersion () const
+	{
+		std::stringstream ss;
+		ss << "gussound-" << GUSSOUND_MAJOR_VERSION << "." << GUSSOUND_MINOR_VERSION << "." << GUSSOUND_PATCH_VERSION;
+		return ss.str ();
+	}
+
+
+	void SoundManagerUtil::removeSoundGroup (const std::string& groupName)
+	{
+		SoundGroupMapping::iterator iter = groups_.find( groupName );
+		if( iter == groups_.end() )
+		{
+			throw SoundException ("Tried to remove inexistent group!");
+		}
+		groups_.erase( iter );
+	}
+
+
+
+	///
+	/// Process some time dependant internal logic.
+	/// React to some time units having passed from the last time the function was called.
+	/// This will generally be used to control the playlists.
+	/// The user of the audio engine will have to call this function on a regular basis
+	/// (i.e. in a loop in the main thread or in a separate thread).
+	///
+	void SoundManagerUtil::elapseTime ()
+	{
+		guslib::TimeUnits duration = timer_.renew ();
+		repository_->elapseTime (duration);
+	}
+
+
+
+	///
+	/// Process some time dependant internal logic.
+	/// React to some time units having passed from the last time the function was called.
+	/// This will generally be used to control the playlists.
+	/// The user of the audio engine will have to call this function on a regular basis
+	/// (i.e. in a loop in the main thread or in a separate thread).
+	/// @param timeUnits The amount of time units (milliseconds) elapsed since the last call.
+	///
+	void SoundManagerUtil::elapseTimeByMilliseconds (const guslib::TimeUnits& timeUnits)
+	{
+		repository_->elapseTime (timeUnits);
+	}
+
+
+
+	///
+	/// Set the log file to be used (part of the tracing library).
+	///
+	void SoundManagerLogger::setLoggerTarget (const std::string& fileName, int level)
+	{
+		GSTARTTRACING (fileName, level);
+	}
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussound.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,921 @@
+#ifndef GUS_SOUND_MAIN_HEADER_H
+#define GUS_SOUND_MAIN_HEADER_H
+
+//   This file is part of the gussound library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Sound utility.
+
+// std::map
+#include <map>
+
+// std::vector
+#include <vector>
+
+// std::stringstream
+#include <sstream>
+
+//
+// Add guslib inclusions... unless we're dealing with the standalone version
+//
+
+#ifdef GUSSOUND_STANDALONE
+
+// A timer
+#include <gussoundutil/timer.h>
+
+// Smart pointer
+#include <gussoundutil/smartptr.h>
+
+// Abstract factory
+#include <gussoundutil/abstractfactory.hpp>
+
+// Implementation of singleton
+#include <gussoundutil/singleton.hpp>
+
+// Another implementation of a singleton.
+#include <gussoundutil/singletonholder.hpp>
+
+#else
+
+// A timer
+#include <guslib/system/timer.h>
+
+// Smart pointer
+#include <guslib/common/smartptr.h>
+
+// Abstract factory
+#include <guslib/common/abstractfactory.hpp>
+
+// Implementation of singleton
+#include <guslib/common/singleton.hpp>
+
+// Another implementation of a singleton.
+#include <guslib/common/singletonholder.hpp>
+
+#endif // GUSSOUND_STANDALONE
+
+#ifndef GUSSNDTLVL // gussound trace level
+#define GUSSNDTLVL 4
+#endif
+
+namespace gussound
+{
+	//
+	// Forward class declarations.
+	//
+	class AbstractSound;
+	class AudioDevice;
+	class EffectableSound;
+	class MusicPlayer;
+	class MusicPlayerListener;
+	class Playlist;
+	class PlaylistListener;
+	class SoundEffect;
+	class SoundEffectListener;
+	class SoundFinishingTrackerInterface;
+	class SoundGroup;
+	class SoundRepository;
+
+	//
+	// Enums
+	//
+
+	typedef enum SoundCategoryEnum
+	{
+		GSC_Effect = 0, // the standard sound category, most sounds should be in this category (menu events, game events)
+		GSC_Music, // the music category, to group up the music related sounds.
+		GSC_Voice, // the voice category, such as mission briefings, character speech, etc.
+		GSC_Master, // this category affects all other categories. It shouldn't be assigned to sounds directly (if it is, it will be squared => you'll get a lower output volume)
+		GSC_Custom1,
+		GSC_Custom2,
+		GSC_Custom3,
+		GSC_None
+	} SoundCategory;
+
+
+	typedef enum PlayStateEnum
+	{
+		GPLS_Stopped=0, // the sound, list or player is stopped.
+		GPLS_Playing, // sound is playing.
+		GPLS_Paused // sound play is paused.
+	}PlayState;
+
+
+	typedef enum ActionIfPlayingEnum
+	{
+		ActionDoNothing,
+		ActionRestart,
+		ActionParallelPlay,
+		ActionEnqueue
+	} ActionIfPlaying;
+
+	//
+	// Typedefs
+	// Redefine some types.
+	//
+
+	typedef GSmartPtr <SoundEffect> SoundEffectPtr;
+	typedef GSmartPtr <AbstractSound> AbstractSoundSmartPtr;
+	typedef GSmartPtr <EffectableSound> EffectableSoundSmartPtr;
+	typedef GSmartPtr <AudioDevice> AudioDeviceSmartPtr;
+	typedef GSmartPtr <SoundRepository> SoundRepositorySmartPtr;
+	typedef GSmartPtr <Playlist> PlaylistSmartPtr;
+	typedef GSmartPtr <MusicPlayer> MusicPlayerSmartPtr;
+	typedef GSmartPtr <SoundGroup> SoundGroupSmartPtr;
+	
+
+	typedef double SoundDuration;
+	typedef int SampleRate;
+	typedef float SoundVolume;
+
+	typedef std::map <std::string, std::string> TagList;
+	typedef std::map <std::string, EffectableSoundSmartPtr> SoundMap;
+	typedef std::map <std::string, PlaylistSmartPtr> PlaylistMapping;
+	typedef std::map <std::string, SoundGroupSmartPtr> SoundGroupMapping;
+	typedef std::vector <SoundEffectPtr> SoundEffectList;
+
+	//
+	// Constants.
+	//
+
+	const SoundVolume max_volume = 1.0;
+	const SoundVolume min_volume = 0.0;
+	const SoundDuration standard_fade_duration = 2000;
+	const std::string EMPTY_SLOT_NAME = "_";
+	const std::string EMPTY_SOUND_FILE = "";
+
+	///
+	/// An exception class.
+	///
+	class SoundException
+		: public std::exception
+	{
+	private:
+		std::string exceptionMessage_;
+
+	public:
+		SoundException (const char* text);
+        virtual ~SoundException() throw();
+        const char* what () const throw();
+	};
+
+	///
+	///	An abstraction of audio devices.
+	///
+	class AudioDevice
+	{
+	public:
+		AudioDevice ();
+		virtual ~AudioDevice ();
+	};
+
+	///
+	///	The abstract interface for a sound.
+	///
+	class AbstractSound
+	{
+	protected:
+		///
+		/// Try to load a sound from a device and a file name.
+		///	@return true if loaded successfully, false otherwise.
+		///	@note This function also sets some internal parameters (such as the sampleRate_).
+		///	It also sets the volume for the sound to the object saved member.
+		///
+		virtual bool loadFrom (const gussound::AudioDeviceSmartPtr & devicePtr, 
+			const std::string &fileName, bool loadInMemory, bool onlyOneInstance) = 0;
+
+	public:
+
+		/// virtual destructor required for smart ptr implementation.
+		virtual ~AbstractSound () {}  
+
+		/// Get the low-level output volume.
+		virtual SoundVolume getOutputVolume () = 0;
+
+		/// Get the duration of time played so far.
+		virtual SoundDuration getSeekDuration () = 0;
+
+		/// Tell whether the sound received the play command with the repeat flag, meaning it will
+		/// play continuously until a stop is issued.
+		virtual bool isRepeating () = 0;
+
+		/// Pause the sound.
+		virtual void pause () = 0;
+
+		/// Commence the low-level sound play. Note that certain actions may be performed if the sound is already
+		/// playing, but not all possible actions are supported at this low level.
+		virtual void play2D (ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false) = 0;
+
+		/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+		/// This is a fire & forget function. You cannot update the source of the sound after it is launched.
+		virtual void play3D (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false);
+
+		/// Commence the low-level sound play with 3D positioning. Will default to 2D play unless overridden.
+		/// This allows you to update the source of the sound after the play command is launched.
+		/// @return An identifier to the token or source of the sound. This can be used later to edit
+		virtual int play3Dnamed (double posX, double posY, double posZ, ActionIfPlayingEnum actionIfPlaying = ActionRestart, bool repeatContinuously = false);
+
+		/// Get the duration of the sound.
+		virtual SoundDuration getDuration() = 0;
+
+		/// Get the sample rate of the sound.
+		virtual SampleRate getSampleRate() = 0;
+
+		/// Get the current play state.
+		virtual const PlayState & getState () const = 0;
+
+		/// Seek to a certain time within the sound.
+		virtual void seekToTime (const SoundDuration & duration) =0;
+
+		/// Set the output volume. Normally, a sound's volume will be influenced by things such as:
+		/// the global sound volume within the application, the sound for the category of this sound (such as music
+		/// voice, interface) as well as a correction factor for the sound. All the influencing factors should be
+		/// combined and the result passed to this function.
+		virtual void setOutputVolume (const SoundVolume & volume) = 0;
+
+		/// Stop the low-level sound.
+		virtual void stop() = 0;
+	};
+
+
+
+	///
+	/// Listener for sound effect events.
+	///
+	class SoundEffectListener
+	{
+	public:
+		/// Callback for when the effect has ended.
+		virtual void onEffectEnded (const SoundEffect & effect) = 0;
+
+		/// Virtual dtor. Required for smart ptr implementation.
+		virtual ~SoundEffectListener () {}
+	};
+
+
+	///
+	/// A sound that supports effects being applied to it.
+	///
+	class EffectableSound
+		: public AbstractSound
+		, public SoundEffectListener
+	{
+	protected:
+		/// Volume value of internally played sound.
+		SoundVolume volume_; // this should be controlled from a higher level.
+		SoundVolume categoryVolume_;
+		SoundVolume effectVolume_;
+
+		SoundEffectList tempEffectList_;
+		SoundEffectList deletionList_;
+
+		SoundFinishingTrackerInterface * tracker_;
+		SoundDuration trackerTime_;
+		SoundCategory category_;
+		// Sound's play state_.
+		PlayState state_;
+
+		std::string id_;
+
+		/// If this is set to true, only one instance of the sound is played. If it's false, each sound play will open a new stream.
+		/// @see SoundEffectType usage from audiere.
+		bool onlyOneInstance_;
+
+		/// Specifies whether the sound is coming from a stream (being played as soon as it comes, without requiring the complete sound data to be available)
+		/// or whether the sound is loaded into memory.
+		bool streamed_;
+
+	public:
+
+		/// Constructor.
+		/// @param id The ID to give to the sound.
+		EffectableSound (const std::string & id = "");
+
+		/// Destructor.
+		virtual ~EffectableSound ();
+
+		/// Getter for the sound ID.
+		virtual const std::string & getId () const {return id_;}
+
+		/// Getter for the sound category.
+		virtual const SoundCategory & getCategory () const {return category_;}
+
+		/// Getter for the play state of the sound.
+		virtual const PlayState & getState () const {return state_;}
+
+		/// Getter for the volume.
+		virtual const SoundVolume & getVolume() const {return volume_;}
+
+		/// Add an effect to the sound. 
+        virtual void addEffect (SoundEffectPtr effect);
+
+		/// Clear all effects from the current sound.
+		virtual void clearAllEffects ();
+
+		/// Time elapsing function. Make the sound react to time passing by. Will also apply assigned sound effects.
+		/// @param time The amount of time that elapsed.
+		virtual void elapseTime (const guslib::TimeUnits & time);
+
+		/// Getter for the combined value of a sound volume.
+		virtual SoundVolume getCombinedVolumeModifiers ();
+
+		/// Callback for a finished sound effect.
+		virtual void onEffectEnded (const SoundEffect & effect);
+
+		/// Setter for the sound category.
+		virtual void setCategory (const SoundCategory & cat) {category_ = cat;}
+
+		/// Setter for the volume modifier of the sound category.
+		virtual void setVolumeCategoryModifier (const SoundVolume & volume);
+
+		/// Setter for the extra modifier for a sound. This is called internally by sound effects.
+		virtual void setVolumeExtraModifier (const SoundVolume & volume);
+
+		/// Set the main volume value. Note: the overall sound output value is also influenced by the category modifier and effect (extra) modifier.
+		virtual void setVolume (const SoundVolume & volume);
+
+		/// Set the listener (tracker) of the sound finishing effect to use.
+		virtual void setTracker (SoundFinishingTrackerInterface* ptr, SoundDuration dur );
+
+		/// Remove the listener (tracker)
+		virtual void clearTracker ();
+
+		friend class SoundRepository;
+	};
+
+	///
+	/// Obtain the event of a sound play ending.
+	///
+	class SoundFinishingTrackerInterface
+	{
+	public:
+		virtual void onSoundEvent () = 0;
+
+		virtual ~SoundFinishingTrackerInterface () {} // virtual destructor required for smart ptr implementation.
+	};
+
+
+	///
+	/// Listener for events from the music player.
+	///
+	class MusicPlayerListener
+	{
+	public:
+		virtual void OnTrackPlay (const std::string & newTrack) = 0;
+		virtual void OnTrackChange (const std::string & newTrack) = 0;
+		virtual void OnPlaylistEnd () = 0; // will be encountered in non-repeat mode only.
+
+		virtual ~MusicPlayerListener (){} // virtual destructor required for smart ptr implementation.
+	};
+
+	///
+	/// Listener for events regarding the playlist.
+	///
+	class PlaylistListener
+	{
+	public:
+		virtual void OnTrackPlay (const std::string & newTrack) = 0;
+		virtual void OnTrackChange (const std::string & newTrack ) = 0;
+		virtual void OnPlaylistEnd () = 0;
+
+		virtual ~PlaylistListener () {} // virtual destructor required for smart ptr implementation.
+	};
+
+
+	///
+	/// A general interface for a media player.
+	///
+	class MusicPlayerInterface
+	{
+	public:
+		virtual void play () = 0; // just like clicking the play button in a media player application.
+
+		virtual void stop () = 0; // just like clicking the stop button in a media player application.
+
+		virtual void nextTrack () = 0; // next track in list.
+
+		virtual void previousTrack () = 0; // previous track in list.
+
+		virtual void pause () = 0; // the resuming can be done by either calling pause again or play.
+
+		virtual void setListener (MusicPlayerListener * listener) = 0;
+
+		virtual void switchToPlaylist (const std::string & playlistName, bool pauseExisting = true) = 0;
+
+		virtual ~MusicPlayerInterface () {} // virtual destructor required for smart ptr implementation.
+	};
+
+
+
+	///
+	///	Base class for sound effects (for advanced sounds).
+	///
+	class SoundEffect
+	{
+	protected:
+		guslib::TimeUnits internalTimer_;
+		guslib::TimeUnits startFrom_;
+		guslib::TimeUnits stopAt_;
+		guslib::TimeUnits targetLength_;
+		EffectableSoundSmartPtr ptrToSound_;
+		bool ended_;
+	public:
+		SoundEffect (EffectableSoundSmartPtr & target, guslib::TimeUnits startFrom, guslib::TimeUnits stopAt);
+
+		virtual ~SoundEffect ();
+
+		virtual void applyEffect ();
+		virtual void elapseTime (const guslib::TimeUnits & time);
+		/// Define action to be taken when the effect ends (for instance, a fade-out would stop the sound at the end.
+		virtual void endEffect (bool force = false); 
+		virtual bool equals (const SoundEffect & rhs);
+		virtual void reset ();
+		virtual void stop ();
+	};
+
+	
+
+	///
+	/// A simple, linear, fade-in effect
+	///
+	class FadeInEffect
+		: public SoundEffect
+	{
+	protected:
+		SoundVolume minVolume_;
+	public:
+		FadeInEffect (EffectableSoundSmartPtr & target
+			, const guslib::TimeUnits & duration
+			, const SoundVolume & minVolume = gussound::min_volume);
+
+		FadeInEffect (EffectableSoundSmartPtr & target
+			, const guslib::TimeUnits & fromTime
+			, const guslib::TimeUnits & duration
+			, const SoundVolume & minVolume);
+
+		virtual ~FadeInEffect ();
+		virtual void applyEffect ();
+
+		/// Define action to be taken when the effect ends (for instance, a fade-in would make sure that the sound level is appropriate at the end.
+		/// @param force Ignored
+		virtual void endEffect (bool force = false);
+	};
+
+
+	///
+	/// A simple, linear, fade out effect.
+	///
+	class FadeOutEffect
+		: public SoundEffect
+	{
+	protected:
+		SoundVolume minVolume_;
+		bool stopOnEnd_; // true if the sound stops afterwards, false if the sound is paused.
+	public:
+		FadeOutEffect (EffectableSoundSmartPtr & target
+			, const guslib::TimeUnits & duration
+			, const SoundVolume & minVolume = gussound::min_volume
+			, bool stopAtEnd = true);
+
+		FadeOutEffect (EffectableSoundSmartPtr & target
+			, const guslib::TimeUnits & startFrom
+			, const guslib::TimeUnits & stopAt
+			, const SoundVolume & minVolume
+			, bool stopAtEnd = true);
+
+		virtual ~FadeOutEffect ();
+
+		virtual void applyEffect ();
+
+		/// Define action to be taken when the effect ends (for instance, a fade-out would stop the sound at the end.
+		/// @param force If the force flag is set to true, the stop commands for the sound are suppressed.
+		/// This is performed in order to prevent fade-in and fade-out effects running for the same sound and performing
+		/// an unplanned stop operation when the fade-out is finished.
+		virtual void endEffect (bool force = false);
+	};
+
+
+	///
+	///	Define a group of sounds. This is a utility class meant to help the user add randomness in the usage
+	///	of sounds. For instance, you may want to use one of several sounds for highly repetitive actions. Imagine
+	///	selecting a unit in an RTS/RPG game and ordering it to move. You would issue normally several move orders.
+	///	It would be much more boring to just hear "yes" on each move command that hearing a combination of "yes", "okay",
+	///	"roger", "on my way".
+	///	In addition you may desire to not play all of them in the same ratio. Some sounds could be uses rarely to
+	///	enhance the replay-ability. Imagine having a snake game and playing some sounds after picking a bonus.
+	///	You may play a sound like "yummy" after each bonus pick-up, but use "delicious" every once in a while, something
+	///	like 5% of the times, or maybe you want to play no sound most of the time and play a sound to remove the
+	///	monotony every now and then.
+	///
+	class SoundGroup
+	{
+	protected:
+		SoundGroup ();
+
+		// the map will contain the correlation between a sound's name and the weight it has.
+		std::map<std::string, int> sounds_;
+
+		// the sum of all weights; kept in memory to prevent unnecessary re-calculations.
+		int currentWeightSum_;
+
+	public:
+		virtual ~SoundGroup ();
+
+		// add a non-sound (the option to play no sound).
+		virtual void addEmptySlot (int weight);
+
+		// add a sound. The odds of that sound actually playing are given by the weight parameter.
+		virtual void addSound (const std::string & soundName, int weight);
+
+		// remove the empty slot (the option to play no sound).
+		virtual void removeEmptySlot ();
+
+		// remove a sound from the group.
+		virtual void removeSound (const std::string & soundName);
+
+		// obtain the name of a random sound.
+		virtual std::string getRandomSound () const;
+
+		friend class SoundManagerUtil;
+	};
+
+
+	///	
+	///	For a music player one can define a playlist.
+	///	This will ensure that music is more varied. For instance, let's say you have a strategy game. At
+	///	each point, you may choose to be on some terrain, having a different playlist for each terrain
+	///	type. The playlist management should be made much easier using this class.
+	///	
+	class Playlist
+		: public SoundFinishingTrackerInterface
+	{
+	protected:
+		std::string currentTrack_;
+		int currentTrackIdx_;
+
+		bool autoSkipToNextTrack_;
+		std::vector<std::string> tracks_;
+
+		// Keep track of the number of times each track was played. This is especially
+		// important for shuffle and repeat functionality.
+		std::vector<int> playCount_;
+
+		// The tracks in the order they were played in.
+		std::vector<int> playOrder_;
+
+		// specify whether to use a fade-in effect for all play commands.
+		bool fadeInAtPlay_;
+
+		// specify whether to use a fade-in effect for all stop commands.
+		bool fadeOutAtStop_;
+
+		// specify whether to use a fade-in effect for all pause commands.
+		bool fadeOutAtPause_;
+
+		// specify whether to use the repeat.
+		bool repeat_;
+
+		// specify whether to use shuffle or not.
+		bool shuffle_;
+
+		PlayState state_;
+
+		SoundRepositorySmartPtr ptrToRepository_;
+		PlaylistListener * ptrToListener_;
+
+		std::string id_;
+
+		SoundDuration fadeDuration_;
+
+	public:
+		Playlist ();
+
+		Playlist (const SoundRepositorySmartPtr & repository_
+			, PlaylistListener * listener
+			, const std::string & id = "noname");
+
+		Playlist (const Playlist & rhs);
+
+		virtual ~Playlist ();
+
+		virtual void addTrack (const std::string & trackName);
+
+		virtual SoundDuration getFadeDuration () const { return fadeDuration_; }
+
+		virtual void pause ();
+
+		virtual void play ();
+
+		virtual void removeTrack (const std::string & trackName);
+
+		virtual void setFade (bool atPlay = true, bool atStop = true, bool atPause = true);
+
+		virtual void setFadeDuration (SoundDuration dur) { fadeDuration_ = dur; }
+
+		virtual void setRepeat (bool value);
+
+		virtual void setShuffle (bool value);
+
+		virtual void setRepository (const SoundRepositorySmartPtr & repository) {ptrToRepository_ = repository;}
+
+		/// Move the iterator to the next item in the list. The play state is maintained.
+		virtual void skipToNextTrack (); 
+
+		virtual void skipToPreviousTrack (); 
+
+		virtual void stop ();
+
+		virtual void stop (bool fadeOut);
+
+		virtual void setListener (PlaylistListener * listener) {ptrToListener_ = listener;}
+
+		// override
+		virtual void onSoundEvent ();
+	};
+
+
+	///	
+	///	This is the class that will handle the loading and unloading of sounds. The sounds ca be loaded either into
+	///	memory, or be streamed directly from the disk, but for any use, they need to be added into the repository 
+	///	before being used.
+	///	
+	class SoundRepository
+	{
+	protected:
+		SoundMap sounds_;
+
+		std::vector<SoundVolume> categoryVolumes_;
+
+		gussound::AudioDeviceSmartPtr audioDevice_;
+
+		SoundRepository ();
+
+		void setAudioDevice (const gussound::AudioDeviceSmartPtr & device) {audioDevice_ = device;}
+
+	public:
+		virtual ~SoundRepository ();
+
+		virtual void addSound (const std::string &soundName, const std::string & fileName, bool loadIntoMemory = false, SoundCategory cat = GSC_None, bool onlyOneInstance = false);
+
+		virtual EffectableSound * createSound (const std::string& id = "", const std::string& fileExtension = "") = 0;
+
+		virtual EffectableSoundSmartPtr & getSound (const std::string &soundName);
+
+		virtual void elapseTime (const guslib::TimeUnits & time);
+
+		virtual SoundVolume getVolumeForCategory (SoundCategory categ) const;
+
+		virtual void removeSound (const std::string &soundName);
+
+		virtual void setVolumeForCategory (SoundCategory categ, SoundVolume vol);
+
+		friend class SoundManagerUtil;
+	};
+
+
+
+	///	
+	///	An implementation of a media player.
+	///	This will be a utility class for handling the music for games. It should allow a more convenient
+	///	playlist management, allowing the user to switch from one playlist to another, to reflect game changes
+	///	(such as switching from a calm themed playlist to an action playlist when a player enters a dangerous
+	///	zone in an RPG ).
+	///	
+	class MusicPlayer
+		: public MusicPlayerInterface
+		, public PlaylistListener
+	{
+	protected:
+		PlaylistMapping playlists_;
+
+		PlayState playstate_;
+
+		MusicPlayerListener * listenerPtr_;
+
+		bool shuffle_;
+
+		bool repeat_;
+
+		float volume_; // all items in the playlist will be affected by this value
+
+		// allows the tracks to be changed automatically. Otherwise, when the track ends, you need to
+		// switch manually to the next song.
+		bool skipToNextTrackAutomatically_;
+
+		// use a vector to tell which tracks were played so far, in order to skip them from double play.
+		std::vector<bool> shuffleTracker_;
+
+		// specify whether to use a fade-in effect for all play commands.
+		bool fadeInAtPlay_;
+
+		// specify whether to use a fade-in effect for all stop commands.
+		bool fadeOutAtStop_;
+
+		// specify whether to use a fade-in effect for all pause commands.
+		bool fadeOutAtPause_;
+
+		// the list that is currently being played.
+		std::string currentList_;
+
+		// self explanatory: if true, when the lists are changed, the play keeps active.
+		bool keepPlayingAtListChange;
+
+		SoundRepositorySmartPtr ptrToRepository_;
+
+		std::string id_;
+		SoundDuration fadeDuration_;
+
+	protected:
+		MusicPlayer (const std::string & id = "noname");
+
+	public:
+		virtual ~MusicPlayer ();
+
+		virtual bool isPlaylistRegistered (const std::string& name);
+		virtual void registerPlaylist (const std::string & name);
+		virtual void unregisterPlaylist (const std::string & name);
+
+		virtual void addTrackToPlaylist (const std::string & playlistName, const std::string & trackName);
+		virtual void removeTrackFromPlaylist (const std::string & playlistName, const std::string & trackName);
+
+		virtual void nextTrack (); // If the last track was just played, will call the listener's OnPlaylistEnd function.
+
+		virtual void stop ();
+
+		virtual void play ();
+
+		virtual void pause ();
+
+		virtual void previousTrack ();
+
+		virtual SoundDuration getFadeDuration () const { return fadeDuration_; }
+		virtual bool getRepeat () const { return repeat_;}
+		virtual bool getShuffle () const { return shuffle_;}
+
+		virtual void setRepository (const SoundRepositorySmartPtr & repository) {ptrToRepository_ = repository;}
+
+		virtual void setFadePreferrences (bool atPlay = true, bool atStop = true, bool atPause = true);
+		virtual void setFadeDuration (SoundDuration dur);
+		virtual void setRepeat (bool value);
+		virtual void setShuffle (bool value);
+
+		virtual void setPlaylistRepeat (const std::string& playlistName, bool value);
+		virtual void setPlaylistShuffle (const std::string& playlistName, bool value);
+
+		virtual void switchToPlaylist (const std::string & playlistName, bool pauseExisting = true);
+
+		// overrides from the playlist listener
+
+		virtual void OnTrackPlay(const std::string & newTrack);
+		virtual void OnTrackChange(const std::string & newTrack );
+		virtual void OnPlaylistEnd();
+
+		virtual void setListener (MusicPlayerListener * listener );
+		friend class SoundManagerUtil;
+	};
+
+
+	///	
+	///	This will be the main interface to the application.
+	///	It is supposed to be a singleton class, allowing the user's access to the entire audio suite.
+	///	
+	class SoundManagerUtil
+	{
+	protected:
+		SoundManagerUtil (const SoundRepositorySmartPtr & repos);
+
+		SoundRepositorySmartPtr repository_;
+
+		SoundGroupMapping groups_;
+
+		MusicPlayerSmartPtr player_;
+
+		guslib::Timer timer_; // internal timer.
+
+	public:
+		/// Destructor
+		virtual ~SoundManagerUtil ();
+
+		/// Access this instead of the constructor directly.
+		static SoundManagerUtil* createSoundManager ();
+
+		/// Create and add a sound group.
+		virtual void addSoundGroup (const std::string & groupName);
+
+		/// Add a track to a playlist: utility call that bypasses the repository access and music player access.
+		/// Please note that the track name will be anonymous.
+		virtual void addPlaylistTrack (const std::string & playlistName, const std::string & trackName);
+
+		/// Process some time dependant internal logic.
+		/// React to some time units having passed from the last time the function was called.
+		/// This will generally be used to control the playlists.
+		/// The user of the audio engine will have to call this function on a regular basis
+		/// (i.e. in a loop in the main thread or in a separate thread).
+		virtual void elapseTime ();
+
+		/// Process some time dependant internal logic.
+		/// React to some time units having passed from the last time the function was called.
+		/// This will generally be used to control the playlists.
+		/// The user of the audio engine will have to call this function on a regular basis
+		/// (i.e. in a loop in the main thread or in a separate thread).
+		/// @param timeUnits The amount of time units (milliseconds) elapsed since the last call.
+		virtual void elapseTimeByMilliseconds (const guslib::TimeUnits& timeUnits);
+
+		/// Access the music player.
+		virtual MusicPlayerSmartPtr & getMusicPlayer () { return player_; }
+
+		/// Access the sound repository.
+		virtual SoundRepositorySmartPtr & getRepository () { return repository_; }
+
+		/// Get a sound group (groups sounds with a common category).
+		virtual SoundGroupSmartPtr & getSoundGroup (const std::string & groupName);
+		
+		/// Create and return a string containing the version of the sound library
+		virtual std::string getVersion () const;
+
+		/// Destroy a sound group.
+		virtual void removeSoundGroup (const std::string & groupName);
+	};
+
+
+	///	
+	///	A so-called hidden namespace to create anonymous track names.
+	/// If the user does not provide a track name, just use an automatically generated name.
+	///	
+	namespace hidden
+	{
+		static int trackerCounter_ = 0;
+		static std::string getAnonymousTrackName ()
+		{
+			std::stringstream ss;
+			ss<<"track_"<<trackerCounter_;
+			++trackerCounter_;
+			return ss.str();
+		}
+	};
+
+
+	// use this to create the sound manager util
+	typedef guslib::Singleton <
+		guslib::GeneralFactory <SoundManagerUtil, std::string, SoundManagerUtil* (*) ()>
+	> SoundManagerFactory;
+
+
+	// define an abstract singleton holder, SoundManager
+
+	typedef guslib::SingletonHolder <SoundManagerUtil> SoundManager;
+
+	///
+	/// A class to help out with preparing logging
+	///
+	class SoundManagerLogger
+	{
+	public:
+		/// Set the log file to be used (part of the tracing library).
+		static void setLoggerTarget (const std::string& fileName, int level = 5);
+	};
+
+
+} // namespace gussound
+
+//
+// Macros for play control commands.
+//
+#define GSOUND_ADD_PLAYLIST(param) SoundManager::getPtr ()->getMusicPlayer ()->registerPlaylist(param)
+#define GSOUND_ADD_SOUND(paramName,paramFile,paramCategory,paramLoad) SoundManager::getPtr ()->getRepository ()->addSound (paramName, paramFile, paramLoad, paramCategory)
+#define GSOUND_ADD_TRACK_TO_PLAYLIST(paramList,paramTrack) {std::string tempName = gussound::hidden::getAnonymousTrackName ();\
+SoundManager::getPtr ()->getRepository()->addSound(tempName, paramTrack, false, GSC_Music);\
+SoundManager::getPtr ()->getMusicPlayer()->addTrackToPlaylist(paramList, tempName);}
+#define GSOUND_ELAPSE_TIME() SoundManager::getPtr ()->elapseTime ()
+#define GSOUND_PLAY2D(param) SoundManager::getPtr ()->getRepository ()->getSound (param)->play2D ()
+#define GSOUND_SET_MUSIC_REPEAT(param) SoundManager::getPtr ()->getMusicPlayer ()->setRepeat (param)
+#define GSOUND_SET_MUSIC_SHUFFLE(param) SoundManager::getPtr ()->getMusicPlayer ()->setShuffle (param)
+#define GSOUND_SET_VOLUME_FOR_CATEGORY(paramCateg,paramVol) SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (paramCateg,paramVol)
+#define GSOUND_START_MUSIC() SoundManager::getPtr ()->getMusicPlayer ()->play ()
+#define GSOUND_PAUSE_MUSIC() SoundManager::getPtr ()->getMusicPlayer ()->pause ()
+#define GSOUND_SWITCH_TO_PLAYLIST(param) SoundManager::getPtr ()->getMusicPlayer ()->switchToPlaylist (param)
+
+
+
+#endif // GUS_SOUND_MAIN_HEADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/abstractfactory.hpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,91 @@
+#ifndef GUS_LIB_GENERAL_FACTORY_H
+#define GUS_LIB_GENERAL_FACTORY_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//	 Last change:	$LastChangedDate: 2011-09-04 19:06:22 +0300 (D, 04 sep. 2011) $
+//	 Revision:		$Revision: 225 $
+
+#include <map>
+
+//#include <guslib/guslibBuildOpts.h> // TODO: remove
+
+/**
+	@file
+	Template factory; modelled after the Loki library.
+*/
+namespace guslib
+{
+	/**
+		A standard template factory; modelled after the Loki library.
+	*/
+	template
+		<class AbstractClass,
+		typename IdentifierType,
+		typename ProductCreator = AbstractClass* (*)()>
+class GeneralFactory
+	{
+	public:
+		typedef std::map <IdentifierType, ProductCreator> AssociativeMap;
+
+        GeneralFactory ()
+		{
+		}
+
+		virtual ~GeneralFactory()
+		{
+			associations_.clear ();
+		}
+
+		virtual AbstractClass * CreateObject (const IdentifierType & id)
+		{
+			typename AssociativeMap::iterator i = associations_.find(id);
+			if (i != associations_.end())
+			{
+				return (i->second) ();
+			}
+			return NULL;
+		}
+
+		virtual bool Register (const IdentifierType& id, ProductCreator creator)
+		{
+			return associations_.insert(
+				typename AssociativeMap::value_type(id, creator)).second != 0;
+		}
+
+		virtual bool Unregister (const IdentifierType& id)
+		{
+			return associations_.erase(id) != 0;
+		}
+  
+	protected:
+#pragma warning (push)
+#pragma warning (disable:4251)
+		AssociativeMap associations_;
+#pragma warning (pop)
+	};
+
+}
+
+#endif // GUS_LIB_GENERAL_FACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/guslib_version.hpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,51 @@
+#ifndef GUSLIB_VERSION_HPP
+#define GUSLIB_VERSION_HPP
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2013  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Version information file. (Using boost style version information).
+//
+//   This header will change between different releases of guslib. Including the header will result in a recompile
+//   when a new guslib version is released.
+//
+//	 Last change:	$LastChangedDate: 2013-05-07 17:51:01 +0300 (Ma, 07 mai. 2013) $
+//	 Revision:		$Revision: 554 $
+
+
+//   GUSLIB_NUM_VERSION % 100 is the patch level
+//   GUSLIB_NUM_VERSION / 100 % 1000 is the minor version
+//   GUSLIB_NUM_VERSION / 100000 is the major version
+
+#define GUSLIB_NUM_VERSION 100100
+//                         ____XX = patch
+//                         _XXX__ = minor version
+//                         X_____ = major version
+
+//   GUSLIB_STRING_VERSION should be defined by the user to be the same as GUSLIB_NUM_VERSION, but as a string
+//   in the form "x_y[_z]" where x is the major version number, y is the minor version number, 
+//   and z (optional) is the patch level; (if the patch level is 0, you should skip it).
+
+#define GUSLIB_STRING_VERSION "1_01"
+
+#endif // GUSLIB_VERSION_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/guslibbuildopts.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,78 @@
+#ifndef GUS_LIB_BUILDOPTS_H
+#define GUS_LIB_BUILDOPTS_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Build options.
+//
+//	 Last change:	$LastChangedDate: 2013-05-07 17:47:45 +0300 (Ma, 07 mai. 2013) $
+//	 Revision:		$Revision: 553 $
+
+// Version info
+#include <gussoundutil/guslib_version.hpp>
+
+#ifdef GUSLIB_EXP
+#define GUSLIB_EXPORT_SYMBOL __declspec (dllexport)
+#define GUSLIB_EXPIMP_TEMPLATE
+#else
+#ifdef GUSLIB_IMP
+#define GUSLIB_EXPORT_SYMBOL __declspec (dllimport)
+#define GUSLIB_EXPIMP_TEMPLATE extern
+#else
+#define GUSLIB_EXPORT_SYMBOL 
+#define GUSLIB_EXPIMP_TEMPLATE 
+#endif
+#endif // GUSLIB_EXP
+
+
+#ifndef _WINDOWS
+#ifdef WIN32
+#define _WINDOWS
+#endif // WIN32
+#endif // _WINDOWS
+
+
+// control the multithread support.
+
+// #ifndef GUSLIB_FLAG_MULTITHREAD
+// #define GUSLIB_FLAG_MULTITHREAD 1
+// #endif
+
+// Some options you may set for the project:
+// GUSLIB_FLAG_SINGLETONINST: specify whether the singleton can declare and set to NULL the instances of the defined classes.
+
+#ifndef GUSLIB_FLAG_SINGLETONINST
+#define GUSLIB_FLAG_SINGLETONINST 1
+#endif
+
+// Other flags:
+//
+// GUSLIB_USE_YASPER_SMART_POINTER
+
+#ifndef GUSLIB_USE_YASPER_SMART_POINTER
+#define GUSLIB_USE_YASPER_SMART_POINTER 1
+#endif
+
+
+#endif // GUS_LIB_BUILDOPTS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/random.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,236 @@
+#ifndef GUS_LIB_RANDOM_H
+#define GUS_LIB_RANDOM_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Random number generating utility.
+//
+//	 Last change:	$LastChangedDate: 2012-09-16 11:26:05 +0300 (D, 16 sep. 2012) $
+//	 Revision:		$Revision: 541 $
+
+#include <gussoundutil/guslibbuildopts.h>
+
+#if GUSLIB_USE_BOOST_RANDOM
+// Boost includes for random number generating functions.
+#include <boost/random.hpp>
+#include <boost/random/lagged_fibonacci.hpp>
+#else
+#include <stdlib.h>
+#endif //GUSLIB_USE_BOOST_RANDOM
+
+#include <gussoundutil/singleton.hpp>
+
+
+namespace guslib
+{
+	#define GMINRANDOM 0
+	#define GMAXRANDOM 10000
+
+	/// Common interface for random numbers.
+	class AbstractRandomInterface
+	{
+	public:
+		/// Get a value between 0 and maxValue
+		virtual long getValueUpTo (long maxValue) = 0;
+
+		/// Get a value between value1 and value2. If the two values are equal, the common value is returned.
+		/// It does not matter if value1 is larger than value2, or vice-versa.
+		virtual long getValueBetween (long value1, long value2) = 0;
+	};
+
+#if GUSLIB_USE_BOOST_RANDOM
+
+	// Defines for the boost generators and distributors.
+	#define GGENERATORTYPE boost::mt19937
+	#define GDISTRIBUTORTYPE boost::uniform_int<>
+	#define GADVGENERATORTYPE boost::variate_generator<GGENERATORTYPE&,GDISTRIBUTORTYPE>
+
+	///	Simple class for random values.
+	/// It uses the boost random libs internally, with a simple number generator and an integer number distribution.
+	class GBoostRandom : public AbstractRandomInterface
+	{
+	protected:
+		// boost random stuff
+		GGENERATORTYPE *generator;
+		GDISTRIBUTORTYPE *distributor;
+		GADVGENERATORTYPE *vGenerator;
+
+		/// Initialization.
+		virtual void initialize();
+	public:
+
+		/// constructor.
+		GBoostRandom();
+		virtual ~GBoostRandom();
+
+		virtual long getValueUpTo( long maxValue );
+		virtual long getValueBetween( long value1, long value2 );
+	};
+#endif
+
+	/// If boost is not available have a fallback random generator.
+	/// Please note that this isn't really random and the results are quite non-random.
+	class BasicRandom : public AbstractRandomInterface
+	{
+	protected:
+
+		/// Initialization.
+		virtual void initialize();
+
+	public:
+
+		/// constructor.
+		BasicRandom();
+
+		virtual long getValueUpTo( long maxValue );
+		virtual long getValueBetween( long value1, long value2 );
+	};
+
+#if GUSLIB_USE_BOOST_RANDOM
+	typedef GBoostRandom RandomUtil;
+#else
+	typedef BasicRandom RandomUtil;
+#endif
+	typedef guslib::Singleton <guslib::RandomUtil> Random;
+}
+
+//
+// Note: the content of the CPP file is also dumped in the header for the compact version.
+//
+
+#include <ctime> //time
+
+#if GUSLIB_USE_BOOST_RANDOM != 1
+#pragma message("Info: Boost random disabled! Define GUSLIB_USE_BOOST_RANDOM as 1 to enable it (requires boost).")
+#endif
+
+using namespace std;
+
+namespace guslib
+{
+	// Different implementation according to the used base type.
+
+#if GUSLIB_USE_BOOST_RANDOM
+
+	GBoostRandom::GBoostRandom()
+	{
+		initialize();
+	}
+
+
+	GBoostRandom::~GBoostRandom()
+	{
+		//	nothing to delete;
+	}
+
+
+	void GBoostRandom::initialize()
+	{
+		// Create a number generator. This one has a 2^19937-1 cycle length, and a decent speed.
+		generator = new GGENERATORTYPE();
+
+		// Create the distribution.
+		distributor = new GDISTRIBUTORTYPE( GMINRANDOM, GMAXRANDOM );
+
+		vGenerator = new GADVGENERATORTYPE( *generator, *distributor );
+
+		// std::time(0) may not be the best seed, but it is enough for the needs the kind of which this class is intended.
+		generator->seed(static_cast<unsigned int>(std::time(0)));
+	}
+
+
+	long GBoostRandom::getValueUpTo( long maxValue )
+	{
+		if( maxValue == 0 )
+			return 0;
+		return vGenerator->operator()() % maxValue;
+	}
+
+	long GBoostRandom::getValueBetween( long value1, long value2 )
+	{
+		if( value1 == value2 ) 
+			return value1;
+		long min, max;
+		if( value1 > value2 )
+		{
+			min = value2;
+			max = value1;
+		}
+		else
+		{
+			min = value1;
+			max = value2;
+		}
+		long interval = max-min+1;
+		return getValueUpTo(interval) + min;
+	}
+
+#else //GUSLIB_USE_BOOST_RANDOM
+
+	long BasicRandom::getValueUpTo( long maxValue )
+	{
+		if( maxValue <= 0 ) return 0;
+		return rand() % maxValue;
+	}
+
+	long BasicRandom::getValueBetween( long value1, long value2 )
+	{
+		if( value1 == value2 ) 
+			return value1;
+		long min, max;
+		if( value1 > value2 )
+		{
+			min = value2;
+			max = value1;
+		}
+		else
+		{
+			min = value1;
+			max = value2;
+		}
+		long interval = max-min + 1;
+		return getValueUpTo(interval) + min;
+	}
+
+
+	BasicRandom::BasicRandom()
+	{
+		initialize();
+	}
+
+	void BasicRandom::initialize()
+	{
+		Timer timer;
+		unsigned seed = (unsigned)timer.getCurrentTimeUnits();
+		srand( seed );
+	}
+#endif //GUSLIB_USE_BOOST_RANDOM
+
+#if GUSLIB_FLAG_SINGLETONINST == 0
+	// If the singleton is not set to create instances.
+	guslib::RandomUtil * guslib::Singleton <guslib::RandomUtil>::objectPtr_ = NULL;
+#endif
+
+}
+#endif // GUS_LIB_RANDOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/singleton.hpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,129 @@
+#ifndef GUS_LIB_SINGLETON_H
+#define GUS_LIB_SINGLETON_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//	 Last change:	$LastChangedDate: 2013-05-07 17:47:45 +0300 (Ma, 07 mai. 2013) $
+//	 Revision:		$Revision: 553 $
+
+
+#include <gussoundutil/guslibbuildopts.h>
+#include <stdlib.h>
+
+// Note: for multithreaded synchronization and safe singleton access, be sure to enable the GUSLIB_FLAG_MULTITHREAD flag.
+// This will require boost.
+
+#if GUSLIB_FLAG_MULTITHREAD
+#include <gussoundutil/thread.h>
+#endif
+
+
+namespace guslib
+{
+  // Utility class to encapsulate a singleton.
+  // Limitation: This can only handle singletons with public, default constructors.
+  // Note: a double checked locking is attempted at the object's creation, if multithreaded synchronization is enabled
+  // (it will depend on 3rd party libraries for thread utilities, such as boost or Poco). To enable the multithreaded 
+  // synchronization, you MUST define GUSLIB_FLAG_MULTITHREAD to 1.
+  // The creation behaviour is similar to the Pheonix Creation policy:
+  // singletons that were deleted can be brought back to life if they are called again.
+  // Note on storing these classes in a DLL:
+  // In order to have an actual singleton, with a single instance, you must export the symbol to the DLL.
+  // Make sure you do this by defining the flag "GUSLIB_EXP" in the DLL. The calling code must use the 
+  // 'GUSLIB_IMP' preprocessor flag.
+  template <class T> class Singleton
+  {
+  private:
+		static T * objectPtr_;
+
+  protected:
+#if GUSLIB_FLAG_MULTITHREAD
+	  static guslib::GMutex creationMutex_;
+#endif
+
+  public:
+    // Get a pointer to the singleton instance.
+    static T * getPtr ()
+    {
+      // first check if it was created. If the mutex would be placed first, a performance hit would occur, since
+      // all operations would create and release a lock.
+      if (! objectPtr_)
+      {
+        // try to lock
+#if GUSLIB_FLAG_MULTITHREAD
+        guslib::GScopedLock myLock (creationMutex_);
+#endif
+
+        // While the lock tried to take control, another thread may have already finished instantiating the object,
+        // so a new check should be done to ensure safety (double-checked locking pattern).
+        if (! objectPtr_)
+        {
+          // Should create the object as volatile to prevent some compiler optimizations that may lead to the lines being
+          // executed internally in a slightly different order than the one given here.
+          // (see also: http://aszt.inf.elte.hu/~gsd/klagenfurt/material/ch03s05.html)
+          volatile T * volatileptr = new T ();
+          objectPtr_ = (T*) volatileptr;
+		  // If possible, use the std::atexit
+#ifndef ATEXIT_FIXED
+          atexit (& destroy);
+#endif// ATEXIT_FIXED
+        }
+      }
+      return objectPtr_;
+    }//getptr
+
+    // Get the singleton instance.
+    static T& get ()
+    {
+      return *getPtr ();
+    }//get
+
+    // Destroy the singleton instance. Again, try a double checked lock.
+    static void destroy ()
+    {
+      if (objectPtr_)
+      {
+#if GUSLIB_FLAG_MULTITHREAD
+        guslib::GScopedLock myLock (creationMutex_);
+#endif
+        if (objectPtr_)
+        {
+          delete objectPtr_;
+          objectPtr_ = 0; // NULL
+        }
+      }
+    }//destroy
+  };
+
+#if GUSLIB_FLAG_SINGLETONINST != 0
+  template <class T> T* Singleton<T>::objectPtr_ = 0; // NULL
+#endif
+
+#if GUSLIB_FLAG_MULTITHREAD
+  template <class T> GMutex Singleton<T>::creationMutex_;
+#endif
+
+} // namespace end
+
+#endif //GUS_LIB_SINGLETON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/singletonholder.hpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,117 @@
+#ifndef GUS_LIB_SINGLETONHOLDER_H
+#define GUS_LIB_SINGLETONHOLDER_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//	 Last change:	$LastChangedDate: 2012-09-16 11:26:05 +0300 (D, 16 sep. 2012) $
+//	 Revision:		$Revision: 541 $
+
+
+//#include <guslib/guslibBuildOpts.h> // TODO: remove
+
+// Note: for multithreaded synchronization and safe singleton access, be sure to enable the GUSLIB_FLAG_MULTITHREAD flag.
+// This will require boost.
+
+#if GUSLIB_FLAG_MULTITHREAD
+#include <gussoundutil/thread.h>
+#endif
+
+#include <stdexcept>
+
+namespace guslib
+{
+  // Utility class to encapsulate a singleton.
+  // This doesn not create the singleton, but holds onto it and CAN destroy it.
+  // Limitation: This can only handle singletons with public, default constructors.
+  // Note: a double checked locking is attempted at the object's destruction, if multithreaded synchronization is enabled
+  // (it will depend on 3rd party libraries for thread utilities, such as boost or Poco). To enable the multithreaded 
+  // synchronization, you MUST define GUSLIB_FLAG_MULTITHREAD to 1.
+  // Note on storing these classes in a DLL:
+  // In order to have an actual singleton, with a single instance, you must export the symbol to the DLL.
+  // Make sure you do this by defining the flag "GUSLIB_EXP" in the DLL. The calling code must use the 
+  // 'GUSLIB_IMP' preprocessor flag.
+  template <class T> class SingletonHolder
+  {
+  private:
+		static T * objectPtr_;
+
+  protected:
+#if GUSLIB_FLAG_MULTITHREAD
+	  static guslib::GMutex creationMutex_;
+#endif
+
+  public:
+    // Get a pointer to the SingletonHolder instance.
+    static T * getPtr ()
+    {
+      // first check if it was created. If the mutex would be placed first, a performance hit would occur, since
+      // all operations would create and release a lock.
+      if (! objectPtr_)
+      {
+        throw std::runtime_error ("SingletonHolder getting NULL ptr");
+      }
+      return objectPtr_;
+    }//getptr
+    
+    // Assign the pointer to the singleton instance.
+    static void setPtr (T * ptr)
+    {
+      if (! ptr)
+      {
+        throw std::runtime_error ("SingletonHolder being assigned NULL ptr");
+      }
+#if GUSLIB_FLAG_MULTITHREAD
+        guslib::GScopedLock myLock (creationMutex_);
+#endif
+      objectPtr_ = ptr;
+    }
+
+    // Destroy the singleton instance. Again, try a double checked lock.
+    static void destroy ()
+    {
+      if (objectPtr_)
+      {
+#if GUSLIB_FLAG_MULTITHREAD
+        guslib::GScopedLock myLock (creationMutex_);
+#endif
+        if (objectPtr_)
+        {
+          delete objectPtr_;
+          objectPtr_ = NULL;
+        }
+      }
+    }//destroy
+  };
+
+#if GUSLIB_FLAG_SINGLETONINST != 0
+  template <class T> T* SingletonHolder<T>::objectPtr_ = NULL;
+#endif
+
+#if GUSLIB_FLAG_MULTITHREAD
+  template <class T> GMutex SingletonHolder<T>::creationMutex_;
+#endif
+
+} // namespace end
+
+#endif //GUS_LIB_SINGLETONHOLDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/smartptr.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,59 @@
+#ifndef GUS_LIB_SMARTPTR_H
+#define GUS_LIB_SMARTPTR_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//	 Last change:	$LastChangedDate: 2012-09-16 11:26:05 +0300 (D, 16 sep. 2012) $
+//	 Revision:		$Revision: 541 $
+
+
+#include <gussoundutil/guslibbuildopts.h>
+
+
+#if GUSLIB_USE_BOOST_SMART_POINTERS
+	#include <boost/shared_ptr.hpp>
+#endif // GUSLIB_USE_BOOST_SMART_POINTERS
+
+#if GUSLIB_USE_YASPER_SMART_POINTER
+	#include <gussoundutil/yasper.h>
+
+#endif // GUSLIB_USE_YASPER_SMART_POINTER
+
+
+
+namespace guslib
+{
+#if GUSLIB_USE_BOOST_SMART_POINTERS
+	#define GSharedPtr boost::shared_ptr
+#endif // GUSLIB_USE_BOOST_SMART_POINTERS
+
+
+#if GUSLIB_USE_YASPER_SMART_POINTER
+	#define GSmartPtr yasper::ptr
+#endif // GUSLIB_USE_YASPER_SMART_POINTER
+
+} //namespace guslib
+
+
+#endif // GUS_LIB_SMARTPTR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/stringutil.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,168 @@
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//	 Last change:	$LastChangedDate: 2013-06-20 22:36:33 +0200 (J, 20 iun. 2013) $
+//	 Revision:		$Revision: 573 $
+
+#include <gussoundutil/stringutil.h>
+#include <sstream>
+
+namespace guslib
+{
+	namespace stringutil
+	{
+		std::wstring StringToWString (const std::string& s)
+		{
+			std::wstring temp (s.length (),L' ');
+			std::copy (s.begin (), s.end (), temp.begin ());
+			return temp;
+		}
+
+		std::string WStringToString(const std::wstring& s)
+		{
+			if (s.length () == 0)
+			{
+				return std::string ();
+			}
+			std::string temp (s.length (), L' ');
+			std::copy (s.begin (), s.end (), temp.begin ());
+			return temp;
+		}
+
+		bool StringToBool (const std::string& s)
+		{
+			if (s.length () <= 0)
+			{
+				return false;
+			}
+
+			if (s[0] == 'T' || s[0] == 't' || s[0] == 'y' || s[0] == 'Y' || s[0] == '1')
+			{
+				return true;
+			}
+
+			return false;
+		}
+
+
+		std::string BoolToString (bool value, LetterCase format)
+		{
+			if (value)
+			{
+				switch (format)
+				{
+				case LowerCase:
+					return "true";
+				case UpperCase:
+					return "TRUE";
+				case SentenceCase:
+				default:
+					return "True";
+				}
+			}
+
+			switch (format)
+			{
+			case LowerCase:
+				return "false";
+			case UpperCase:
+				return "FALSE";
+			} // fall through
+			return "False";
+		}
+
+
+		int StringToInt (const std::string & s)
+		{
+			int ret;
+			std::istringstream (s) >> ret;
+			return ret;
+		}
+
+		std::string IntToString (int value)
+		{
+			std::stringstream ss;
+			ss << value;
+			return ss.str ();
+		}
+
+		long long StringToLongLong (const std::string & s)
+		{
+			long long ret;
+			std::istringstream (s) >> ret;
+			return ret;
+		}
+
+		std::string LongLongToString (long long value)
+		{
+			std::stringstream ss;
+			ss << value;
+			return ss.str ();
+		}
+
+		unsigned long long StringToUnsignedLongLong (const std::string & s)
+		{
+			unsigned long long ret;
+			std::istringstream (s) >> ret;
+			return ret;
+		}
+
+		std::string UnsignedLongLongToString (unsigned long long value)
+		{
+			std::stringstream ss;
+			ss << value;
+			return ss.str ();
+		}
+
+		double StringToDouble (const std::string & s)
+		{
+			double ret;
+			std::istringstream (s) >> ret;
+			return ret;
+		}
+
+		std::string DoubleToString (double value)
+		{
+			std::stringstream ss;
+			ss << value;
+			return ss.str ();
+		}
+		
+
+		std::string getExtensionFromFileName (const std::string &fileName)
+		{
+			std::string result;
+			unsigned foundPos = fileName.find_last_of (".");
+			if (foundPos != std::string::npos)
+			{
+				// Name
+				//result = result.substr (0, foundPos);
+				// Extension
+				result = fileName.substr (foundPos + 1);
+			}
+
+			return result;
+		}
+
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/stringutil.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,74 @@
+#ifndef GUS_LIB_STRINGUTIL_H
+#define GUS_LIB_STRINGUTIL_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   String utility
+//
+//	 Last change:	$LastChangedDate: 2013-06-02 23:28:45 +0300 (D, 02 iun. 2013) $
+//	 Revision:		$Revision: 563 $
+
+#include <string>
+
+namespace guslib
+{
+	typedef enum
+	{
+		SentenceCase,	// Sentencecase
+		LowerCase,		// lowercase
+		UpperCase,		// ALL_CAPS
+		CamelCase,		// camelCase
+		UpperCamelCase,	// CamelCase
+		NumLetterCases
+	}LetterCase;
+
+
+
+	namespace stringutil
+	{
+		
+		// Prototype for conversion functions
+		std::wstring StringToWString (const std::string& s);
+		std::string WStringToString (const std::wstring& s);
+
+		bool StringToBool (const std::string& s);
+		std::string BoolToString (bool value, LetterCase format = SentenceCase);
+
+		int StringToInt (const std::string & s);
+		std::string IntToString (int value);
+
+		long long StringToLongLong (const std::string & s);
+		std::string LongLongToString (long long value);
+
+		unsigned long long StringToUnsignedLongLong (const std::string & s);
+		std::string UnsignedLongLongToString (unsigned long long value);
+
+		double StringToDouble (const std::string & s);
+		std::string DoubleToString (double value);
+
+		std::string getExtensionFromFileName (const std::string &fileName);
+	}
+}
+
+#endif // GUS_LIB_STRINGUTIL_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/timer.cpp	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,253 @@
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Timer utility.
+//
+//	 Last change:	$LastChangedDate: 2013-06-20 22:36:33 +0200 (J, 20 iun. 2013) $
+//	 Revision:		$Revision: 573 $
+
+
+#include <gussoundutil/timer.h>
+
+#if GUSLIB_FLAG_MULTITHREAD
+#pragma message("Timer: Multithreaded synchronization enabled!")
+#else
+#pragma message("Timer: Multithreaded synchronization disabled!")
+#endif
+
+
+#include <sstream>
+
+#ifdef _WINDOWS
+#include <windows.h>
+#include <mmsystem.h>	//	(Requires winmm.lib added to the link options.)
+#pragma comment(lib,"winmm.lib")
+
+#else
+#include <time.h>
+
+#endif //_WINDOWS
+
+namespace guslib
+{
+	AbstractTimer::AbstractTimer()
+		: latestTime(0)
+	{
+	}
+
+
+	AbstractTimer::~AbstractTimer()
+	{
+	}
+
+
+	void AbstractTimer::reset()
+	{
+		// call to abstract function. this must not be called in the abstract class' constructor.
+		latestTime = getCurrentTimeUnits();
+	}
+
+
+	TimeUnits AbstractTimer::elapsed()
+	{
+		TimeUnits curr = getCurrentTimeUnits();
+		TimeUnits tu = curr - latestTime;
+		return tu;
+	}
+
+	TimeUnits AbstractTimer::renew()
+	{
+		TimeUnits curr = getCurrentTimeUnits();
+		TimeUnits tu = curr - latestTime;
+		latestTime = curr;
+		return tu;
+	}
+
+
+	// --------------------- the Ogre timer --------------------------
+	GusLibOgreTimer::GusLibOgreTimer ()
+	{
+		reset ();
+	}
+
+	GusLibOgreTimer::~GusLibOgreTimer ()
+	{
+	}
+
+
+	TimeUnits GusLibOgreTimer::getCurrentTimeUnits ()
+	{
+		unsigned long currentMillis = timer_.getMilliseconds ();
+		return static_cast<TimeUnits> (currentMillis);
+	}
+
+	TimeUnits GusLibOgreTimer::getTimeSinceMidnight () const
+	{
+		TimeUnits returnValue (0);
+
+#ifdef _WINDOWS
+		SYSTEMTIME localTime;
+		GetLocalTime (&localTime);
+
+		returnValue = localTime.wHour;
+		returnValue = returnValue * 60 + localTime.wMinute;
+		returnValue = returnValue * 60 + localTime.wSecond;
+		returnValue = returnValue * 1000 + localTime.wMilliseconds;
+#else
+		struct tm *newtime;
+
+		time_t long_time;
+
+		time( &long_time );
+		newtime = localtime( &long_time ); // Convert to local time.
+
+		returnValue = newtime->tm_hour;
+		returnValue = returnValue * 60 + newtime->tm_min;
+		returnValue = returnValue * 60 + newtime->tm_sec;
+		returnValue = returnValue * 1000 + 0; // no millis
+#endif
+		return returnValue;
+	}
+
+	void GusLibOgreTimer::reset ()
+	{
+		timer_.reset ();
+	}
+
+	// --------------------- the windows timer --------------------------
+
+#ifdef _WINDOWS
+
+	WinTimer::WinTimer()
+	{
+		reset();
+	}
+
+
+	WinTimer::~WinTimer()
+	{
+	}
+
+
+	TimeUnits WinTimer::getCurrentTimeUnits()
+	{
+		return timeGetTime();
+	}
+
+	TimeUnits WinTimer::getTimeSinceMidnight () const
+	{
+		TimeUnits returnValue (0);
+
+#ifdef _WINDOWS
+		SYSTEMTIME localTime;
+		GetLocalTime (&localTime);
+
+		returnValue = localTime.wHour;
+		returnValue = returnValue * 60 + localTime.wMinute;
+		returnValue = returnValue * 60 + localTime.wSecond;
+		returnValue = returnValue * 1000 + localTime.wMilliseconds;
+#else
+		struct tm *newtime;
+
+		time_t long_time;
+
+		time( &long_time );
+		newtime = localtime( &long_time ); // Convert to local time.
+
+		returnValue = newtime->tm_hour;
+		returnValue = returnValue * 60 + newtime->tm_min;
+		returnValue = returnValue * 60 + newtime->tm_sec;
+		returnValue = returnValue * 1000 + 0; // no millis
+#endif
+		return returnValue;
+	}
+
+#endif
+
+
+	// ------------------------- app clock ---------------------------
+
+	ApplicationClockUtil::ApplicationClockUtil ()
+		: Timer ()
+	{
+		initialTime_ = getCurrentTimeUnits();
+	}
+
+	ApplicationClockUtil::~ApplicationClockUtil ()
+	{
+	}
+
+	std::string ApplicationClockUtil::getTimeAsString ()
+	{
+		TimeUnits temp (getTimeFromStart ());
+		std::string returnValue;
+
+		int nMillis = temp % 1000;
+		temp = (temp - nMillis) / 1000;
+
+		int nSec = temp % 60;
+		temp = (temp - nSec) / 60;
+
+		int nMin = temp % 60;
+		temp = (temp - nMin) / 60;
+
+		int nHour = temp % 24;
+		temp = (temp - nHour) / 24;
+
+		std::stringstream ss;
+		ss << nHour << ":" << nMin << ":" << nSec << "." << nMillis;
+		returnValue = ss.str ();
+
+		return returnValue;
+	}
+
+	TimeUnits ApplicationClockUtil::getTimeFromStart () 
+	{
+		TimeUnits curr = getCurrentTimeUnits();
+		TimeUnits tu = curr - initialTime_;
+		return tu;
+	}
+
+
+	// ------------------------- sys clock ---------------------------
+
+	SystemClockUtil::SystemClockUtil ()
+	{
+		initialTime_ = getTimeSinceMidnight ();
+
+		TimeUnits timeSinceStartup = getCurrentTimeUnits ();
+
+		// since we will always get the time based on the time since the startup, we must change this initial time.
+		// so that it has an offset.
+		initialTime_ = timeSinceStartup - initialTime_;
+	}
+
+
+	TimeUnits SystemClockUtil::getTimeFromStart () 
+	{
+		TimeUnits curr = getCurrentTimeUnits();
+		TimeUnits tu = curr - initialTime_;
+		return tu;
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/timer.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,318 @@
+#ifndef GUS_LIB_TIMER_H
+#define GUS_LIB_TIMER_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Timer utility.
+//
+//	 Last change:	$LastChangedDate: 2012-09-16 11:26:05 +0300 (D, 16 sep. 2012) $
+//	 Revision:		$Revision: 541 $
+
+#include <gussoundutil/guslibbuildopts.h>
+
+#include <gussoundutil/singleton.hpp>
+
+#include <ostream>
+
+#if GUSLIB_FLAG_MULTITHREAD
+#	include <gussoundutil/thread.h>
+#endif
+
+#define ENABLE_OGRE_BASED_TIMER
+
+#ifdef ENABLE_OGRE_BASED_TIMER
+#	include <OgreTimer.h>
+#endif
+
+
+namespace guslib
+{
+	typedef long long TimeUnits;
+
+
+	/// Abstract timer class, has the entire timer functionality and logic, but has no access
+	/// to time passing functions.
+	class AbstractTimer
+	{
+	protected:
+		TimeUnits  latestTime;       // latest accessed time
+
+	public:
+		/// Constructor.
+		AbstractTimer();
+
+		/// Destructor.
+		virtual ~AbstractTimer();
+
+		/// Access the system time units. Override in child classes.
+		virtual TimeUnits getCurrentTimeUnits() = 0;
+
+		/// Resets the timer duration to zero
+		virtual void reset();
+
+		/// Gets the time interval from the last reset operation
+		virtual TimeUnits elapsed();
+
+		/// Gets the time interval from the last reset operation and then resets the timer
+		virtual TimeUnits renew();
+	};
+
+
+#ifdef ENABLE_OGRE_BASED_TIMER
+	/// Ogre implementation using the Ogre timers. Requires the OGRE3D library!
+	class GusLibOgreTimer
+		: public AbstractTimer
+	{
+	protected:
+		Ogre::Timer timer_;
+	public:
+		GusLibOgreTimer ();
+		virtual ~GusLibOgreTimer ();
+		virtual TimeUnits getCurrentTimeUnits ();
+		virtual TimeUnits getTimeSinceMidnight () const;
+		/// Resets the timer duration to zero
+		virtual void reset();
+	};
+#endif
+
+
+#ifdef _WINDOWS
+	/// Windows implementation for the abstract timer.
+	class WinTimer : public AbstractTimer
+	{
+	protected:
+	public:
+		WinTimer();
+		virtual ~WinTimer();
+		virtual TimeUnits getCurrentTimeUnits ();
+		virtual TimeUnits getTimeSinceMidnight () const;
+	};
+#endif
+
+	// Redirection of the timer.
+#ifdef ENABLE_OGRE_BASED_TIMER
+	// The Ogre timer will be the standard accessible timer, through the Timer name.
+	typedef GusLibOgreTimer Timer;
+#else
+#	ifdef _WINDOWS
+		// The windows timer will be the standard accessible timer, through the Timer name.
+		typedef WinTimer Timer;
+#	else
+		// TODO: define a unix timer?
+#	endif //_WINDOWS
+#endif //ENABLE_OGRE_BASED_TIMER
+
+	class ApplicationClockUtil;
+
+
+	///
+	/// The application clock utility class. 
+	///
+	class ApplicationClockUtil
+		: public Timer
+	{
+	protected:
+		ApplicationClockUtil ();
+		TimeUnits  initialTime_;
+
+	public:
+		virtual ~ApplicationClockUtil ();
+		friend class guslib::Singleton <ApplicationClockUtil>;
+
+		virtual TimeUnits getTimeFromStart ();
+
+		/**
+			Make the class accessible to ostreams (e.g. cout);
+			Because this can be used very often in the code, it needs to be very fast.
+		*/
+		inline friend std::ostream & operator<<(std::ostream& s, const ApplicationClockUtil & cl)
+		{
+			TimeUnits temp (const_cast<ApplicationClockUtil&>(cl).getTimeFromStart ());
+
+			int nMillis = temp % 1000;
+			temp = (temp - nMillis) / 1000;
+
+			int nSec = temp % 60;
+			temp = (temp - nSec) / 60;
+
+			int nMin = temp % 60;
+			temp = (temp - nMin) / 60;
+
+			int nHour = temp % 24;
+			temp = (temp - nHour) / 24;
+
+			char caster [4];
+			caster[3] = '\0';
+
+			caster[0] = nHour / 10 + '0';
+			caster[1] = nHour % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nMin / 10 + '0';
+			caster[1] = nMin % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nSec / 10 + '0';
+			caster[1] = nSec % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ".";
+
+			caster[0] = nMillis / 100;
+			caster[2] = nMillis % 10 + '0';
+			caster[1] = (nMillis - caster[0] * 100) / 10 + '0';
+			caster[0] += '0';
+			caster[3] = '\0';
+
+			s << caster;
+			return s;
+		}
+
+		virtual std::string getTimeAsString ();
+	};
+
+
+	typedef guslib::Singleton <ApplicationClockUtil> AppClock;
+
+
+	///
+	/// The system clock utility class. 
+	///
+	class SystemClockUtil
+		: public ApplicationClockUtil
+	{
+	protected:
+		SystemClockUtil ();
+
+	public:
+		friend class guslib::Singleton <SystemClockUtil>;
+
+		// gets the time since the start of day.
+		virtual TimeUnits getTimeFromStart ();
+
+		/**
+			Make the class accessible to ostreams (e.g. cout);
+			Because this can be used very often in the code, it needs to be very fast.
+		*/
+		inline friend std::ostream & operator<<(std::ostream& s, const SystemClockUtil & cl)
+		{
+			TimeUnits temp (const_cast<SystemClockUtil&>(cl).getTimeFromStart ());
+
+			int nMillis = temp % 1000;
+			temp = (temp - nMillis) / 1000;
+
+			int nSec = temp % 60;
+			temp = (temp - nSec) / 60;
+
+			int nMin = temp % 60;
+			temp = (temp - nMin) / 60;
+
+			int nHour = temp % 24;
+			temp = (temp - nHour) / 24;
+
+			char caster [4];
+			caster[3] = '\0';
+
+			caster[0] = nHour / 10 + '0';
+			caster[1] = nHour % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nMin / 10 + '0';
+			caster[1] = nMin % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nSec / 10 + '0';
+			caster[1] = nSec % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ".";
+
+			caster[0] = nMillis / 100;
+			caster[2] = nMillis % 10 + '0';
+			caster[1] = (nMillis - caster[0] * 100) / 10 + '0';
+			caster[0] += '0';
+			caster[3] = '\0';
+
+			s << caster;
+			return s;
+		}
+
+		/**
+			Make the class accessible to ostreams (e.g. cout);
+			Because this can be used very often in the code, it needs to be very fast.
+		*/
+		inline friend std::wostream & operator<<(std::wostream& s, const SystemClockUtil & cl)
+		{
+			TimeUnits temp (const_cast<SystemClockUtil&>(cl).getTimeFromStart ());
+
+			int nMillis = temp % 1000;
+			temp = (temp - nMillis) / 1000;
+
+			int nSec = temp % 60;
+			temp = (temp - nSec) / 60;
+
+			int nMin = temp % 60;
+			temp = (temp - nMin) / 60;
+
+			int nHour = temp % 24;
+			temp = (temp - nHour) / 24;
+
+			char caster [4];
+			caster[3] = '\0';
+
+			caster[0] = nHour / 10 + '0';
+			caster[1] = nHour % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nMin / 10 + '0';
+			caster[1] = nMin % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ":";
+
+			caster[0] = nSec / 10 + '0';
+			caster[1] = nSec % 10 + '0';
+			caster[2] = '\0';
+			s << caster << ".";
+
+			caster[0] = nMillis / 100;
+			caster[2] = nMillis % 10 + '0';
+			caster[1] = (nMillis - caster[0] * 100) / 10 + '0';
+			caster[0] += '0';
+			caster[3] = '\0';
+
+			s << caster;
+			return s;
+		}
+	};
+
+
+	typedef guslib::Singleton <SystemClockUtil> SysClock;
+
+}
+
+
+#endif // GUS_LIB_TIMER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/trace.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,393 @@
+#ifndef GUS_LIB_TRACE_H
+#define GUS_LIB_TRACE_H
+
+//   This file is part of the guslib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2010-2011  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//   
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//   
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+
+//	 Last change:	$LastChangedDate: 2012-09-16 11:26:05 +0300 (D, 16 sep. 2012) $
+//	 Revision:		$Revision: 541 $
+
+// Using the std::string
+#include <string>
+// Using the std::ofstream
+#include <fstream>
+// output stream
+#include <ostream>
+
+#include <gussoundutil/guslibbuildopts.h>
+
+#if GUSLIB_FLAG_MULTITHREAD
+// Use thread mutexes if required
+#include <gussoundutil/thread.h>
+#endif
+
+// Use the phoenix singleton implementation. This is a useful singleton pattern for logging.
+#include <gussoundutil/singleton.hpp>
+
+// Default to using line in trace file (can be overridden)
+#ifndef GUS_USE_LINE_IN_TRACE
+#define GUS_USE_LINE_IN_TRACE 1
+#endif
+
+#ifndef GUS_USE_TIMER_IN_TRACE
+#define GUS_USE_TIMER_IN_TRACE 1
+#endif
+
+#if GUS_USE_TIMER_IN_TRACE
+#include <gussoundutil/timer.h>
+#endif
+
+//Note: you may want to define the additional MACROS:
+// GUSLIB_FLAG_MULTITHREAD - will add multithreaded synchronization for creating the Singleton and for writing to the stream.
+// This will require the inclusion of GMutex.h
+
+namespace guslib
+{
+#ifndef GUSLIB_NOTRACE
+
+	/// @brief
+	/// Trace logging utility class.
+	/// @details
+	///	To disable the tracing class (TraceUtil) being built into a project, the GUSLIB_NOTRACE macro must be defined.
+	/// The TraceUtil class should be thread safe.
+	/// TraceUtil should be made to follow the singleton design pattern.
+	/// @note Please consider using the utility macros instead of accessing the functions directly, since it
+	/// will be much more convenient.
+	/// @note The current implementation ignores caching, so the flush operation is pointless.
+	/// @page Tracer
+	/// some trace page
+	///
+	/// Usage example, through the use of macros
+	/// @code
+	/// std::string myFileName = "c:/temp/test.txt";
+	/// int traceLevel = 4; // Level of tracing
+	/// GSTARTTRACING(myFileName, traceLevel);
+	/// GTRACE(1, "The trace started successfully");
+	/// GTRACE(5, "This message is not written, because it's sent with level 5, but the trace level is 4");
+	/// GDISABLETRACE; // the trace was disabled.
+	/// GTRACE(1, "this will also not be written, because the tracing is disabled);
+	/// GENABLETRACE(); // trace was re-enabled.
+	/// GTRACE(4, "This message is written.");
+	/// GSETTRACELEVEL(3); // the trace level was changed.
+	/// GTRACE(4, "This message is not written, because it's sent with level 4, but the trace level is 3");");
+	/// GTRACE(3, "It is possible to "<<"group"<<" more texts using the << operator.");
+	/// GTRACE(-1, "It's possible to use negative levels also for even higher priority.");
+	/// GSTOPTRACING(); // The trace object static instance is destroyed; file handle closed.
+	/// // The trace object is cleanly removed when the program exits, so this is optional.
+	/// @endcode
+	class TraceUtil
+	{
+	private:
+		std::string fileName_;
+		bool enabled_;
+		int level_;
+		std::ostream customOut_; // the output stream; used for write operations.
+		std::ofstream of_; // the output filestream; used for file operations.
+	protected:
+		bool fileIsOpened;
+
+		///
+		/// Close the file handle. Override this if you define a child class with a different stream.
+		///
+		virtual void closeFileHandle ()
+		{
+			// Close the file stream.
+			of_.close ();
+			fileIsOpened = false;
+		}
+
+		///
+		/// Open the file handle. Override this if you define a child class with a different stream.
+		///
+		virtual void openFileHandle ()
+		{
+			try
+			{
+				// open the file stream
+				of_.open(fileName_.c_str());
+				// store the file stream's buffer in the output stream 
+				customOut_.rdbuf(of_.rdbuf());
+
+				// keep track of the opened status.
+				fileIsOpened = true;
+			}
+			catch( std::exception & )
+			{
+				fileIsOpened = false;
+			}
+		}
+
+#if GUSLIB_FLAG_MULTITHREAD
+		/// mutex used in multithreaded trace access.
+		GMutex writeMutex;
+#endif
+		///
+		/// The constructor.
+		///
+		TraceUtil ()
+			: fileName_("")
+			, fileIsOpened(false)
+			, level_(10)
+			, enabled_(true)
+            , of_("")
+            , customOut_(0)
+		{
+		}
+
+	public:
+
+		///
+		/// Destructor; simply close the file handle.
+		///
+		virtual ~TraceUtil ()
+		{
+			closeFileHandle();
+		}
+
+		virtual std::ostream& operator<< (std::streambuf * ss)
+		{
+			customOut_ << ss;
+			return customOut_;
+		}
+
+		///
+		/// Direct access to the output stream. This can be much quicker than
+		/// using the writeLine function, if you need to pass something other
+		/// than plain text.
+		///
+		virtual std::ostream& getOutputStream ()
+		{
+			return customOut_;
+		}
+
+#if GUSLIB_FLAG_MULTITHREAD
+		/// mutex used in multithreaded trace access.
+		virtual GMutex& getWriteMutex () { return writeMutex; }
+#endif
+
+		///
+		/// Getter for enabled/disabled status
+		///
+		virtual bool inline isEnabled () const
+		{
+			return enabled_;
+		}
+
+		///
+		/// Specify whether a trace with the given level can be written.
+		///
+		virtual bool inline canTraceWithLevel (int level)
+		{
+			return enabled_ && level <= level_;
+		}
+
+		///
+		/// Getter for the trace level.
+		///
+		virtual int inline getLevel () const
+		{
+			return level_;
+		}
+
+		///
+		/// Initialization with the file name to use.
+		///
+		virtual void initialize (const std::string & fileNameToUse)
+		{
+			fileName_ = fileNameToUse;
+
+			// Open the file, deleting its old contents
+			openFileHandle();
+		}
+
+		///
+		/// Enable or disable the logging alltogether.
+		///
+		virtual void setEnabled (bool value = true)
+		{
+			enabled_ = value;
+		}
+
+
+		///
+		/// Setter for the filename. This also opens the file for writing.
+		///
+		virtual void setFileName (const std::string & fileNameToUse)
+		{
+			if( fileNameToUse.length() <= 0 )
+				return;
+
+			// Close the existing file handle if one is already opened.
+			closeFileHandle();
+
+			// Open or reopen the file handle.
+			fileName_ = fileNameToUse;
+			openFileHandle();
+		}
+
+		///
+		/// Setter for the tracing level.
+		///
+		virtual void setLevel (int lvl)
+		{
+			level_ = lvl;
+		}
+
+
+		///
+		/// Add a line to write into the log file (using a string).
+		/// Writes a line to the file. The file is expected to be opened; the text is expected to be non-empty.
+		///
+		virtual void inline writeLine (const std::string & textToWrite)
+		{
+#if GUSLIB_FLAG_MULTITHREAD
+			guslib::GScopedLock myLock (writeMutex);
+#endif
+			if (! fileIsOpened)
+			{
+			  return;
+			}
+
+			if (! isEnabled())
+			{
+			  return;
+			}
+			customOut_ << textToWrite << std::endl;
+		}
+
+		///
+		/// Add a line to write into the log file (using a string).
+		/// Writes a line to the file. The file is expected to be opened; the text is expected to be non-empty.
+		///
+		virtual void inline writeLine (const std::wstring & textToWrite)
+		{
+#if GUSLIB_FLAG_MULTITHREAD
+			guslib::GScopedLock myLock (writeMutex);
+#endif
+			if (! fileIsOpened)
+			{
+			  return;
+			}
+
+			if (! isEnabled())
+			{
+			  return;
+			}
+			customOut_ << "Warning: you are trying to write unicode text to an ASCII file. If you want to output unicode, please use GSTARTTRACINGW instead of GSTARTTRACING" << std::endl;
+		}
+
+		// Allow the singleton template to have access to the constructor.
+		friend class guslib::Singleton <TraceUtil>;
+	};
+
+
+	// Redefine the singleton; makes it easier to write code.
+	typedef guslib::Singleton <guslib::TraceUtil> Tracer;
+
+
+#if GUSLIB_FLAG_SINGLETONINST == 0
+	// If the singleton is not set to create instances.
+	guslib::TraceUtil * guslib::Singleton <guslib::TraceUtil>::objectPtr_ = NULL;
+#endif
+
+
+	// Also explicitly instantiate the template class.
+	// TODO: this is only microsoft specific so make it at least connected to a windows environment var.
+#ifndef GUSLIB_EXPLICIT_INST_TRACE
+#define GUSLIB_EXPLICIT_INST_TRACE
+	GUSLIB_EXPIMP_TEMPLATE template class GUSLIB_EXPORT_SYMBOL guslib::Singleton <guslib::TraceUtil>;
+#endif // GUSLIB_EXPLICIT_INST_TRACE
+
+#endif // GUSLIB_NOTRACE
+
+#ifndef GUSLIB_NOTRACE
+
+#if GUS_USE_LINE_IN_TRACE
+#if GUS_USE_TIMER_IN_TRACE
+#define GUSLIB_TRACE_TEXT( level, text ) level << "\t|\t"<<guslib::SysClock::get () << "\t|\t"<<text<<"\t\t("<<__FILE__<<", line "<< __LINE__<<")" << std::endl
+#else
+#define GUSLIB_TRACE_TEXT( level, text ) level << "\t|\t"<<text<<"\t\t("<<__FILE__<<", line "<< __LINE__<<")" << std::endl
+#endif // GUS_USE_TIMER_IN_TRACE
+#else // no code line in trace
+#if GUS_USE_TIMER_IN_TRACE
+#define GUSLIB_TRACE_TEXT(level, text) level << "\t|\t" <<guslib::SysClock::get () << "\t|\t" << text << std::endl;
+#else
+#define GUSLIB_TRACE_TEXT(level, text) level << "\t|\t"<<text<<"\n"
+#endif
+#endif //GUS_USE_LINE_IN_TRACE
+
+#if GUSLIB_FLAG_MULTITHREAD
+#define GTRACE(level, text)\
+	if( guslib::Tracer::getPtr()->canTraceWithLevel (level) )\
+	{ guslib::GScopedLock myLock (guslib::Tracer::getPtr ()->getWriteMutex());\
+	guslib::Tracer::getPtr ()->getOutputStream () << GUSLIB_TRACE_TEXT (level,text);\
+	}
+#define GTRACEW(level, text)\
+	if( guslib::Tracer::getPtr()->canTraceWithLevel (level) )\
+	{ guslib::GScopedLock myLock (guslib::Tracer::getPtr ()->getWriteMutex());\
+	if(guslib::Tracer::getPtr ()->getEncodingUsed () != guslib::UNICODE_WCHAR) guslib::Tracer::getPtr ()->getOutputStream () <<\
+	"You cannot use GTRACEW, because tracing was started in ASCII mode. Use GSTARTTRACINGW for unicode initiation."<<std::endl;\
+	else guslib::Tracer::getPtr ()->getOutputStreamW () << GUSLIB_TRACE_TEXT (level,text);\
+	}
+#else
+#define GTRACE(level, text)\
+	if( guslib::Tracer::getPtr()->canTraceWithLevel (level) )\
+	{guslib::Tracer::getPtr ()->getOutputStream () << GUSLIB_TRACE_TEXT(level,text);\
+	}
+#define GTRACEW(level, text)\
+	if( guslib::Tracer::getPtr()->canTraceWithLevel (level) )\
+	{guslib::Tracer::getPtr ()->getOutputStreamW () << GUSLIB_TRACE_TEXT(level,text);\
+	}
+#endif
+
+#define GSTARTTRACING(file, level) \
+	guslib::Tracer::getPtr ()->setFileName (file);\
+	guslib::Tracer::getPtr ()->setLevel (level);\
+	guslib::Tracer::getPtr ()->setEnabled ();
+
+#define GSTARTTRACINGW(file, level) \
+	guslib::Tracer::getPtr ()->setEncoding (guslib::UNICODE_WCHAR);\
+	guslib::Tracer::getPtr ()->setFileName (file);\
+	guslib::Tracer::getPtr ()->setLevel (level);\
+	guslib::Tracer::getPtr ()->setEnabled ();
+
+// call this before quiting the app.
+#define GSTOPTRACING() guslib::Tracer::destroy ()
+
+#define GDISABLETRACE() guslib::Tracer::getPtr()->setEnabled (false)
+
+#define GENABLETRACE() guslib::Tracer::getPtr()->setEnabled (true)
+
+#define GSETTRACELEVEL(level) guslib::Tracer::getPtr()->setLevel (level)
+
+#else //GUSLIB_NOTRACE
+#define GTRACE( level, text )
+#define GSTARTTRACING( file, level )
+#define GDISABLETRACE()
+#define GENABLETRACE() 
+#define GSETTRACELEVEL( level )
+#define GSTOPTRACING()
+#endif//GUSLIB_NOTRACE
+}//namespace guslib
+
+#endif // GUS_LIB_TRACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gussound/gussoundutil/yasper.h	Thu Mar 20 19:04:28 2014 +0100
@@ -0,0 +1,441 @@
+/*
+ * yasper - A non-intrusive reference counted pointer. 
+ *	    Version: 1.04
+ *			  
+ *  Many ideas borrowed from Yonat Sharon and 
+ *  Andrei Alexandrescu.
+ *
+ * (zlib license)
+ * ----------------------------------------------------------------------------------	
+ * Copyright (C) 2005-2007 Alex Rubinsteyn
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * -----------------------------------------------------------------------------------
+ * 
+ * Send all questions, comments and bug reports to:
+ * Alex Rubinsteyn (alex.rubinsteyn {at-nospam} gmail {dot} com)
+ */
+
+
+#ifndef yasper_ptr_h
+#define yasper_ptr_h
+
+#include <exception>
+
+namespace yasper
+{
+
+struct NullPointerException : public std::exception
+{
+    NullPointerException() throw() {}
+    ~NullPointerException() throw() {}
+	
+    const char* what() const throw()
+    {
+        return "[Yasper Exception] Attempted to dereference null pointer";
+    }
+};
+
+struct Counter 
+{
+	Counter(unsigned c = 1) : count(c) {}
+	unsigned count; 
+};
+
+template <typename X> 
+class ptr
+{
+
+public:
+    typedef X element_type;
+
+	/* 
+		ptr needs to be its own friend so ptr< X > and ptr< Y > can access
+		each other's private data members 
+	*/ 
+	template <class Y> friend class ptr; 
+	/* 
+		default constructor
+			- don't create Counter
+	*/
+	ptr() : rawPtr(0), counter(0) { }
+	
+	/*
+		Construct from a raw pointer 
+	*/
+	ptr(X* raw, Counter* c = 0) : rawPtr(0), counter(0)
+	{
+		if (raw)
+		{
+			rawPtr = raw; 
+			if (c) acquire(c);
+			else counter = new Counter;
+		}
+	}
+	
+	template <typename Y>
+ 	explicit ptr(Y* raw, Counter* c = 0) : rawPtr(0), counter(0)
+	{
+		if (raw)
+		{
+			rawPtr = static_cast<X*>( raw );
+			if (c) acquire(c);
+			else counter = new Counter; 
+		}
+	}
+	
+	
+	/*
+		Copy constructor 
+	*/
+	ptr(const ptr< X >& otherPtr)
+	{
+		acquire( otherPtr.counter );
+		rawPtr = otherPtr.rawPtr;
+	}
+	
+	template <typename Y>
+	explicit ptr(const ptr< Y >& otherPtr) : rawPtr(0), counter(0)
+	{
+		acquire(otherPtr.counter);
+		rawPtr = static_cast<X*>( otherPtr.GetRawPointer());
+	}
+	
+
+	/* 
+		Destructor 
+	*/ 
+	~ptr()
+	{
+		release();
+	}
+
+/*
+	Assignment to another ptr 
+*/
+
+ptr& operator=(const ptr< X >& otherPtr)
+{
+	if (this != &otherPtr)
+	{
+		release();
+		acquire(otherPtr.counter); 
+		rawPtr = otherPtr.rawPtr; 
+	}
+	return *this; 
+}
+
+template <typename Y>
+ptr& operator=(const ptr< Y >& otherPtr)
+{
+	if ( this != (ptr< X >*) &otherPtr )
+	{
+		release();
+		acquire(otherPtr.counter);
+		rawPtr = static_cast<X*> (otherPtr.GetRawPointer());
+	}
+	return *this;
+}
+
+/*
+	Assignment to raw pointers is really dangerous business.
+	If the raw pointer is also being used elsewhere,
+	we might prematurely delete it, causing much pain.
+	Use sparingly/with caution.
+*/
+
+ptr& operator=(X* raw)
+{
+
+	if (raw)
+	{
+		release(); 
+		counter = new Counter; 
+		rawPtr = raw; 
+	}
+	return *this;
+}
+
+template <typename Y>
+ptr& operator=(Y* raw)
+{
+	if (raw)
+	{
+		release();
+		counter = new Counter; 
+		rawPtr = static_cast<X*>(raw);
+	}
+	return *this;
+}
+
+/* 
+	assignment to long to allow ptr< X > = NULL, 
+	also allows raw pointer assignment by conversion. 
+	Raw pointer assignment is really dangerous!
+	If the raw pointer is being used elsewhere, 
+	it will get deleted prematurely. 
+*/ 
+	ptr& operator=(long num)
+	{
+		if (num == 0)  //pointer set to null
+		{
+			release(); 
+		}
+
+		else //assign raw pointer by conversion
+		{
+			release();
+			counter = new Counter; 
+			rawPtr = reinterpret_cast<X*>(num);
+		}	
+
+		return *this; 
+	} 
+
+/*
+	Member Access
+*/
+	X* operator->() const 
+	{
+		return GetRawPointer(); 
+	}
+
+
+/*
+	Dereference the pointer
+*/
+	X& operator* () const 
+	{
+		return *GetRawPointer(); 
+	}
+
+
+/*
+	Conversion/casting operators
+*/
+
+
+	operator bool() const
+	{
+		return IsValid();
+	}
+
+	
+	/*
+	   implicit casts to base types of the
+	   the pointer we're storing 
+	*/
+	
+	template <typename Y>
+	operator Y*() const
+	{
+		return static_cast<Y*>(rawPtr);  
+	}
+
+	template <typename Y>
+	operator const Y*() const
+	{
+		return static_cast<const Y*>(rawPtr);
+	}
+
+	template <typename Y>
+	operator ptr<Y>()
+	{
+		//new ptr must also take our counter or else the reference counts 
+		//will go out of sync
+		return ptr<Y>(rawPtr, counter);
+	}
+
+
+/*
+	Provide access to the raw pointer 
+*/
+
+	X* GetRawPointer() const         
+	{
+		if (rawPtr == 0) throw new NullPointerException;
+		return rawPtr;
+	}
+
+	
+/* 
+	Is there only one reference on the counter?
+*/
+	bool IsUnique() const
+	{
+		if (counter && counter->count == 1) return true; 
+		return false; 
+	}
+	
+	bool IsValid() const
+	{
+		if (counter && rawPtr) return true;
+		return false; 
+	}
+
+	unsigned GetCount() const
+	{
+		if (counter) return counter->count;
+		return 0;
+	}
+
+private:
+	X* rawPtr;
+
+	Counter* counter;
+
+	// increment the count
+	void acquire(Counter* c) 
+	{ 
+ 		counter = c;
+		if (c)
+		{
+			(c->count)++;
+		}
+	}
+
+	// decrement the count, delete if it is 0
+	void release()
+	{ 
+        if (counter) 
+		{			
+			(counter->count)--; 	
+
+			if (counter->count == 0) 
+			{
+				delete counter;			
+				delete rawPtr;
+			}
+		}
+		counter = 0;
+		rawPtr = 0; 
+
+	}
+};
+
+
+template <typename X, typename Y>
+bool operator==(const ptr< X >& lptr, const ptr< Y >& rptr) 
+{
+	return lptr.GetRawPointer() == rptr.GetRawPointer(); 
+}
+
+template <typename X, typename Y>
+bool operator==(const ptr< X >& lptr, Y* raw) 
+{
+	return lptr.GetRawPointer() == raw ; 
+}
+
+template <typename X>
+bool operator==(const ptr< X >& lptr, long num)
+{
+	if (num == 0 && !lptr.IsValid())  //both pointer and address are null
+	{
+		return true; 
+	}
+
+	else //convert num to a pointer, compare addresses
+	{
+		return lptr == reinterpret_cast<X*>(num);
+	}
+	 
+} 
+
+template <typename X, typename Y>
+bool operator!=(const ptr< X >& lptr, const ptr< Y >& rptr) 
+{
+	return ( !operator==(lptr, rptr) );
+}
+
+template <typename X, typename Y>
+bool operator!=(const ptr< X >& lptr, Y* raw) 
+{
+	return ( !operator==(lptr, raw) );
+}
+
+template <typename X>
+bool operator!=(const ptr< X >& lptr, long num)
+{
+	return (!operator==(lptr, num) ); 
+}
+
+template <typename X, typename Y>
+bool operator&&(const ptr< X >& lptr, const ptr< Y >& rptr)
+{
+	return lptr.IsValid() &&  rptr.IsValid();
+}
+
+template <typename X>
+bool operator&&(const ptr< X >& lptr, bool rval)
+{
+	return lptr.IsValid() && rval;
+}
+
+template <typename X>
+bool operator&&(bool lval, const ptr< X >& rptr)
+{
+	return lval &&  rptr.IsValid();
+}
+
+template <typename X, typename Y>
+bool operator||(const ptr< X >& lptr, const ptr< Y >& rptr)
+{
+	return lptr.IsValid() || rptr.IsValid();
+}
+
+template <typename X>
+bool operator||(const ptr< X >& lptr, bool rval)
+{
+	return lptr.IsValid() || rval;
+}
+
+template <typename X>
+bool operator||(bool lval, const ptr< X >& rptr)
+{
+	return lval || rptr.IsValid(); 
+}
+
+template <typename X>
+bool operator!(const ptr< X >& p)
+{
+	return (!p.IsValid());
+}
+
+
+/* less than comparisons for storage in containers */
+template <typename X, typename Y>
+bool operator< (const ptr< X >& lptr, const ptr < Y >& rptr)
+{
+	return lptr.GetRawPointer() < rptr.GetRawPointer();
+}
+
+template <typename X, typename Y>
+bool operator< (const ptr< X >& lptr, Y* raw)
+{
+	return lptr.GetRawPointer() < raw;
+}
+
+template <typename X, typename Y>
+bool operator< (X* raw, const ptr< Y >& rptr)
+{
+	return raw < rptr.GetRawPointer();
+}
+
+} //close yasper namespace
+#endif
+