[Orxonox-commit 3280] r7971 - in code/branches/kicklib: data/gui/scripts src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Feb 26 20:13:16 CET 2011


Author: rgrieder
Date: 2011-02-26 20:13:15 +0100 (Sat, 26 Feb 2011)
New Revision: 7971

Modified:
   code/branches/kicklib/data/gui/scripts/GUITools.lua
   code/branches/kicklib/src/libraries/core/GUIManager.cc
   code/branches/kicklib/src/libraries/core/GUIManager.h
Log:
Fixed GUITools.lua for good: both CECGUI 0.6 and 0.7 seem to work. At least I haven't noticed any bogus behaviour in the Credits or in the Quest sheet.

Modified: code/branches/kicklib/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/kicklib/data/gui/scripts/GUITools.lua	2011-02-26 18:38:59 UTC (rev 7970)
+++ code/branches/kicklib/data/gui/scripts/GUITools.lua	2011-02-26 19:13:15 UTC (rev 7971)
@@ -53,11 +53,11 @@
     local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
 
     local height = 0
-    if orxonox.GUIManager:isCEGUIVersion7() then
-        height = math.floor(CEGUI.PropertyHelper.stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1
-    else
+    if ORXONOX_OLD_CEGUI then
         local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
         height = lines * window:getFont():getLineSpacing() + frameHeight
+    else
+        height = math.floor(CEGUI.PropertyHelper:stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1
     end
     return height
 end

Modified: code/branches/kicklib/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/GUIManager.cc	2011-02-26 18:38:59 UTC (rev 7970)
+++ code/branches/kicklib/src/libraries/core/GUIManager.cc	2011-02-26 19:13:15 UTC (rev 7971)
@@ -156,6 +156,7 @@
         luaState_->setDefaultResourceInfo(this->rootFileInfo_);
 #ifdef ORXONOX_OLD_CEGUI
         scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState());
+        luaState_->doString("ORXONOX_OLD_CEGUI = true");
 #else
         scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState());
 #endif

Modified: code/branches/kicklib/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/kicklib/src/libraries/core/GUIManager.h	2011-02-26 18:38:59 UTC (rev 7970)
+++ code/branches/kicklib/src/libraries/core/GUIManager.h	2011-02-26 19:13:15 UTC (rev 7971)
@@ -119,8 +119,6 @@
         static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
         static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
 
-        static bool isCEGUIVersion7(void) { return CEGUIVERSION7; } // tolua_export
-
         static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
 
     private:
@@ -155,12 +153,10 @@
 #ifdef ORXONOX_OLD_CEGUI
         CEGUI::OgreCEGUIRenderer*            guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
         CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
-        static const bool                    CEGUIVERSION7 = false;
 #else
         CEGUI::OgreRenderer*                 guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
         CEGUI::OgreResourceProvider*         resourceProvider_; //!< CEGUI's resource provider
         CEGUI::OgreImageCodec*               imageCodec_;
-        static const bool                    CEGUIVERSION7 = true;
 #endif
         LuaState*                            luaState_;         //!< LuaState, access point to the Lua engine
         CEGUI::LuaScriptModule*              scriptModule_;     //!< CEGUI's script module to use Lua




More information about the Orxonox-commit mailing list