Browse Source

Removed GuiMouseEventCtrl

The GuiMouseEventCtrl was ancient. It still used "Mouse" events that were no longer called, it didn't have support for middle mouse buttons, and it handled its own mouse locking. I rolled its extensive callbacks into the base GuiControl. I also changed the onMouseWheelUp/Down functions to return void instead of bool since nothing actually used the return value of these functions. Script callbacks from the GuiControl can return true if they consumed the event, preventing event bubbling.
Peter Robinson 3 years ago
parent
commit
2950e5b351

+ 0 - 2
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj

@@ -832,7 +832,6 @@
     <ClCompile Include="..\..\source\gui\buttons\guiRadioCtrl.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiRadioCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiDragAndDropCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiDragAndDropCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiPanelCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiPanelCtrl.cc" />
-    <ClCompile Include="..\..\source\gui\containers\guiRolloutCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiScrollCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiScrollCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiTabBookCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiTabBookCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiWindowCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiWindowCtrl.cc" />
@@ -1414,7 +1413,6 @@
     <ClInclude Include="..\..\source\gui\buttons\guiRadioCtrl.h" />
     <ClInclude Include="..\..\source\gui\buttons\guiRadioCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiDragAndDropCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiDragAndDropCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiPanelCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiPanelCtrl.h" />
-    <ClInclude Include="..\..\source\gui\containers\guiRolloutCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiScrollCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiScrollCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiTabBookCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiTabBookCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiWindowCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiWindowCtrl.h" />

+ 0 - 6
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj.filters

@@ -465,9 +465,6 @@
     <ClCompile Include="..\..\source\gui\containers\guiDragAndDropCtrl.cc">
     <ClCompile Include="..\..\source\gui\containers\guiDragAndDropCtrl.cc">
       <Filter>gui\containers</Filter>
       <Filter>gui\containers</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\source\gui\containers\guiRolloutCtrl.cc">
-      <Filter>gui\containers</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\gui\containers\guiScrollCtrl.cc">
     <ClCompile Include="..\..\source\gui\containers\guiScrollCtrl.cc">
       <Filter>gui\containers</Filter>
       <Filter>gui\containers</Filter>
     </ClCompile>
     </ClCompile>
@@ -1620,9 +1617,6 @@
     <ClInclude Include="..\..\source\gui\containers\guiDragAndDropCtrl.h">
     <ClInclude Include="..\..\source\gui\containers\guiDragAndDropCtrl.h">
       <Filter>gui\containers</Filter>
       <Filter>gui\containers</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\source\gui\containers\guiRolloutCtrl.h">
-      <Filter>gui\containers</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\gui\containers\guiScrollCtrl.h">
     <ClInclude Include="..\..\source\gui\containers\guiScrollCtrl.h">
       <Filter>gui\containers</Filter>
       <Filter>gui\containers</Filter>
     </ClInclude>
     </ClInclude>

+ 5 - 5
engine/source/2d/editorToy/EditorToySceneWindow.cc

@@ -1142,7 +1142,7 @@ void EditorToySceneWindow::onRightMouseDragged(const GuiEvent& gEvt)
 
 
 }
 }
 
 
-bool EditorToySceneWindow::onMouseWheelDown(const GuiEvent & gEvt)
+void EditorToySceneWindow::onMouseWheelDown(const GuiEvent & gEvt)
 {
 {
    // Call Parent.
    // Call Parent.
    Parent::onMouseWheelDown(gEvt);
    Parent::onMouseWheelDown(gEvt);
@@ -1150,16 +1150,16 @@ bool EditorToySceneWindow::onMouseWheelDown(const GuiEvent & gEvt)
    F32 zoom = getCameraZoom();
    F32 zoom = getCameraZoom();
 
 
    if (zoom < 0.1f)
    if (zoom < 0.1f)
-      return false;
+      return;
 
 
    F32 amt = -10 * 0.005f * zoom;
    F32 amt = -10 * 0.005f * zoom;
 
 
    setCameraZoom(zoom + amt);
    setCameraZoom(zoom + amt);
 
 
-   return true;
+   return;
 }
 }
 
 
-bool EditorToySceneWindow::onMouseWheelUp(const GuiEvent & gEvt)
+void EditorToySceneWindow::onMouseWheelUp(const GuiEvent & gEvt)
 {
 {
    // Call Parent.
    // Call Parent.
    Parent::onMouseWheelUp(gEvt);
    Parent::onMouseWheelUp(gEvt);
@@ -1170,7 +1170,7 @@ bool EditorToySceneWindow::onMouseWheelUp(const GuiEvent & gEvt)
 
 
    setCameraZoom(zoom + amt);
    setCameraZoom(zoom + amt);
 
 
-   return true;
+   return;
 }
 }
 
 
 //-----------------------------------------------------------------------
 //-----------------------------------------------------------------------

+ 2 - 2
engine/source/2d/editorToy/EditorToySceneWindow.h

@@ -134,8 +134,8 @@ public:
    void onRightMouseUp(const GuiEvent& gEvt);
    void onRightMouseUp(const GuiEvent& gEvt);
    void onRightMouseDown(const GuiEvent& gEvt);
    void onRightMouseDown(const GuiEvent& gEvt);
    void onRightMouseDragged(const GuiEvent& gEvt);
    void onRightMouseDragged(const GuiEvent& gEvt);
-   bool onMouseWheelUp(const GuiEvent &gEvt);
-   bool onMouseWheelDown(const GuiEvent &gEvt);
+   void onMouseWheelUp(const GuiEvent &gEvt);
+   void onMouseWheelDown(const GuiEvent &gEvt);
 
 
    // do something to objects
    // do something to objects
    void rotateObject(Vector2 mousePos, Vector2 origVec, F32 origAngle);
    void rotateObject(Vector2 mousePos, Vector2 origVec, F32 origAngle);

+ 4 - 10
engine/source/2d/gui/SceneWindow.cc

@@ -1532,12 +1532,12 @@ void SceneWindow::onRightMouseDragged( const GuiEvent& event )
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-bool SceneWindow::onMouseWheelUp( const GuiEvent& event )
+void SceneWindow::onMouseWheelUp( const GuiEvent& event )
 {
 {
 	if (mShowScrollBar && ((mMouseWheelScrolls && !(event.modifier & SI_SHIFT)) || (!mMouseWheelScrolls && (event.modifier & SI_SHIFT))))
 	if (mShowScrollBar && ((mMouseWheelScrolls && !(event.modifier & SI_SHIFT)) || (!mMouseWheelScrolls && (event.modifier & SI_SHIFT))))
 	{
 	{
 		mScrollBar->onMouseWheelUp(event);
 		mScrollBar->onMouseWheelUp(event);
-		return true;
+		return;
 	}
 	}
 
 
    // Call Parent.
    // Call Parent.
@@ -1545,19 +1545,16 @@ bool SceneWindow::onMouseWheelUp( const GuiEvent& event )
 
 
    // Dispatch input event.
    // Dispatch input event.
    dispatchInputEvent(mouseEventWheelUpName, event);
    dispatchInputEvent(mouseEventWheelUpName, event);
-
-   // Return Success.
-   return true;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-bool SceneWindow::onMouseWheelDown( const GuiEvent& event )
+void SceneWindow::onMouseWheelDown( const GuiEvent& event )
 {
 {
 	if (mShowScrollBar && ((mMouseWheelScrolls && !(event.modifier & SI_SHIFT)) || (!mMouseWheelScrolls && (event.modifier & SI_SHIFT))))
 	if (mShowScrollBar && ((mMouseWheelScrolls && !(event.modifier & SI_SHIFT)) || (!mMouseWheelScrolls && (event.modifier & SI_SHIFT))))
 	{
 	{
 		mScrollBar->onMouseWheelDown(event);
 		mScrollBar->onMouseWheelDown(event);
-		return true;
+		return;
 	}
 	}
 
 
    // Call Parent.
    // Call Parent.
@@ -1565,9 +1562,6 @@ bool SceneWindow::onMouseWheelDown( const GuiEvent& event )
 
 
    // Dispatch input event.
    // Dispatch input event.
    dispatchInputEvent(mouseEventWheelDownName, event);
    dispatchInputEvent(mouseEventWheelDownName, event);
-
-   // Return Success.
-   return true;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+ 2 - 2
engine/source/2d/gui/SceneWindow.h

@@ -339,8 +339,8 @@ public:
     virtual void onRightMouseUp( const GuiEvent& event );
     virtual void onRightMouseUp( const GuiEvent& event );
     virtual void onRightMouseDragged( const GuiEvent& event );
     virtual void onRightMouseDragged( const GuiEvent& event );
 
 
-    virtual bool onMouseWheelDown( const GuiEvent &event );
-    virtual bool onMouseWheelUp( const GuiEvent &event );
+    virtual void onMouseWheelDown( const GuiEvent &event );
+    virtual void onMouseWheelUp( const GuiEvent &event );
 
 
 	void setUseConstantThumbHeight(const bool setting);
 	void setUseConstantThumbHeight(const bool setting);
 	void setScrollBarThickness(const S32 thickness);
 	void setScrollBarThickness(const S32 thickness);

+ 0 - 406
engine/source/gui/containers/guiRolloutCtrl.cc

@@ -1,406 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#include "gui/containers/guiRolloutCtrl.h"
-#include "gui/containers/guiScrollCtrl.h"
-
-//////////////////////////////////////////////////////////////////////////
-// GuiRolloutCtrl
-//////////////////////////////////////////////////////////////////////////
-IMPLEMENT_CONOBJECT(GuiRolloutCtrl);
-
-GuiRolloutCtrl::GuiRolloutCtrl()
-{
-   mBounds.set(0,0,200,20);
-   mExpanded.set(0,0,200,60);
-   mCaption             = StringTable->EmptyString;
-   mIsExpanded          = true;
-   mIsAnimating         = false;
-   mCollapsing          = false;
-   mAnimateDestHeight   = 40;
-   mAnimateStep         = 1;
-   mCanSave             = false;
-   mDefaultHeight       = 40;
-   mMargin.set( 2,2 );
-   mIsContainer = true;
-
-   mCanCollapse = true;
-   // Make sure we receive our ticks.
-   setProcessTicks();
-}
-
-GuiRolloutCtrl::~GuiRolloutCtrl()
-{
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Persistence 
-//////////////////////////////////////////////////////////////////////////
-void GuiRolloutCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-
-   //addField("Caption", TypeCaseString, Offset(mCaption, GuiRolloutCtrl));
-   //addField("Margin", TypePoint2I, Offset(mMargin, GuiRolloutCtrl));
-   //addField("DefaultHeight", TypeS32, Offset(mDefaultHeight, GuiRolloutCtrl));
-   //addProtectedField( "Collapsed", TypeBool, Offset( mIsExpanded, GuiRolloutCtrl), &setCollapsed, &defaultProtectedGetFn, "" );
-   //addField("ClickCollapse", TypeBool, Offset(mCanCollapse, GuiRolloutCtrl));
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Scene Events
-//////////////////////////////////////////////////////////////////////////
-bool GuiRolloutCtrl::onAdd()
-{
-   if( !Parent::onAdd() )
-      return false;
-
-   mHasTexture = ( mProfile ? mProfile->constructBitmapArray() : false );
-   if( mHasTexture )
-      mBitmapBounds = mProfile->mBitmapArrayRects.address();
-
-   // Calculate Heights for this control
-   calculateHeights();
-
-   return true;
-}
-
-bool GuiRolloutCtrl::onWake()
-{
-   if (! Parent::onWake())
-      return false;
-
-   if( !mIsAnimating && mIsExpanded )
-      sizeToContents();
-
-   return true;
-}
-
-void GuiRolloutCtrl::addObject( SimObject *obj )
-{
-   // Call Parent.
-   Parent::addObject( obj );
-
-   sizeToContents();
-}
-
-void GuiRolloutCtrl::removeObject( SimObject *obj )
-{
-   // Call Parent.
-   Parent::removeObject( obj );
-
-   // Recalculate our rectangles.
-   calculateHeights();
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Mouse Events
-//////////////////////////////////////////////////////////////////////////
-void GuiRolloutCtrl::onTouchDown( const GuiEvent &event )
-{
-   mouseLock();
-}
-
-void GuiRolloutCtrl::onTouchUp( const GuiEvent &event )
-{
-   Point2I localPoint = globalToLocalCoord( event.mousePoint );
-   if( mCanCollapse && mHeader.pointInRect( localPoint ) && !mIsAnimating && isMouseLocked() )
-   {
-      if( !mIsExpanded )
-         animateTo( mExpanded.extent.y );
-      else
-         animateTo( mHeader.extent.y );      
-   }
-
-   if( isMouseLocked() )
-      mouseUnlock();
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Control Sizing Helpers
-//////////////////////////////////////////////////////////////////////////
-void GuiRolloutCtrl::calculateHeights()
-{
-   S32 barHeight = 20;
-
-   if( mHasTexture && mProfile->mBitmapArrayRects.size() >= NumBitmaps )
-   {
-      // Store Header Rectangle
-      mHeader.set( 0, 0, mBounds.extent.x, mProfile->mBitmapArrayRects[ CollapsedCenter ].extent.y );
-
-      // Bottom Bar Max
-      barHeight = mProfile->mBitmapArrayRects[ BottomLeftHeader ].extent.y 
-                + mProfile->mBitmapArrayRects[ TopLeftHeader ].extent.y;
-   }
-   else
-   {
-      mHeader.set( 0, 0, mBounds.extent.x, barHeight );
-   }
-
-   GuiControl *content = dynamic_cast<GuiControl*>( at(0) );
-   if( content != NULL )
-      mExpanded.set( 0, 0, mBounds.extent.x , barHeight + content->getHeight() + (mMargin.y * 2) );
-   else
-      mExpanded.set( 0, 0, mBounds.extent.x, barHeight + mDefaultHeight );
-}
-
-
-
-void GuiRolloutCtrl::resize( const Point2I &newPosition, const Point2I &newExtent )
-{
-   Parent::resize( newPosition, newExtent );
-
-   // Recalculate Heights and resize ourself appropriately.
-   calculateHeights();
-
-   GuiControl *content = dynamic_cast<GuiControl*>( at(0) );
-   // Size Content Properly?!
-   if( content != NULL )
-   {
-      mChildRect.set( mMargin.x, mHeader.extent.y + mMargin.y , mBounds.extent.x - (mMargin.x * 2), content->mBounds.extent.y - ( mMargin.y * 2 ) );
-      content->resize( mChildRect.point, mChildRect.extent );
-   }
-}
-
-
-void GuiRolloutCtrl::sizeToContents()
-{
-   calculateHeights();
-
-   // Set destination height
-   if( size() > 0 )
-      instantExpand();
-   else
-      instantCollapse();
-}
-
-void GuiRolloutCtrl::instantExpand()
-{
-   mAnimateDestHeight = mExpanded.extent.y;
-   mCollapsing = false;
-   mIsExpanded = true;
-   mIsAnimating = false;
-   resize( mBounds.point + mExpanded.point, mExpanded.extent );
-}
-
-void GuiRolloutCtrl::instantCollapse()
-{
-   mAnimateDestHeight = mHeader.extent.y;
-   mCollapsing = false;
-   mIsExpanded = false;
-   mIsAnimating = false;
-   resize( mBounds.point + mHeader.point, mHeader.extent );
-}
-
-void GuiRolloutCtrl::childResized(GuiControl *child)
-{
-   Parent::childResized( child );
-
-   calculateHeights();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// Control Sizing Animation Functions
-//////////////////////////////////////////////////////////////////////////
-void GuiRolloutCtrl::animateTo( S32 height )
-{
-   // We do nothing if we're already animating
-   if( mIsAnimating )
-      return;
-
-   bool collapsing = (bool)( mBounds.extent.y > height );
-
-   // If we're already at the destination height, bail
-   if( mBounds.extent.y >= height && !collapsing )
-   {
-      mIsExpanded = true;
-      return;
-   }
-
-   // If we're already at the destination height, bail
-   if( mBounds.extent.y <= height && collapsing )
-   {
-      mIsExpanded = false;
-      return;
-   }
-
-   // Set destination height
-   mAnimateDestHeight = height;
-
-   // Set Animation Mode
-   mCollapsing = collapsing;
-
-   // Set Animation Step (Increment)
-   if( collapsing )
-      mAnimateStep = (S32)mFloor( (F32)( mBounds.extent.y - height ) / 2.0f );
-   else
-      mAnimateStep = (S32)mFloor( (F32)( height - mBounds.extent.y ) / 2.0f );
-
-   // Start our animation
-   mIsAnimating = true;
-
-}
-
-void GuiRolloutCtrl::processTick()
-{
-   // We do nothing here if we're NOT animating
-   if( !mIsAnimating )
-      return;
-
-   // Sanity check to fix non collapsing panels.
-   if( mAnimateStep == 0 )
-      mAnimateStep = 1;
-
-   // We're collapsing ourself down (Hiding our contents)
-   if( mCollapsing )
-   {
-      if( mBounds.extent.y < mAnimateDestHeight )
-         mBounds.extent.y = mAnimateDestHeight;
-      else if( ( mBounds.extent.y - mAnimateStep ) < mAnimateDestHeight )
-         mBounds.extent.y = mAnimateDestHeight;
-
-      if( mBounds.extent.y == mAnimateDestHeight )
-         mIsAnimating = false;
-      else
-         mBounds.extent.y -= mAnimateStep;
-
-      if( !mIsAnimating )
-         mIsExpanded = false;
-   }
-   else // We're expanding ourself (Showing our contents)
-   {
-      if( mBounds.extent.y > mAnimateDestHeight )
-         mBounds.extent.y = mAnimateDestHeight;
-      else if( ( mBounds.extent.y + mAnimateStep ) > mAnimateDestHeight )
-         mBounds.extent.y = mAnimateDestHeight;
-
-      if( mBounds.extent.y == mAnimateDestHeight )
-         mIsAnimating = false;
-      else
-         mBounds.extent.y += mAnimateStep;
-
-      if( !mIsAnimating )
-         mIsExpanded = true;
-   }
-
-   if( !mIsAnimating )
-   {
-      if( mCollapsing && isMethod("onCollapsed") )
-         Con::executef( this, 2, "onCollapsed" );
-      else if( !mCollapsing && isMethod("onExpanded") )
-         Con::executef( this, 2, "onExpanded" );
-
-      calculateHeights();
-   }
-
-   GuiControl* parent = getParent();
-   if( parent )
-   {
-      parent->childResized( this );
-      // if our parent's parent is a scroll control, scrollvisible.
-      GuiScrollCtrl* scroll = dynamic_cast<GuiScrollCtrl*>(parent->getParent());
-      if(scroll)
-      {
-         scroll->scrollRectVisible(mBounds);
-      }
-   }
-}
-
-//////////////////////////////////////////////////////////////////////////
-// Control Rendering
-//////////////////////////////////////////////////////////////////////////
-void GuiRolloutCtrl::onRender(Point2I offset, const RectI &updateRect)
-{
-   if( !mProfile || !mProfile->getFont(mFontSizeAdjust) )
-      return;
-  
-   // Calculate actual world bounds for rendering
-   RectI worldBounds( offset, mBounds.extent );
-
-   if( mProfile->mBitmapArrayRects.size() >= NumBitmaps )
-   {
-      //dglClearBitmapModulation();
-
-      // Draw Rollout From Skin
-      if( !mIsExpanded )
-         renderFixedBitmapBordersFilled( worldBounds, 1, mProfile );
-      //else// Draw Border
-         //renderSizableBitmapBordersFilledIndex( worldBounds, TopLeftHeader, mProfile );
-
-      // Draw Caption ( Vertically Centered )
-      ColorI currColor;
-      //dglGetBitmapModulation( &currColor );
-      Point2I textPosition = mHeader.point + offset + mProfile->mTextOffset;
-      //dglSetBitmapModulation( mProfile->mFontColor );
-      renderText( textPosition, mHeader.extent, mCaption, mProfile);
-      //dglSetBitmapModulation( currColor );
-
-      // If we're collapsed we contain the first child as our content
-      // thus we don't render it when collapsed.  but to support modified
-      // rollouts with custom header buttons etc we still render our other
-      // children. -JDD
-      GuiControl *pChild = dynamic_cast<GuiControl*>( at(0) );
-      if(pChild)
-      {
-         if( !mIsExpanded && pChild->isVisible() )
-            pChild->setVisible( false );
-         else if( mIsExpanded && !pChild->isVisible())
-            pChild->setVisible( true );
-      }
-      renderChildControls(offset, mBounds, updateRect);
-   }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// Console
-//////////////////////////////////////////////////////////////////////////
-ConsoleMethod( GuiRolloutCtrl, isExpanded, bool, 2, 2, "() @return Returns true if object is expanded, false otherwise")
-{
-   return object->isExpanded();
-}
-
-ConsoleMethod( GuiRolloutCtrl, collapse, void, 2, 2, "() Collapses control.\n @return No return value.")
-{
-   object->collapse();
-}
-
-ConsoleMethod( GuiRolloutCtrl, expand, void, 2, 2, "() Expands control\n @return No return value.")
-{
-   object->expand();
-}
-
-ConsoleMethod( GuiRolloutCtrl, instantCollapse, void, 2, 2, "() Collapses control without animation.\n @return No return value.")
-{
-   object->instantCollapse();
-}
-
-ConsoleMethod( GuiRolloutCtrl, instantExpand, void, 2, 2, "() Expands control without animation.\n @return No return value.")
-{
-   object->instantExpand();
-}
-
-ConsoleMethod( GuiRolloutCtrl, sizeToContents, void, 2, 2, "() Resizes control to fit its contents\n @return No return value.")
-{
-   object->sizeToContents();
-}

+ 0 - 127
engine/source/gui/containers/guiRolloutCtrl.h

@@ -1,127 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-#ifndef _GUI_ROLLOUTCTRL_H_
-#define _GUI_ROLLOUTCTRL_H_
-
-#ifndef _GUICONTROL_H_
-#include "gui/guiControl.h"
-#endif
-
-#ifndef _H_GUIDEFAULTCONTROLRENDER_
-#include "gui/guiDefaultControlRender.h"
-#endif
-
-class GuiRolloutCtrl : public GuiControl
-{
-private:
-   typedef GuiControl Parent;
-public:
-   // Members
-   StringTableEntry       mCaption;
-   RectI                  mHeader;
-   RectI                  mExpanded;
-   RectI                  mChildRect;
-   Point2I                mMargin;
-   bool                   mIsExpanded;
-   bool                   mIsAnimating;
-   bool                   mCollapsing;
-   S32                    mAnimateDestHeight;
-   S32                    mAnimateStep;
-   S32                    mDefaultHeight;
-   bool                   mCanCollapse;
-
-   GuiCursor*  mDefaultCursor;
-   GuiCursor*  mVertSizingCursor;
-
-
-   // Theme Support
-   enum
-   {
-      CollapsedLeft = 0,
-      CollapsedCenter,
-      CollapsedRight,
-      TopLeftHeader,
-      TopMidHeader,      
-      TopRightHeader,  
-      MidPageLeft,
-      MidPageCenter,
-      MidPageRight,
-      BottomLeftHeader, 
-      BottomMidHeader,   
-      BottomRightHeader,   
-      NumBitmaps           ///< Number of bitmaps in this array
-   };
-   bool  mHasTexture;   ///< Indicates whether we have a texture to render the tabs with
-   RectI *mBitmapBounds;///< Array of rectangles identifying textures for tab book
-
-   // Constructor/Destructor/Conobject Declaration
-   GuiRolloutCtrl();
-   ~GuiRolloutCtrl();
-   DECLARE_CONOBJECT(GuiRolloutCtrl);
-
-   // Persistence
-   static void initPersistFields();
-
-   // Control Events
-   bool onWake();
-   void addObject(SimObject *obj);
-   void removeObject(SimObject *obj);
-   virtual void childResized(GuiControl *child);
-
-   // Mouse Events
-   virtual void onTouchDown( const GuiEvent &event );
-   virtual void onTouchUp( const GuiEvent &event );
-
-   // Sizing Helpers
-   virtual void calculateHeights();
-   void resize( const Point2I &newPosition, const Point2I &newExtent );
-   virtual void sizeToContents();
-   inline bool isExpanded(){ return mIsExpanded; };
-
-   // Sizing Animation Functions
-   void animateTo( S32 height );
-   virtual void processTick();
-
-
-   void collapse() { animateTo( mHeader.extent.y ); };
-   void expand() { animateTo( mExpanded.extent.y ); };
-   void instantCollapse();
-   void instantExpand();
-
-   // Property - "Collapsed"
-   static bool setCollapsed(void* obj, const char* data)  
-   { 
-      bool bCollapsed = dAtob( data );
-      if( bCollapsed )
-         static_cast<GuiRolloutCtrl*>(obj)->instantCollapse();
-      else
-         static_cast<GuiRolloutCtrl*>(obj)->instantExpand();
-      return false; 
-   };
-
-
-   // Control Rendering
-   virtual void onRender(Point2I offset, const RectI &updateRect);
-   bool onAdd();
-
-};
-#endif

+ 6 - 10
engine/source/gui/containers/guiScrollCtrl.cc

@@ -735,10 +735,10 @@ void GuiScrollCtrl::onTouchDragged(const GuiEvent &event)
    }
    }
 }
 }
 
 
-bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
+void GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
 {
 {
    if ( !mAwake || !mVisible )
    if ( !mAwake || !mVisible )
-      return( false );
+      return;
 
 
    Point2I previousPos = mScrollOffset;
    Point2I previousPos = mScrollOffset;
    scrollByRegion((event.modifier & SI_CTRL) ? UpPage : UpArrow);
    scrollByRegion((event.modifier & SI_CTRL) ? UpPage : UpArrow);
@@ -754,15 +754,13 @@ bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
    // If no scrolling happened (already at the top), pass it on to the parent.
    // If no scrolling happened (already at the top), pass it on to the parent.
    GuiControl* parent = getParent();
    GuiControl* parent = getParent();
    if (parent && (previousPos == mScrollOffset))
    if (parent && (previousPos == mScrollOffset))
-      return parent->onMouseWheelUp(event);
-
-   return true;
+      parent->onMouseWheelUp(event);
 }
 }
 
 
-bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
+void GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
 {
 {
    if ( !mAwake || !mVisible )
    if ( !mAwake || !mVisible )
-      return( false );
+      return;
 
 
    Point2I previousPos = mScrollOffset;
    Point2I previousPos = mScrollOffset;
    scrollByRegion((event.modifier & SI_CTRL) ? DownPage : DownArrow);
    scrollByRegion((event.modifier & SI_CTRL) ? DownPage : DownArrow);
@@ -778,9 +776,7 @@ bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
    // If no scrolling happened (already at the bottom), pass it on to the parent.
    // If no scrolling happened (already at the bottom), pass it on to the parent.
    GuiControl* parent = getParent();
    GuiControl* parent = getParent();
    if (parent && (previousPos == mScrollOffset))
    if (parent && (previousPos == mScrollOffset))
-      return parent->onMouseWheelDown(event);
-
-   return true;
+      parent->onMouseWheelDown(event);
 }
 }
 #pragma endregion
 #pragma endregion
 
 

+ 2 - 2
engine/source/gui/containers/guiScrollCtrl.h

@@ -155,8 +155,8 @@ public:
    virtual void onTouchUp(const GuiEvent &event);
    virtual void onTouchUp(const GuiEvent &event);
    virtual void onTouchDragged(const GuiEvent &event);
    virtual void onTouchDragged(const GuiEvent &event);
    virtual void onTouchLeave(const GuiEvent &event);
    virtual void onTouchLeave(const GuiEvent &event);
-   virtual bool onMouseWheelUp(const GuiEvent &event);
-   virtual bool onMouseWheelDown(const GuiEvent &event);
+   virtual void onMouseWheelUp(const GuiEvent &event);
+   virtual void onMouseWheelDown(const GuiEvent &event);
 
 
    virtual bool onWake();
    virtual bool onWake();
    virtual void onSleep();
    virtual void onSleep();

+ 72 - 22
engine/source/gui/guiControl.cc

@@ -1342,6 +1342,20 @@ void GuiControl::mouseUnlock()
       root->mouseUnlock(this);
       root->mouseUnlock(this);
 }
 }
 
 
+bool GuiControl::sendScriptEvent(const char* name, const GuiEvent& event)
+{
+    bool consumed = false;
+    if (isMethod(name))
+    {
+        char buf[3][32];
+        dSprintf(buf[0], 32, "%d", event.modifier);
+        dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
+        dSprintf(buf[2], 32, "%d", event.mouseClickCount);
+        consumed = dAtob(Con::executef(this, 4, name, buf[0], buf[1], buf[2]));
+    }
+    return consumed;
+}
+
 bool GuiControl::onInputEvent(const InputEvent &event)
 bool GuiControl::onInputEvent(const InputEvent &event)
 {
 {
     // Do nothing by default...
     // Do nothing by default...
@@ -1353,8 +1367,11 @@ void GuiControl::onTouchUp(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed1 = sendScriptEvent("onTouchUp", event);
+    bool consumed2 = sendScriptEvent("onMouseUp", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed1 && !consumed2)
         parent->onTouchUp(event);
         parent->onTouchUp(event);
 }
 }
 
 
@@ -1363,8 +1380,11 @@ void GuiControl::onTouchDown(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed1 = sendScriptEvent("onTouchDown", event);
+    bool consumed2 = sendScriptEvent("onMouseDown", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed1 && !consumed2)
         parent->onTouchDown(event);
         parent->onTouchDown(event);
 }
 }
 
 
@@ -1373,8 +1393,11 @@ void GuiControl::onTouchMove(const GuiEvent &event)
    if ( !mVisible || !mAwake )
    if ( !mVisible || !mAwake )
       return;
       return;
 
 
+   bool consumed1 = sendScriptEvent("onTouchMove", event);
+   bool consumed2 = sendScriptEvent("onMouseMove", event);
+
    GuiControl *parent = getParent();
    GuiControl *parent = getParent();
-   if ( parent )
+   if (parent && !consumed1 && !consumed2)
       parent->onTouchMove( event );
       parent->onTouchMove( event );
 }
 }
 
 
@@ -1383,43 +1406,58 @@ void GuiControl::onTouchDragged(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed1 = sendScriptEvent("onTouchDragged", event);
+    bool consumed2 = sendScriptEvent("onMouseDragged", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed1 && !consumed2)
         parent->onTouchDragged(event);
         parent->onTouchDragged(event);
 }
 }
 
 
 void GuiControl::onTouchEnter(const GuiEvent &event)
 void GuiControl::onTouchEnter(const GuiEvent &event)
 {
 {
+    if (!mVisible || !mAwake)
+        return;
+
+    sendScriptEvent("onTouchEnter", event);
+    sendScriptEvent("onMouseEnter", event);
+
     //Entering a child means nothing to a parent
     //Entering a child means nothing to a parent
 }
 }
 
 
 void GuiControl::onTouchLeave(const GuiEvent &event)
 void GuiControl::onTouchLeave(const GuiEvent &event)
 {
 {
+    if (!mVisible || !mAwake)
+        return;
+
+    sendScriptEvent("onTouchLeave", event);
+    sendScriptEvent("onMouseLeave", event);
+
     //Leaving a child means nothing to a parent
     //Leaving a child means nothing to a parent
 }
 }
 
 
-bool GuiControl::onMouseWheelUp( const GuiEvent &event )
+void GuiControl::onMouseWheelUp( const GuiEvent &event )
 {
 {
    if ( !mVisible || !mAwake )
    if ( !mVisible || !mAwake )
-      return true;
+      return;
+
+   bool consumed = sendScriptEvent("onMouseWheelUp", event);
 
 
    GuiControl *parent = getParent();
    GuiControl *parent = getParent();
-   if ( parent )
-      return parent->onMouseWheelUp( event );
-   else
-      return false;
+   if (parent && !consumed)
+      return parent->onMouseWheelUp(event);
 }
 }
 
 
-bool GuiControl::onMouseWheelDown( const GuiEvent &event )
+void GuiControl::onMouseWheelDown( const GuiEvent &event )
 {
 {
    if ( !mVisible || !mAwake )
    if ( !mVisible || !mAwake )
-      return true;
+      return;
+
+   bool consumed = sendScriptEvent("onMouseWheelDown", event);
 
 
    GuiControl *parent = getParent();
    GuiControl *parent = getParent();
-   if ( parent )
-      return parent->onMouseWheelDown( event );
-   else
-      return false;
+   if (parent && !consumed)
+      return parent->onMouseWheelDown(event);
 }
 }
 
 
 void GuiControl::onRightMouseDown(const GuiEvent &event)
 void GuiControl::onRightMouseDown(const GuiEvent &event)
@@ -1427,8 +1465,10 @@ void GuiControl::onRightMouseDown(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onRightMouseDown", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onRightMouseDown(event);
         parent->onRightMouseDown(event);
 }
 }
 
 
@@ -1437,8 +1477,10 @@ void GuiControl::onRightMouseUp(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onRightMouseUp", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onRightMouseUp(event);
         parent->onRightMouseUp(event);
 }
 }
 
 
@@ -1447,8 +1489,10 @@ void GuiControl::onRightMouseDragged(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onRightMouseDragged", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onRightMouseDragged(event);
         parent->onRightMouseDragged(event);
 }
 }
 
 
@@ -1457,8 +1501,10 @@ void GuiControl::onMiddleMouseDown(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onMiddleMouseDown", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onMiddleMouseDown(event);
         parent->onMiddleMouseDown(event);
 }
 }
 
 
@@ -1467,8 +1513,10 @@ void GuiControl::onMiddleMouseUp(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onMiddleMouseUp", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onMiddleMouseUp(event);
         parent->onMiddleMouseUp(event);
 }
 }
 
 
@@ -1477,8 +1525,10 @@ void GuiControl::onMiddleMouseDragged(const GuiEvent &event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return;
         return;
 
 
+    bool consumed = sendScriptEvent("onMiddleMouseDragged", event);
+
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
-    if (parent)
+    if (parent && !consumed)
         parent->onMiddleMouseDragged(event);
         parent->onMiddleMouseDragged(event);
 }
 }
 
 

+ 4 - 2
engine/source/gui/guiControl.h

@@ -550,6 +550,8 @@ public:
     virtual bool isMouseLocked();
     virtual bool isMouseLocked();
     /// @}
     /// @}
 
 
+    //Sends a script event with modifier and mouse position if the script method exists. Returns true if the event is consumed.
+    bool sendScriptEvent(const char* name, const GuiEvent& event);
 
 
     /// General input handler.
     /// General input handler.
     virtual bool onInputEvent(const InputEvent &event);
     virtual bool onInputEvent(const InputEvent &event);
@@ -565,8 +567,8 @@ public:
     virtual void onTouchEnter(const GuiEvent &event);
     virtual void onTouchEnter(const GuiEvent &event);
     virtual void onTouchLeave(const GuiEvent &event);
     virtual void onTouchLeave(const GuiEvent &event);
 
 
-    virtual bool onMouseWheelUp(const GuiEvent &event);
-    virtual bool onMouseWheelDown(const GuiEvent &event);
+    virtual void onMouseWheelUp(const GuiEvent &event);
+    virtual void onMouseWheelDown(const GuiEvent &event);
 
 
     virtual void onRightMouseDown(const GuiEvent &event);
     virtual void onRightMouseDown(const GuiEvent &event);
     virtual void onRightMouseUp(const GuiEvent &event);
     virtual void onRightMouseUp(const GuiEvent &event);

+ 0 - 2166
engine/source/gui/guiMLTextCtrl.cc

@@ -1,2166 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#include "gui/guiMLTextCtrl.h"
-#include "gui/containers/guiScrollCtrl.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "gui/guiCanvas.h"
-#include "memory/frameAllocator.h"
-#include "string/unicode.h"
-
-IMPLEMENT_CONOBJECT(GuiMLTextCtrl);
-
-const U32 GuiMLTextCtrl::csmTextBufferGrowthSize = 1024;
-
-ConsoleMethod( GuiMLTextCtrl, setText, void, 3, 3,  "(text) Use the setText method to change the current text content of the control to text. This replaces all old content.\n"
-                                                                "@param text The new contents for this control.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa addText, getText")
-{
-   object->setText(argv[2], dStrlen(argv[2]));
-}
-
-ConsoleMethod( GuiMLTextCtrl, getText, const char*, 2, 2, "() Use the getText method to return the current text contents of the control, including all formatting characters.\n"
-                                                                "@return Returns the entire text contents of the control or indicating no contents.\n"
-                                                                "@sa addText")
-{
-   return( object->getTextContent() );
-}
-
-ConsoleMethod( GuiMLTextCtrl, addText, void, 4, 4, "( text , reformat ) Use the addText method to add new text to the control. You may optionally request that the control be reformatted.\n"
-                                                                "@param text Text to add to control.\n"
-                                                                "@param reformat A boolean value that when set to true forces the control to re-evaluate the entire contents and to redisplay it.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa getText, setText, forceReflow")
-{
-   object->addText(argv[2], dStrlen(argv[2]), dAtob(argv[3]));
-}
-
-ConsoleMethod( GuiMLTextCtrl, setCursorPosition, bool, 3, 3, "(newPos) Use the setCursorPosition method to offset the cursor by newPos characters into the current text contents of the control.\n"
-                                                                "@param newPos An integer value indicating the character position at which to place the cursor.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa scrollToTag, scrollToTop")
-{
-   return object->setCursorPosition(dAtoi(argv[2]));
-}
-
-ConsoleMethod( GuiMLTextCtrl, scrollToTag, void, 3, 3, "( tagID ) Use the scrollToTag method to scroll to the first instance of a tag if it exists.\n"
-                                                                "@param tagID A tag number to search for. These tags are specified by embedding TorqueML <tag:tag_number> entries in text.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa scrollToTop, setCursorPosition")
-{
-   object->scrollToTag( dAtoi( argv[2] ) );
-}
-
-ConsoleMethod( GuiMLTextCtrl, scrollToTop, void, 2, 2, "() Use the scrollToTop method to scroll to the top of the text.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa scrollToTag, setCursorPosition, scrollToBottom")
-{
-   object->scrollToTop();
-}
-
-ConsoleMethod( GuiMLTextCtrl, scrollToBottom, void, 2, 2, "() Use the scrollToBottom method to scroll to the bottom of the text.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa scrollToTag, setCursorPosition, scrollToTop")
-{
-   object->scrollToBottom();
-}
-
-ConsoleFunction( StripMLControlChars, const char*, 2, 2, "( sourceString ) Use the stripMLControlChars function to remove all Torque Markup-Language (ML) symbols from sourceString.\n"
-                                                                "This may not remove <br> correctly, so check before you trust this function.\n"
-                                                                "@param sourceString The string to be modified.\n"
-                                                                "@return Returns a copy of sourceString with all the ML symbols removed, or the original string if no ML symbols were present.\n"
-                                                                "@sa stripChars")
-{
-   return GuiMLTextCtrl::stripControlChars(argv[1]);
-}
-
-ConsoleMethod(GuiMLTextCtrl,forceReflow,void,2,2,"() Use the forceReflow method to force the text control to re-evaluate the entire contents and to redisplay it, possibly resizing the control.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa addText")
-{
-   if(!object->isAwake())
-      Con::errorf("GuiMLTextCtrl::forceReflow can only be called on visible controls.");
-   else
-      object->reflow();
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::GuiMLTextCtrl()
-{
-   mIsEditCtrl = false;
-
-   mCursorPosition     = 0;
-
-   mMaxBufferSize = -1;
-   mInitialText = StringTable->EmptyString;
-
-   mSelectionActive = false;
-   mSelectionStart  = 0;
-   mSelectionEnd    = 0;
-
-   mLineSpacingPixels = 2;
-   mAllowColorChars = false;
-   mBitmapList = 0;
-   mBitmapRefList = 0;
-   mFontList = 0;
-   mDirty = true;
-   mLineList = 0;
-   mTagList = 0;
-   mHitURL = 0;
-   mActive = true;
-   mAlpha = 1.0;
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::~GuiMLTextCtrl()
-{
-   mCursorPosition     = 0;
-
-   mSelectionActive = false;
-   mSelectionStart  = 0;
-   mSelectionEnd    = 0;
-   freeResources();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addField("lineSpacing",       TypeS32,    Offset(mLineSpacingPixels, GuiMLTextCtrl));
-   addField("allowColorChars",   TypeBool,   Offset(mAllowColorChars,   GuiMLTextCtrl));
-   addField("maxChars",          TypeS32,    Offset(mMaxBufferSize,     GuiMLTextCtrl));
-   addField("deniedSound",       TypeAudioAssetPtr, Offset(mDeniedSound, GuiMLTextCtrl));
-   addField("text",              TypeCaseString,  Offset( mInitialText, GuiMLTextCtrl ) );
-}
-
-ConsoleMethod(GuiMLTextCtrl, setAlpha, void, 3, 3, "( alpha ) Use the setAlpha method to set alpha of this control to between [0.0 , 1.0].\n"
-                                                                "@param alpha A floating point value between 0.0 and 1.0 indicating the control's new alpha setting.\n"
-                                                                "@return No return value")
-{
-   object->setAlpha(dAtof(argv[2]));
-}
-
-//--------------------------------------------------------------------------
-
-bool GuiMLTextCtrl::onAdd()
-{
-   if(!Parent::onAdd())
-      return false;
-
-   if (!mTextBuffer.length() && mInitialText[0] != 0)
-      setText(mInitialText, dStrlen(mInitialText)+1);
-   return true;
-}
-
-
-//--------------------------------------------------------------------------
-bool GuiMLTextCtrl::onWake()
-{
-   if (Parent::onWake() == false)
-      return false;
-
-   mDirty = true;
-   return true;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::onPreRender()
-{
-   if(mDirty)
-      reflow();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::drawAtomText(bool sel, U32 start, U32 end, Atom *atom, Line *line, Point2I offset)
-{
-   GFont *font = atom->style->font->fontRes;
-   U32 xOff = 0;
-   if(start != atom->textStart)
-   {
-      const UTF16* buff = mTextBuffer.getPtr() + atom->textStart;
-      xOff += font->getStrNWidth(buff, start - atom->textStart);
-   }
-
-   Point2I drawPoint(offset.x + atom->xStart + xOff, offset.y + atom->yStart);
-
-   ColorI color;
-   if(atom->url)
-   { 
-      if(atom->url->mouseDown)
-         color = atom->style->linkColorHL;
-      else
-         color = atom->style->linkColor;
-   }
-   else
-      color = atom->style->color;
-            
-   const UTF16* tmp = mTextBuffer.getPtr() + start;
-   U32 tmpLen = end-start;
-
-   if(!sel)
-   {
-      if(atom->style->shadowOffset.x || atom->style->shadowOffset.y)
-      {
-         ColorI shadowColor = atom->style->shadowColor;
-         shadowColor.alpha = (U8)(shadowColor.alpha * mAlpha);
-         dglSetBitmapModulation(shadowColor);
-
-         dglDrawTextN(font, drawPoint + atom->style->shadowOffset, tmp, tmpLen, mAllowColorChars ? mProfile->mFontColors : NULL);
-      }
-
-      color.alpha = (U8)(color.alpha * mAlpha);
-      dglSetBitmapModulation(color);
-      dglDrawTextN(font, drawPoint, tmp, end-start, mAllowColorChars ? mProfile->mFontColors : NULL);
-
-      //if the atom was "clipped", see if we need to draw a "..." at the end
-      if (atom->isClipped)
-      {
-         Point2I p2 = drawPoint;
-         p2.x += font->getStrNWidthPrecise(tmp, tmpLen);
-         dglDrawTextN(font, p2, "...", 3, mAllowColorChars ? mProfile->mFontColors : NULL);
-      }
-   }
-   else
-   {
-      RectI rect;
-      rect.point.x = drawPoint.x;
-      rect.point.y = line->y + offset.y;
-      rect.extent.x = font->getStrNWidth(tmp, tmpLen) + 1;
-      rect.extent.y = line->height + 1;
-      
-      dglDrawRectFill(rect, mProfile->mFillColorHL);
-      dglSetBitmapModulation( mProfile->mFontColorHL );  // over-ride atom color:
-      dglDrawTextN(font, drawPoint, tmp, tmpLen, mAllowColorChars ? mProfile->mFontColors : NULL);
-
-      //if the atom was "clipped", see if we need to draw a "..." at the end
-      if (atom->isClipped)
-      {
-         Point2I p2 = drawPoint;
-         p2.x += font->getStrNWidthPrecise(tmp, end - atom->textStart);
-         dglDrawTextN(font, p2, "...", 3, mAllowColorChars ? mProfile->mFontColors : NULL);
-      }
-   }
-
-   if(atom->url && !atom->url->noUnderline)
-   {
-      drawPoint.y += atom->baseLine + 2;
-      Point2I p2 = drawPoint;
-      p2.x += font->getStrNWidthPrecise(tmp, end - atom->textStart);
-      dglDrawLine(drawPoint, p2, color);
-   }
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   Parent::onRender(offset, updateRect);
-   // draw all the bitmaps
-   for(BitmapRef *walk = mBitmapRefList; walk; walk = walk->next)
-   {
-      RectI screenBounds = *walk;
-      screenBounds.point += offset;
-      if(!screenBounds.overlaps(updateRect))
-         continue;
-      dglClearBitmapModulation();
-      dglDrawBitmap(walk->bitmap->bitmapHandle, screenBounds.point);
-      //dglDrawRectFill(screenBounds, mProfile->mFillColor);
-   }
-
-   // draw all the text and dividerStyles
-   for(Line *lwalk = mLineList; lwalk; lwalk = lwalk->next)
-   {
-      RectI lineRect(offset.x, offset.y + lwalk->y, mBounds.extent.x, lwalk->height);
-
-      if(!lineRect.overlaps(updateRect))
-         continue;
-
-      if(lwalk->divStyle)
-         dglDrawRectFill(lineRect, mProfile->mFillColorHL);
-
-      for(Atom *awalk = lwalk->atomList; awalk; awalk = awalk->next)
-      {
-         if(!mSelectionActive || mSelectionEnd < awalk->textStart || mSelectionStart >= awalk->textStart + awalk->len)
-            drawAtomText(false, awalk->textStart, awalk->textStart + awalk->len, awalk, lwalk, offset);
-         else
-         {
-            U32 selectionStart = getMax(awalk->textStart, mSelectionStart);
-            U32 selectionEnd = getMin(awalk->textStart + awalk->len, mSelectionEnd + 1);
-
-            // draw some unselected text
-            if(selectionStart > awalk->textStart)
-               drawAtomText(false, awalk->textStart, selectionStart, awalk, lwalk, offset);
-
-            // draw the selection
-            drawAtomText(true, selectionStart, selectionEnd, awalk, lwalk, offset);
-
-            if(selectionEnd < awalk->textStart + awalk->len)
-               drawAtomText(false, selectionEnd, awalk->textStart + awalk->len, awalk, lwalk, offset);
-         }
-      }
-   }
-   dglClearBitmapModulation();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::freeLineBuffers()
-{
-   mViewChunker.freeBlocks();
-   mLineList = NULL;
-   mBitmapRefList = NULL;
-   mTagList = NULL;
-   mHitURL = 0;
-   mDirty = true;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::freeResources()
-{
-   for(Font* walk = mFontList; walk; walk = walk->next)
-   {
-      delete[] walk->faceName;
-      walk->fontRes = 0;
-   }
-
-   for(Bitmap* bwalk = mBitmapList; bwalk; bwalk = bwalk->next)
-      bwalk->bitmapHandle = 0;
-
-   mFontList = NULL;
-   mBitmapList = NULL;
-   mResourceChunker.freeBlocks();
-   mDirty = true;
-
-   freeLineBuffers();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::onSleep()
-{
-   freeResources();
-   Parent::onSleep();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::inspectPostApply()
-{
-   Parent::inspectPostApply();
-
-   if (mInitialText[0] != 0)
-      setText(mInitialText, dStrlen(mInitialText));
-
-   if ((S32)mLineSpacingPixels < 0)
-      mLineSpacingPixels = 0;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::resize( const Point2I& newPosition, const Point2I& newExtent )
-{
-   Parent::resize( newPosition, newExtent );
-   //Con::executef( this, 3, "onResize", Con::getIntArg( newExtent.x ), Con::getIntArg( newExtent.y ) );
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::parentResized(const Point2I& oldParentExtent,
-                                  const Point2I& newParentExtent)
-{
-   Parent::parentResized(oldParentExtent, newParentExtent);
-   mDirty = true;
-}
-
-//--------------------------------------------------------------------------
-U32 GuiMLTextCtrl::getNumChars() const
-{
-   return mTextBuffer.length();
-}
-
-//--------------------------------------------------------------------------
-U32 GuiMLTextCtrl::getText(char* pBuffer, const U32 bufferSize) const
-{
-   mTextBuffer.getCopy8(pBuffer, bufferSize);
-
-   return getMin(mTextBuffer.length(), bufferSize);
-}
-
-//--------------------------------------------------------------------------
-const char* GuiMLTextCtrl::getTextContent()
-{
-   if ( mTextBuffer.length() > 0 )
-   {
-      UTF8* returnString = Con::getReturnBuffer( mTextBuffer.getUTF8BufferSizeEstimate() );
-      mTextBuffer.getCopy8(returnString, mTextBuffer.getUTF8BufferSizeEstimate() );
-      return returnString;
-   }
-
-   return( "" );
-}
-
-//--------------------------------------------------------------------------
-const char *GuiMLTextCtrl::getScriptValue()
-{
-   return getTextContent();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::setScriptValue(const char *newText)
-{
-   setText(newText, dStrlen(newText));
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::setText(const char* textBuffer, const U32 numChars)
-{
-   U32 chars = numChars;
-   if(numChars >= (U32)mMaxBufferSize)
-      chars = mMaxBufferSize;
-
-   // leaving this usage because we StringBuffer.set((UTF8*)) cannot take a numChars arg.
-   // perhaps it should? -paxorr
-   FrameTemp<UTF8> tmp(chars+1);
-   dStrncpy(tmp, textBuffer, chars);
-   tmp[chars] = 0;
-
-   mTextBuffer.set(tmp);
-
-   //after setting text, always set the cursor to the beginning
-   setCursorPosition(0);
-   clearSelection();
-   mDirty = true;
-   scrollToTop();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::addText(const char* textBuffer, const U32 numChars, bool reformat)
-{
-   if(numChars >= (U32)mMaxBufferSize)
-      return;
-
-   FrameTemp<UTF8> tmp(numChars+1);
-   dStrncpy(tmp, textBuffer, numChars);
-   tmp[numChars] = 0;
-
-   mTextBuffer.append(tmp);
-
-   //after setting text, always set the cursor to the beginning
-   if (reformat)
-   {
-      setCursorPosition(0);
-      clearSelection();
-      mDirty = true;
-      scrollToTop();
-   }
-}
-
-//--------------------------------------------------------------------------
-bool GuiMLTextCtrl::setCursorPosition(const S32 newPosition)
-{
-   if (newPosition < 0) 
-   {
-      mCursorPosition = 0;
-      return true;
-   }
-   else if ((U32)newPosition >= mTextBuffer.length()) 
-   {
-      mCursorPosition = mTextBuffer.length();
-      return true;
-   }
-   else 
-   {
-      mCursorPosition = newPosition;
-      return false;
-   }
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::ensureCursorOnScreen()
-{
-   // If our parent isn't a scroll control, or we're not the only control
-   //  in the content region, bail...
-   GuiControl* pParent = getParent();
-    GuiScrollCtrl *sc = dynamic_cast<GuiScrollCtrl*>(pParent);
-    if(!sc)
-        return;
-
-   // Ok.  Now we know that our parent is a scroll control.  Let's find the
-   //  top of the cursor, and it's bottom.  We can then scroll the parent control
-   //  if appropriate...
-
-   Point2I cursorTopP, cursorBottomP;
-   ColorI color;
-   getCursorPositionAndColor(cursorTopP, cursorBottomP, color);
-
-    sc->scrollRectVisible(RectI(cursorTopP.x, cursorTopP.y, 1, cursorBottomP.y - cursorTopP.y));
-}
-
-//--------------------------------------
-void GuiMLTextCtrl::getCursorPositionAndColor(Point2I &cursorTop, Point2I &cursorBottom, ColorI &color)
-{
-   S32 x = 0;
-   S32 y = 0;
-   S32 height = mProfile->getFont(mFontSizeAdjust)->getHeight();
-   color = mProfile->mCursorColor;
-   for(Line *walk = mLineList; walk; walk = walk->next)
-   {
-      if ((mCursorPosition <= walk->textStart + walk->len) || (walk->next == NULL))
-      {
-         // it's in the atoms on this line...
-         y = walk->y;
-         height = walk->height;
-
-         for(Atom *awalk = walk->atomList; awalk; awalk = awalk->next)
-         {
-
-            if(mCursorPosition < awalk->textStart)
-            {
-               x = awalk->xStart;
-               goto done;
-            }
-
-            if(mCursorPosition > awalk->textStart + awalk->len)
-            {
-               x = awalk->xStart + awalk->width;
-               continue;
-            }
-
-            // it's in the text block...
-            x = awalk->xStart;
-
-            //
-            // [neo, 5/7/2007]: cannot use const as GFont::getStrNWidth() is not declared as const
-            //
-            //const GFont *font = awalk->style->font->fontRes;
-            GFont *font = awalk->style->font->fontRes;
-
-            const UTF16* buff = mTextBuffer.getPtr() + awalk->textStart;
-            x += font->getStrNWidth(buff, mCursorPosition - awalk->textStart - 1);
-
-            color = awalk->style->color;
-            goto done;
-         }
-
-         //if it's within this walk's width, but we didn't find an atom, leave the cursor at the beginning of the line...
-         goto done;
-      }
-   }
-done:
-   cursorTop.set(x, y);
-   cursorBottom.set(x, y + height);
-}
-
-//--------------------------------------------------------------------------
-// Keyboard events...
-bool GuiMLTextCtrl::onKeyDown(const GuiEvent& event)
-{
-   //only cut/copy work with this control...
-   if (event.modifier & SI_CTRL)
-   {
-      switch(event.keyCode)
-      {
-         //copy
-         case KEY_C:
-         {
-            //make sure we actually have something selected
-            if (mSelectionActive)
-            {
-               copyToClipboard(mSelectionStart, mSelectionEnd);
-               setUpdate();
-            }
-            return true;
-         }
-      }
-   }
-
-   // Otherwise, let the parent have the event...
-   return Parent::onKeyDown(event);
-}
-
-//--------------------------------------------------------------------------
-// Mousing events...
-void GuiMLTextCtrl::onMouseDown(const GuiEvent& event)
-{
-   if(!mActive)
-      return;
-
-   Atom *hitAtom = findHitAtom(globalToLocalCoord(event.mousePoint));
-   if(hitAtom && !mIsEditCtrl)
-   {
-      mouseLock();
-      mHitURL = hitAtom->url;
-      if (mHitURL)
-         mHitURL->mouseDown = true;
-   }
-
-   setFirstResponder();
-   mouseLock();
-
-   mSelectionActive = false;
-   mSelectionAnchor        = getTextPosition(globalToLocalCoord(event.mousePoint));
-   mSelectionAnchorDropped = event.mousePoint;
-   if (mSelectionAnchor < 0)
-      mSelectionAnchor = 0;
-   else if ((U32)mSelectionAnchor >= mTextBuffer.length())
-      mSelectionAnchor = mTextBuffer.length();
-
-   mVertMoveAnchorValid = false;
-
-   setUpdate();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::onMouseDragged(const GuiEvent& event)
-{
-   if (!mActive || (Canvas->getMouseLockedControl() != this))
-      return;
-
-   Atom *hitAtom = findHitAtom(globalToLocalCoord(event.mousePoint));
-   bool down = false;
-
-   //note mHitURL can't be set unless this is (!mIsEditCtrl)
-   if(hitAtom && hitAtom->url == mHitURL)
-      down = true;
-
-   if(mHitURL && down != mHitURL->mouseDown)
-      mHitURL->mouseDown = down;
-
-   if (!mHitURL)
-   {
-      S32 newSelection = 0;
-      newSelection = getTextPosition(globalToLocalCoord(event.mousePoint));
-      if (newSelection < 0)
-         newSelection = 0;
-      else if ((U32)newSelection > mTextBuffer.length())
-         newSelection = mTextBuffer.length();
-
-      if (newSelection == mSelectionAnchor) 
-      {
-         mSelectionActive = false;
-      }
-      else if (newSelection > mSelectionAnchor) 
-      {
-         mSelectionActive = true;
-         mSelectionStart  = mSelectionAnchor;
-         mSelectionEnd    = newSelection - 1;
-      }
-      else 
-      {
-         mSelectionStart  = newSelection;
-         mSelectionEnd    = mSelectionAnchor - 1;
-         mSelectionActive = true;
-      }
-      setCursorPosition(newSelection);
-      mDirty = true;
-   }
-
-   setUpdate();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::onMouseUp(const GuiEvent& event)
-{
-   if (!mActive || (Canvas->getMouseLockedControl() != this))
-      return;
-
-   mouseUnlock();
-
-   //see if we've clicked on a URL
-   Atom *hitAtom = findHitAtom(globalToLocalCoord(event.mousePoint));
-   if (mHitURL && hitAtom && hitAtom->url == mHitURL && mHitURL->mouseDown)
-   {
-      mHitURL->mouseDown = false;
-
-      // Convert URL from UTF16 to UTF8.
-      UTF8* url = mTextBuffer.createSubstring8(mHitURL->textStart, mHitURL->len);
-      Con::executef(this, 2, "onURL", url);
-      delete[] url;
-      mHitURL = NULL;
-
-      setUpdate();
-      return;
-   }
-
-   //else, update our selection
-   else
-   {
-      if ((event.mousePoint - mSelectionAnchorDropped).len() < 3)
-         mSelectionActive = false;
-
-      setCursorPosition(getTextPosition(globalToLocalCoord(event.mousePoint)));
-      mVertMoveAnchorValid = false;
-      setUpdate();
-   }
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::insertChars(const char* inputChars,
-                                const U32   numInputChars,
-                                const U32   position)
-{
-   AssertFatal(isSelectionActive() == false, "GuiMLTextCtrl::insertChars: don't use this function when there's a selection active!");
-   AssertFatal(position <= mTextBuffer.length(), "GuiMLTextCtrl::insertChars: can't insert outside of current text!");
-
-   //make sure the text will fit...
-   S32 numCharsToInsert = numInputChars;
-   if ((U32)mMaxBufferSize > 0 && mTextBuffer.length() + numInputChars + 1 > (U32)mMaxBufferSize)
-      numCharsToInsert = mMaxBufferSize - mTextBuffer.length() - 1;
-   if (numCharsToInsert <= 0)
-   {
-      // Play the "Denied" sound:
-      if ( numInputChars > 0 && mDeniedSound.notNull() )
-      {
-         AUDIOHANDLE handle = alxCreateSource( mDeniedSound );
-         alxPlay( handle );
-      }
-      return;
-   }
-
-   mTextBuffer.insert(position, inputChars );
-
-   if (mCursorPosition >= position) 
-   {
-      // Cursor was at or after the inserted text, move forward...
-      mCursorPosition += numCharsToInsert;
-   }
-
-   AssertFatal(mCursorPosition <= mTextBuffer.length(), "GuiMLTextCtrl::insertChars: bad cursor position");
-   mDirty = true;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::deleteChars(const U32 rangeStart,
-                                const U32 rangeEnd)
-{
-   AssertFatal(isSelectionActive() == false, "GuiMLTextCtrl::deleteChars: don't use this function when there's a selection active");
-   AssertFatal(rangeStart <= mTextBuffer.length() && rangeEnd <= mTextBuffer.length(),
-               avar("GuiMLTextCtrl::deleteChars: can't delete outside of current text (%d, %d, %d)",
-                    rangeStart, rangeEnd, mTextBuffer.length()));
-   AssertFatal(rangeStart <= rangeEnd, "GuiMLTextCtrl::deleteChars: invalid delete range");
-
-   // Currently deleting text doesn't resize the text buffer, perhaps this should
-   //  change?
-   mTextBuffer.cut(rangeStart, rangeEnd - rangeStart);
-
-   if (mCursorPosition <= rangeStart) 
-   {
-      // Cursor placed before deleted text, ignore
-   }
-   else if (mCursorPosition > rangeStart && mCursorPosition <= rangeEnd) 
-   {
-      // Cursor inside deleted text, set to start of range
-      mCursorPosition = rangeStart;
-   }
-   else 
-   {
-      // Cursor after deleted text, decrement by number of chars deleted
-      mCursorPosition -= (rangeEnd - rangeStart) + 1;
-   }
-
-   AssertFatal(mCursorPosition <= mTextBuffer.length(), "GuiMLTextCtrl::deleteChars: bad cursor position");
-   mDirty = true;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::copyToClipboard(const U32 rangeStart, const U32 rangeEnd)
-{
-   AssertFatal(rangeStart < mTextBuffer.length() && rangeEnd < mTextBuffer.length(),
-               avar("GuiMLTextCtrl::copyToClipboard: can't copy outside of current text (%d, %d, %d)",
-                    rangeStart, rangeEnd, mTextBuffer.length()));
-   AssertFatal(rangeStart <= rangeEnd, "GuiMLTextCtrl::copyToClipboard: invalid copy range");
-
-   //copy the selection to the clipboard
-
-   UTF8* selection = mTextBuffer.createSubstring8(rangeStart, rangeEnd-rangeStart);
-   Platform::setClipboard(selection);
-   delete[] selection;
-}
-
-//--------------------------------------------------------------------------
-bool GuiMLTextCtrl::isSelectionActive() const
-{
-   return mSelectionActive;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::clearSelection()
-{
-   mSelectionActive = false;
-   mSelectionStart  = 0;
-   mSelectionEnd    = 0;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::scrollToTag( U32 id )
-{
-   // If the parent control is not a GuiScrollContentCtrl, then this call is invalid:
-   GuiScrollCtrl *pappy = dynamic_cast<GuiScrollCtrl*>(getParent());
-   if ( !pappy )
-      return;
-
-   // Find the indicated tag:
-   LineTag* tag = NULL;
-   for ( tag = mTagList; tag; tag = tag->next )
-   {
-      if ( tag->id == id )
-         break;
-   }
-
-   if ( !tag )
-   {
-      Con::warnf( ConsoleLogEntry::General, "GuiMLTextCtrl::scrollToTag - tag id %d not found!", id );
-      return;
-   }
-    pappy->scrollRectVisible(RectI(0, tag->y, 1, 1));
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::scrollToTop()
-{
-   // If the parent control is not a GuiScrollContentCtrl, then this call is invalid:
-   GuiScrollCtrl *pappy = dynamic_cast<GuiScrollCtrl*>(getParent());
-   if ( !pappy )
-      return;
-    pappy->scrollRectVisible(RectI(0,0,0,0));
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::scrollToBottom()
-{
-   // If the parent control is not a GuiScrollContentCtrl, then this call is invalid:
-   GuiScrollCtrl *pappy = dynamic_cast<GuiScrollCtrl*>(getParent());
-   if ( !pappy )
-      return;
-
-   // Figure bounds for the bottom left corner
-   RectI cornerBounds (0, getPosition().y + getExtent().y, 1, 1);
-   pappy->scrollRectVisible(cornerBounds);
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::Atom *GuiMLTextCtrl::findHitAtom(const Point2I localCoords)
-{
-   AssertFatal(mAwake, "Can't get the text position of a sleeping control.");
-   if(mDirty)
-      reflow();
-   for(Line *walk = mLineList; walk; walk = walk->next)
-   {
-      if((U32)localCoords.y < walk->y)
-         return NULL;
-
-      if(localCoords.y >= (S32)walk->y && localCoords.y < (S32)(walk->y + walk->height))
-      {
-         for(Atom *awalk = walk->atomList; awalk; awalk = awalk->next)
-         {
-            if(localCoords.x < (S32)awalk->xStart)
-               return NULL;
-            if(localCoords.x >= (S32)(awalk->xStart + awalk->width))
-               continue;
-            return awalk;
-         }
-      }
-   }
-   return NULL;
-}
-
-//--------------------------------------------------------------------------
-S32 GuiMLTextCtrl::getTextPosition(const Point2I& localCoords)
-{
-   AssertFatal(mAwake, "Can't get the text position of a sleeping control.");
-   if(mDirty)
-      reflow();
-
-   for(Line *walk = mLineList; walk; walk = walk->next)
-   {
-      if((S32)localCoords.y < (S32)walk->y)
-         return walk->textStart;
-
-      if(localCoords.y >= (S32)walk->y && localCoords.y < (S32)(walk->y + walk->height))
-      {
-         for(Atom *awalk = walk->atomList; awalk; awalk = awalk->next)
-         {
-            if(localCoords.x < (S32)awalk->xStart)
-               return awalk->textStart;
-            if(localCoords.x >= (S32)(awalk->xStart + awalk->width))
-               continue;
-            // it's in the text block...
-            
-            //
-            // [neo, 5/7/2007]: cannot use const as getBreakPos() is not declared as const
-            //
-            //const GFont *font = awalk->style->font->fontRes;
-            GFont *font = awalk->style->font->fontRes;
-
-            const UTF16 *tmp16 = mTextBuffer.getPtr() + awalk->textStart;
-            U32 bp = font->getBreakPos(tmp16, awalk->len, localCoords.x - awalk->xStart, false);
-            return awalk->textStart + bp;
-         }
-         return walk->textStart + walk->len;
-      }
-   }
-   return mTextBuffer.length() - 1;
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::Font *GuiMLTextCtrl::allocFont(const char *faceName, U32 faceNameLen, U32 size)
-{
-   // check if it's in the font list currently:
-   for(Font *walk = mFontList; walk; walk = walk->next)
-      if(faceNameLen == walk->faceNameLen &&
-         !dStrncmp(walk->faceName, faceName, faceNameLen) &&
-         size == walk->size)
-         return walk;
-
-   // Create!
-   Font *ret;
-   ret = constructInPlace((Font *) mResourceChunker.alloc(sizeof(Font)));
-   ret->faceName = new char[faceNameLen+1];
-   dStrncpy(ret->faceName, faceName, faceNameLen);
-   ret->faceName[faceNameLen] = '\0';
-   ret->faceNameLen = faceNameLen;
-   ret->size = size;
-   ret->next = mFontList;
-   ret->fontRes = GFont::create(ret->faceName, size, mProfile->mFontDirectory);
-   if(bool(ret->fontRes))
-   {
-      ret->next = mFontList;
-      mFontList = ret;
-      return ret;
-   }
-   return NULL;
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::Bitmap *GuiMLTextCtrl::allocBitmap(const char *bitmapName, U32 bitmapNameLen)
-{
-   for(Bitmap *walk = mBitmapList; walk; walk = walk->next)
-   {   
-      if (bitmapNameLen == walk->bitmapNameLen && !dStrncmp(walk->bitmapName, bitmapName, bitmapNameLen))
-         return walk;
-   }
-
-   Bitmap *ret = constructInPlace((Bitmap *) mResourceChunker.alloc(sizeof(Bitmap)));
-   ret->bitmapName = bitmapName;
-   ret->bitmapNameLen = bitmapNameLen;
-   char nameBuffer[256];
-   AssertFatal(sizeof(nameBuffer) >= bitmapNameLen, "GuiMLTextCtrl::allocBitmap() - bitmap name too long");
-   dStrncpy(nameBuffer, bitmapName, bitmapNameLen);
-   nameBuffer[bitmapNameLen] = 0;
-   ret->bitmapHandle = TextureHandle(nameBuffer, TextureHandle::BitmapTexture);
-   if(bool(ret->bitmapHandle))
-   {
-      ret->next = mBitmapList;
-      mBitmapList = ret;
-      return ret;
-   }
-   return NULL;
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::LineTag *GuiMLTextCtrl::allocLineTag(U32 id)
-{
-   for ( LineTag* walk = mTagList; walk; walk = walk->next )
-   {
-      if ( walk->id == id )
-      {
-         Con::warnf( ConsoleLogEntry::General, "GuiMLTextCtrl - can't add duplicate line tags!" );
-         return( NULL );
-      }
-   }
-   LineTag* newTag = (LineTag*) mViewChunker.alloc( sizeof( LineTag ) );
-   newTag->id = id;
-   newTag->y = mCurY;
-   newTag->next = mTagList;
-   mTagList = newTag;
-
-   return( newTag );
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::emitNewLine(U32 textStart)
-{
-   //clear any clipping
-   mCurClipX = 0;
-
-   Line *l = (Line *) mViewChunker.alloc(sizeof(Line));
-   l->height = mCurStyle->font->fontRes->getHeight();
-   l->y = mCurY;
-   l->textStart = mLineStart;
-   l->len = textStart - l->textStart;
-   mLineStart = textStart;
-   l->atomList = mLineAtoms;
-   l->next = 0;
-   l->divStyle = mCurDiv;
-   *mLineInsert = l;
-   mLineInsert = &(l->next);
-   mCurX = mCurLMargin;
-   mCurTabStop = 0;
-
-   if(mLineAtoms)
-   {
-      // scan through the atoms in the line, get the largest height
-      U32 maxBaseLine = 0;
-      U32 maxDescent = 0;
-      Atom* walk;
-
-      for(walk = mLineAtoms; walk; walk = walk->next)
-      {
-         if(walk->baseLine > maxBaseLine)
-            maxBaseLine = walk->baseLine;
-         if(walk->descent > maxDescent)
-            maxDescent = walk->descent;
-         if(!walk->next)
-         {
-            l->len = walk->textStart + walk->len - l->textStart;
-            mLineStart = walk->textStart + walk->len;
-         }
-      }
-      l->height = maxBaseLine + maxDescent + mLineSpacingPixels;
-
-      for(walk = mLineAtoms; walk; walk = walk->next)
-         walk->yStart = mCurY + maxBaseLine - walk->baseLine;
-   }
-   mCurY += l->height;
-   mLineAtoms = NULL;
-   mLineAtomPtr = &mLineAtoms;
-
-   // clear out the blocker list
-   BitmapRef **blockList = &mBlockList;
-   while(*blockList)
-   {
-      BitmapRef *blk = *blockList;
-      if(blk->point.y + blk->extent.y <= (S32)mCurY)
-         *blockList = blk->nextBlocker;
-      else
-         blockList = &(blk->nextBlocker);
-   }
-   if(mCurY > mMaxY)
-      mMaxY = mCurY;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::emitBitmapToken(GuiMLTextCtrl::Bitmap *bmp, U32 textStart, bool bitmapBreak)
-{
-   if(mCurRMargin <= mCurLMargin)
-      return;
-   if(mCurRMargin - mCurLMargin < bmp->bitmapHandle.getWidth())
-      return;
-
-   BitmapRef *ref = (BitmapRef *) mViewChunker.alloc(sizeof(BitmapRef));
-   ref->bitmap = bmp;
-   ref->next = mBitmapRefList;
-   mBitmapRefList = ref;
-
-   // now we gotta insert it into the blocker list and figure out where it's spos to go...
-   ref->extent.x = bmp->bitmapHandle.getWidth();
-   ref->extent.y = bmp->bitmapHandle.getHeight();
-
-   // find the first space in the blocker list that will fit this thats > curLMargin
-
-   while(bitmapBreak && mBlockList != &mSentinel)
-      emitNewLine(textStart);
-
-   for(;;)
-   {
-      // loop til we find a line that fits...
-      // we'll have to emitLine repeatedly to clear out the block lists...
-
-      BitmapRef **walk = &mBlockList;
-      U32 minx = mCurX;
-      U32 maxx = mCurRMargin;
-
-      while(*walk)
-      {
-         BitmapRef *blk = *walk;
-
-         if(blk->point.x > (S32)minx)
-         {
-            U32 right = maxx;
-            if(blk->point.x < (S32)right)
-               right = blk->point.x;
-            U32 width = right - minx;
-
-            if(right > minx && width >= (U32)ref->extent.x) // we've found the spot...
-            {
-               // insert it:
-               U32 x = minx;
-               if(mCurJustify == CenterAlign)
-                  x += (width - ref->extent.x) >> 1;
-               else if(mCurJustify == RightAlign)
-                  x += width - ref->extent.x;
-               ref->point.x = x;
-               ref->point.y = mCurY;
-               ref->nextBlocker = blk;
-               *walk = ref;
-               if(ref->point.y + ref->extent.y > (S32)mMaxY)
-                  mMaxY = ref->point.y + ref->extent.y;
-
-               return;
-            }
-         }
-         if((S32)minx < blk->point.x + blk->extent.x)
-            minx = blk->point.x + blk->extent.x;
-         // move on to the next blocker...
-         walk = &(blk->nextBlocker);
-      }
-      // go to the next line...
-      emitNewLine(textStart);
-   }
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::emitTextToken(U32 textStart, U32 len)
-{
-   if(mCurRMargin <= mCurLMargin)
-      return;
-
-   GFont *font = mCurStyle->font->fontRes;
-   Atom *a = (Atom *) mViewChunker.alloc(sizeof(Atom));
-   a->url = mCurURL;
-
-   a->style = mCurStyle;
-   mCurStyle->used = true;
-
-   a->baseLine = font->getBaseline();
-   a->descent = font->getDescent();
-   a->textStart = textStart;
-   a->len = len;
-   a->isClipped = false;
-   a->next = NULL;
-   *mEmitAtomPtr = a;
-   mEmitAtomPtr = &(a->next);
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::processEmitAtoms()
-{
-   Atom *atomList = mEmitAtoms;
-   mEmitAtoms = NULL;
-   mEmitAtomPtr = &mEmitAtoms;
-
-   bool bailout = false;
-
-   while(atomList)
-   {
-      // split the tokenlist by space
-      // first find the first space that the text can go into:
-      BitmapRef *br = mBlockList;
-      //bool bailout = false; // Scoping error here? Moved up one scope. -pw
-      Atom *list = atomList;
-
-      while(br && atomList)
-      {
-         // if the blocker is before the current x, ignore it.
-         if(br->point.x + br->extent.x <= (S32)mCurX)
-         {
-            br = br->nextBlocker;
-            continue;
-         }
-         // if cur x is in the middle of the blocker
-         // advance cur x to right edge of blocker.
-         if((S32)mCurX >= br->point.x)
-         {
-            mCurX = br->point.x + br->extent.x;
-            br = br->nextBlocker;
-            continue;
-         }
-         // get the remaining width
-         U32 right = br->point.x;
-         if(right > mCurRMargin)
-            right = mCurRMargin;
-
-         //if we're clipping text, readjust
-         if (mCurClipX > 0 && right > mCurClipX)
-            right = mCurClipX;
-
-         // if there's no room, break to the next line...
-         if(right <= mCurX)
-            break;
-         // we've got some space:
-         U32 width = right - mCurX;
-         atomList = splitAtomListEmit(atomList, width);
-         if(atomList) // there's more, so advance cur x
-         {
-            mCurX = br->point.x + br->extent.x;
-            br = br->nextBlocker;
-         }
-      }
-      if(mBlockList == &mSentinel && atomList == list)
-      {
-         if(bailout)
-            return;
-         else
-            bailout = true;
-      }
-      // is there more to process for the next line?
-      if(atomList)
-         emitNewLine(mScanPos);
-   }
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::Atom *GuiMLTextCtrl::splitAtomListEmit(Atom *list, U32 width)
-{
-   U32 totalWidth = 0;
-   Atom *emitList = 0;
-   Atom **emitPtr = &emitList;
-
-   bool adjustClipAtom = false;
-   Atom *clipAtom = NULL;
-   bool emitted = false;
-
-   while(list)
-   {
-      GFont *font = list->style->font->fontRes;
-      U32 breakPos;
-
-      const UTF16 *tmp16 = mTextBuffer.getPtr() + list->textStart;
-
-      //if we're clipping the text, we don't break within an atom, we adjust the atom to only render
-      //the portion of text that does fit, and to ignore the rest...
-      if (mCurClipX > 0)
-      {
-         //find out how many character's fit within the given width
-         breakPos = font->getBreakPos(tmp16, list->len, width - totalWidth, false);
-
-         //if there isn't room for even the first character...
-         if (breakPos == 0)
-         {
-            //set the atom's len and width to prevent it from being drawn
-            list->len = 0;
-            list->width = 0;
-            adjustClipAtom = true;
-         }
-
-         //if our text doesn't fit within the clip region, add a "..."
-         else if (breakPos != list->len)
-         {
-            U32 etcWidth = font->getStrNWidthPrecise("...", 3);
-            breakPos = font->getBreakPos(tmp16, list->len, width - totalWidth - etcWidth, false);
-
-            //again, if there isn't even room for a single character before the "...."
-            if (breakPos == 0)
-            {
-               //set the atom's len and width to prevent it from being drawn
-               list->len = 0;
-               list->width = 0;
-               adjustClipAtom = true;
-            }
-            else
-            {
-               //set the char len to the break pos, and the rest of the characters in this atom will be ignored
-               list->len = breakPos;
-               list->width = width - totalWidth;
-
-               //mark this one as clipped
-               list->isClipped = true;
-               clipAtom = NULL;
-            }
-         }
-      
-         //otherwise no need to treat this atom any differently..
-         else
-         {
-            //set the atom width == to the string length
-            list->width = font->getStrNWidthPrecise(tmp16, breakPos);
-
-            //set the pointer to the last atom that fit within the clip region
-            clipAtom = list;
-         }
-      }
-      else
-      {
-         breakPos = font->getBreakPos(tmp16, list->len, width - totalWidth, true);
-         if(breakPos == 0 || (breakPos < list->len && mTextBuffer.getChar(list->textStart + breakPos - 1)!= ' ' && emitted))
-            break;
-
-         //set the atom width == to the string length
-         list->width = font->getStrNWidthPrecise(tmp16, breakPos);
-      }
-
-      //update the total width
-      totalWidth += list->width;
-      
-      // see if this is the last atom that will fit:
-      Atom *emit = list;
-      
-      *emitPtr = emit;
-      emitPtr = &(emit->next);
-      emitted = true;
-
-      //if we're clipping, don't split the atom, otherwise, see if it needs to be split
-      if(!list->isClipped && breakPos != list->len)
-      {
-         Atom *a = (Atom *) mViewChunker.alloc(sizeof(Atom));
-         a->url = list->url;
-         a->textStart = list->textStart + breakPos;
-         a->len = list->len - breakPos;
-         a->next = list->next;
-         a->baseLine = list->baseLine;
-         a->descent = list->descent;
-         a->style = list->style;
-         a->isClipped = false;
-         
-         list = a;
-         emit->len = breakPos;
-         break;
-      }
-      list = list->next;
-      if(totalWidth > width)
-         break;
-   }
-
-   //if we had to completely clip an atom(s), the last (partially) visible atom should be modified to include a "..."
-   if (adjustClipAtom && clipAtom)
-   {
-      GFont *font = clipAtom->style->font->fontRes;
-      U32 breakPos;
-
-      U32 etcWidth = font->getStrNWidthPrecise("...", 3);
-
-      const UTF16 *tmp16 = mTextBuffer.getPtr() + clipAtom->textStart;
-
-      breakPos = font->getBreakPos(tmp16, clipAtom->len, clipAtom->width - etcWidth, false);
-      if (breakPos != 0)
-      {
-         clipAtom->isClipped = true;
-         clipAtom->len = breakPos;
-      }
-   }
-
-   // terminate the emit list:
-   *emitPtr = 0;
-   // now emit it:
-   // going from mCurX to mCurX + width:
-   if(mCurJustify == CenterAlign)
-   {
-      if ( width > totalWidth )
-         mCurX += (width - totalWidth) >> 1;
-   }
-   else if(mCurJustify == RightAlign)
-   {
-      if ( width > totalWidth )
-         mCurX += width - totalWidth;
-   }
-   while(emitList)
-   {
-      emitList->xStart = mCurX;
-      mCurX += emitList->width;
-      Atom *temp = emitList->next;
-      *mLineAtomPtr = emitList;
-      emitList->next = 0;
-      mLineAtomPtr = &(emitList->next);
-      emitList = temp;
-   }
-   return list;
-}
-
-//--------------------------------------------------------------------------
-static bool scanforchar(const char *str, U32 &idx, char c)
-{
-   U32 startidx = idx;
-   while(str[idx] != c && str[idx] && str[idx] != ':' && str[idx] != '>' && str[idx] != '\n')
-      idx++;
-   return str[idx] == c && startidx != idx;
-}
-
-//--------------------------------------------------------------------------
-static S32 getHexVal(char c)
-{
-   if(c >= '0' && c <= '9')
-      return c - '0';
-   else if(c >= 'A' && c <= 'Z')
-      return c - 'A' + 10;
-   else if(c >= 'a' && c <= 'z')
-      return c - 'a' + 10;
-   return -1;
-}
-
-//--------------------------------------------------------------------------
-GuiMLTextCtrl::Style *GuiMLTextCtrl::allocStyle(GuiMLTextCtrl::Style *style)
-{
-   Style *ret = (Style *) mViewChunker.alloc(sizeof(Style));
-   ret->used = false;
-   if(style)
-   {
-      ret->font = style->font;
-      ret->color = style->color;
-      ret->linkColor = style->linkColor;
-      ret->linkColorHL = style->linkColorHL;
-      ret->shadowColor = style->shadowColor;
-      ret->shadowOffset = style->shadowOffset;
-      ret->next = style->next;
-   }
-   else
-   {
-      ret->font = 0;
-      ret->next = 0;
-   }
-   return ret;
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextCtrl::reflow()
-{
-   AssertFatal(mAwake, "Can't reflow a sleeping control.");
-   freeLineBuffers();
-   mDirty = false;
-   mScanPos = 0;
-
-   mLineList = NULL;
-   mLineInsert = &mLineList;
-
-   mCurStyle = allocStyle(NULL);
-   mCurStyle->font = allocFont((char *) mProfile->mFontType, dStrlen(mProfile->mFontType), mProfile->mFontSize);
-   if(!mCurStyle->font)
-      return;
-   mCurStyle->color = mProfile->mFontColor;
-   mCurStyle->shadowColor = mProfile->mFontColor;
-   mCurStyle->shadowOffset.set(0,0);
-   mCurStyle->linkColor = mProfile->mFontColors[GuiControlProfile::ColorUser0];
-   mCurStyle->linkColorHL = mProfile->mFontColors[GuiControlProfile::ColorUser1];
-
-   U32 width = mBounds.extent.x;
-
-   mCurLMargin = 0;
-   mCurRMargin = width;
-   mCurJustify = LeftAlign;
-   mCurDiv = 0;
-   mCurY = 0;
-   mCurX = 0;
-   mCurClipX = 0;
-   mLineAtoms = NULL;
-   mLineAtomPtr = &mLineAtoms;
-
-   mSentinel.point.x = width;
-   mSentinel.point.y = 0;
-   mSentinel.extent.x = 0;
-   mSentinel.extent.y = 0x7FFFFF;
-   mSentinel.nextBlocker = NULL;
-   mLineStart = 0;
-   mEmitAtoms = 0;
-   mMaxY = 0;
-   mEmitAtomPtr = &mEmitAtoms;
-
-   mBlockList = &mSentinel;
-
-   Font *nextFont;
-   LineTag *nextTag;
-   mTabStops = 0;
-   mCurTabStop = 0;
-   mTabStopCount = 0;
-   mCurURL = 0;
-   Style *newStyle;
-
-   U32 textStart;
-   U32 len;
-   U32 idx;
-   U32 sizidx;
-
-   for(;;)
-   {
-      UTF16 curChar = mTextBuffer.getChar(mScanPos);
-
-      if(!curChar)
-         break;
-
-      if(curChar == '\n')
-      {
-         textStart = mScanPos;
-         len = 1;
-         mScanPos++;
-         processEmitAtoms();
-         emitNewLine(textStart);
-         mCurDiv = 0;
-         continue;
-      }
-
-      if(curChar == '\t')
-      {
-         textStart = mScanPos;
-         len = 1;
-         mScanPos++;
-         processEmitAtoms();
-         if(mTabStopCount)
-         {
-            if(mCurTabStop < mTabStopCount)
-            {
-               if(mCurX < mTabStops[mCurTabStop])
-                  mCurX = mTabStops[mCurTabStop];
-            }
-            mCurTabStop++;
-         }
-         continue;
-      }
-
-      if(curChar == '<')
-      {
-         // it's probably some kind of tag:
-
-         // Get a pointer into the utf8 version of the buffer,
-         // because we're still scanning text in in utf8 mode.
-         const UTF8 *str = mTextBuffer.getPtr8();
-         str = getNthCodepoint(str, mScanPos);
-
-         //  And go!
-
-         if(!dStrnicmp(str + 1, "br>", 3))
-         {
-            mScanPos += 4;
-            len = 4;
-            textStart = mScanPos + 4;
-            processEmitAtoms();
-            emitNewLine(textStart);
-            mCurDiv = 0;
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "font:", 5))
-         {
-            // scan for the second colon...
-            // at each level it should drop out to the text case below...
-            idx = 6;
-            if(!scanforchar(str, idx, ':'))
-               goto textemit;
-
-            sizidx = idx + 1;
-            if(!scanforchar(str, sizidx, '>'))
-               goto textemit;
-
-            U32 size = dAtoi(str + idx + 1);
-            if(!size || size > 64)
-               goto textemit;
-            textStart = mScanPos + 6;
-            len = idx - 6;
-
-            mScanPos += sizidx + 1;
-
-            nextFont = allocFont(str + 6, len, size);
-            if(nextFont)
-            {
-               if(mCurStyle->used)
-                  mCurStyle = allocStyle(mCurStyle);
-               mCurStyle->font = nextFont;
-            }
-            continue;
-         }
-
-         if ( !dStrnicmp( str + 1, "tag:", 4 ) )
-         {
-            idx = 5;
-            if ( !scanforchar( str, idx, '>' ) )
-               goto textemit;
-            U32 tagId = dAtoi( str + 5 );
-            nextTag = allocLineTag( tagId );
-
-            mScanPos += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "color:", 6))
-         {
-            idx = 7;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            if(idx != 13 && idx != 15)
-               goto textemit;
-            ColorI color;
-
-            color.red = getHexVal(str[7]) * 16 + getHexVal(str[8]);
-            color.green = getHexVal(str[9]) * 16 + getHexVal(str[10]);
-            color.blue = getHexVal(str[11]) * 16 + getHexVal(str[12]);
-            if(idx == 15)
-               color.alpha = getHexVal(str[13]) * 16 + getHexVal(str[14]);
-            else
-               color.alpha = 255;
-            mScanPos += idx + 1;
-
-            if(mCurStyle->used)
-               mCurStyle = allocStyle(mCurStyle);
-            mCurStyle->color = color;
-
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "shadowcolor:", 12))
-         {
-            idx = 13;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            if(idx != 19 && idx != 21)
-               goto textemit;
-            ColorI color;
-
-            color.red = getHexVal(str[13]) * 16 + getHexVal(str[14]);
-            color.green = getHexVal(str[15]) * 16 + getHexVal(str[16]);
-            color.blue = getHexVal(str[17]) * 16 + getHexVal(str[18]);
-            if(idx == 21)
-               color.alpha = getHexVal(str[19]) * 16 + getHexVal(str[20]);
-            else
-               color.alpha = 255;
-            mScanPos += idx + 1;
-
-            if(mCurStyle->used)
-               mCurStyle = allocStyle(mCurStyle);
-            mCurStyle->shadowColor = color;
-
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "linkcolor:", 10))
-         {
-            idx = 11;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            if(idx != 17 && idx != 19)
-               goto textemit;
-            ColorI color;
-
-            color.red = getHexVal(str[11]) * 16 + getHexVal(str[12]);
-            color.green = getHexVal(str[13]) * 16 + getHexVal(str[14]);
-            color.blue = getHexVal(str[15]) * 16 + getHexVal(str[16]);
-            if(idx == 19)
-               color.alpha = getHexVal(str[17]) * 16 + getHexVal(str[18]);
-            else
-               color.alpha = 255;
-            mScanPos += idx + 1;
-
-            if(mCurStyle->used)
-               mCurStyle = allocStyle(mCurStyle);
-            mCurStyle->linkColor = color;
-
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "linkcolorhl:", 12))
-         {
-            idx = 13;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            if(idx != 19 && idx != 21)
-               goto textemit;
-            ColorI color;
-
-            color.red = getHexVal(str[13]) * 16 + getHexVal(str[14]);
-            color.green = getHexVal(str[15]) * 16 + getHexVal(str[16]);
-            color.blue = getHexVal(str[17]) * 16 + getHexVal(str[18]);
-            if(idx == 21)
-               color.alpha = getHexVal(str[19]) * 16 + getHexVal(str[20]);
-            else
-               color.alpha = 255;
-            mScanPos += idx + 1;
-
-            if(mCurStyle->used)
-               mCurStyle = allocStyle(mCurStyle);
-            mCurStyle->linkColorHL = color;
-
-            continue;
-         }
-         if(!dStrnicmp(str +1, "shadow:", 7))
-         {
-            idx = 8;
-            if(!scanforchar(str, idx, ':'))
-               goto textemit;
-            U32 yidx = idx + 1;
-            if(!scanforchar(str, yidx, '>'))
-               goto textemit;
-            mScanPos += yidx + 1;
-            Point2I offset;
-            offset.x = dAtoi(str + 8);
-            offset.y = dAtoi(str + idx + 1);
-            if(mCurStyle->used)
-               mCurStyle = allocStyle(mCurStyle);
-            mCurStyle->shadowOffset = offset;
-            continue;
-         }
-         if(!dStrnicmp(str +1, "bitmap", 6))
-         {
-            S32 start = 8;
-            bool bitBrk = false;
-            if(str[7] == 'k' && str[8] == ':')
-            {
-               bitBrk = true;
-               start = 9;
-            }
-            else if(str[7] != ':')
-               goto textemit;
-
-            idx = start;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            textStart = mScanPos + start;
-            len = idx - start;
-
-            mScanPos += idx + 1;
-
-            processEmitAtoms();
-            Bitmap *bmp;
-            bmp = allocBitmap(str + 8, len);
-            if(bmp)
-               emitBitmapToken(bmp, textStart, bitBrk);
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "spush>", 6))
-         {
-            mScanPos += 7;
-            newStyle = allocStyle(mCurStyle); // copy out all the attributes...
-            newStyle->next = mCurStyle;
-            mCurStyle = newStyle;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "spop>", 5))
-         {
-            mScanPos += 6;
-            if(mCurStyle->next)
-               mCurStyle = mCurStyle->next;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "sbreak>", 7))
-         {
-            mScanPos += 8;
-            processEmitAtoms();
-            while(mBlockList != &mSentinel)
-               emitNewLine(mScanPos);
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "just:left>", 10))
-         {
-            processEmitAtoms();
-            mCurJustify = LeftAlign;
-            mScanPos += 11;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "just:right>", 11))
-         {
-            processEmitAtoms();
-            mCurJustify = RightAlign;
-            mScanPos += 12;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "just:center>", 12))
-         {
-            processEmitAtoms();
-            mCurJustify = CenterAlign;
-            mScanPos += 13;
-            continue;
-         }
-
-         if(!dStrnicmp(str +1, "a:", 2))
-         {
-            idx = 3;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-
-            mCurURL = (URL *) mViewChunker.alloc(sizeof(URL));
-            mCurURL->mouseDown = false;
-            mCurURL->textStart = mScanPos + 3;
-            mCurURL->len = idx - 3;
-            mCurURL->noUnderline = false;
-
-            //if the URL is a "gamelink", don't underline...
-            if (!dStrnicmp(str + 3, "gamelink", 8))
-               mCurURL->noUnderline = true;
-
-            mScanPos += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(str+1, "/a>", 3))
-         {
-            mCurURL = NULL;
-            mScanPos += 4;
-            continue;
-         }
-
-         U32 margin;
-
-         if(!dStrnicmp(str + 1, "lmargin%:", 9))
-         {
-            idx = 10;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            margin = (mBounds.extent.x * dAtoi(str + 10)) / 100;
-            mScanPos += idx + 1;
-            goto setleftmargin;
-         }
-
-         if(!dStrnicmp(str + 1, "lmargin:", 8))
-         {
-            idx = 9;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            margin = dAtoi(str + 9);
-            mScanPos += idx + 1;
-setleftmargin:
-            processEmitAtoms();
-            U32 oldLMargin;
-            oldLMargin = mCurLMargin;
-            mCurLMargin = margin;
-            if(mCurLMargin >= width)
-               mCurLMargin = width - 1;
-            if(mCurX == oldLMargin)
-               mCurX = mCurLMargin;
-            if(mCurX < mCurLMargin)
-               mCurX = mCurLMargin;
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "rmargin%:", 9))
-         {
-            idx = 10;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            margin = (mBounds.extent.x * dAtoi(str + 10)) / 100;
-            mScanPos += idx + 1;
-            goto setrightmargin;
-         }
-
-         if(!dStrnicmp(str + 1, "rmargin:", 8))
-         {
-            idx = 9;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            margin = dAtoi(str + 9);
-            mScanPos += idx + 1;
-setrightmargin:
-            processEmitAtoms();
-            mCurRMargin = margin;
-            if(mCurLMargin >= width)
-               mCurLMargin = width;
-            if (mCurClipX > mCurRMargin)
-               mCurClipX = mCurRMargin;
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "clip:", 5))
-         {
-            U32 clipWidth = 0;
-            idx = 6;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            clipWidth = dAtoi(str + 6);
-            mScanPos += idx + 1;
-            processEmitAtoms();
-            if (clipWidth > 0)
-               mCurClipX = mCurX + clipWidth;
-            else
-               mCurClipX = 0;
-            if(mCurClipX > mCurRMargin)
-               mCurClipX = mCurRMargin;
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "/clip>", 6))
-         {
-            processEmitAtoms();
-            mCurClipX = 0;
-            mScanPos += 7;
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "div:", 4))
-         {
-            idx = 5;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            mScanPos += idx + 1;
-            mCurDiv = dAtoi(str + 5);
-            continue;
-         }
-
-         if(!dStrnicmp(str + 1, "tab:", 4))
-         {
-            idx = 5;
-            if(!scanforchar(str, idx, '>'))
-               goto textemit;
-            // scan for tab stops...
-            mTabStopCount = 1;
-            idx = 5;
-            while(scanforchar(str, idx, ','))
-            {
-               idx++;
-               mTabStopCount++;
-            }
-            idx = 5;
-            mTabStops = (U32 *) mViewChunker.alloc(sizeof(U32) * mTabStopCount);
-            mTabStops[0] = dAtoi(str + idx);
-            U32 i = 1;
-
-            while(scanforchar(str, idx, ','))
-            {
-               idx++;
-               mTabStops[i] = dAtoi(str + idx);
-               i++;
-            }
-            mScanPos += idx + 1;
-            continue;
-         }
-      }
-
-      // default case:
-textemit:
-      textStart = mScanPos;
-      idx = 1;
-      while(mTextBuffer.getChar(mScanPos+idx) != '\t' && mTextBuffer.getChar(mScanPos+idx) != '<' && mTextBuffer.getChar(mScanPos+idx) != '\n' && mTextBuffer.getChar(mScanPos+idx))
-         idx++;
-      len = idx;
-      mScanPos += idx;
-      emitTextToken(textStart, len);
-   }
-   processEmitAtoms();
-   emitNewLine(mScanPos);
-   resize(mBounds.point, Point2I(mBounds.extent.x, mMaxY));
-   Con::executef( this, 3, "onResize", Con::getIntArg( mBounds.extent.x ), Con::getIntArg( mMaxY ) );
-
-   //make sure the cursor is still visible - this handles if we're a child of a scroll ctrl...
-   ensureCursorOnScreen();
-}
-
-//-----------------------------------------------------------------------------
-char* GuiMLTextCtrl::stripControlChars(const char *inString)
-{
-   if (! bool(inString))
-      return NULL;
-   U32 maxBufLength = 64;
-   char *strippedBuffer = Con::getReturnBuffer(maxBufLength);
-   char *stripBufPtr = &strippedBuffer[0];
-   const char *bufPtr = (char *) inString;
-   U32 idx, sizidx;
-
-   for(;;)
-   {
-      //if we've reached the end of the string, or run out of room in the stripped Buffer...
-      if(*bufPtr == '\0' || (U32(stripBufPtr - strippedBuffer) >= maxBufLength - 1))
-         break;
-
-      if (*bufPtr == '\n')
-      {
-         U32 walked;
-         oneUTF8toUTF32(bufPtr,&walked);
-         bufPtr += walked; 
-         continue;
-      }
-      if(*bufPtr == '\t')
-      {
-         U32 walked;
-         oneUTF8toUTF32(bufPtr,&walked);
-         bufPtr += walked;
-         continue;
-      }
-      if(*bufPtr < 0x20 && *bufPtr >= 0)
-      {
-         U32 walked;
-         oneUTF8toUTF32(bufPtr,&walked);
-         bufPtr += walked;
-         continue;
-      }
-
-      if(*bufPtr == '<')
-      {
-         // it's probably some kind of tag:
-         if(!dStrnicmp(bufPtr + 1, "font:", 5))
-         {
-            // scan for the second colon...
-            // at each level it should drop out to the text case below...
-            idx = 6;
-            if(!scanforchar((char*)bufPtr, idx, ':'))
-               goto textemit;
-
-            sizidx = idx + 1;
-            if(!scanforchar((char*)bufPtr, sizidx, '>'))
-               goto textemit;
-
-            bufPtr += sizidx + 1;
-            continue;
-         }
-
-         if (!dStrnicmp(bufPtr + 1, "tag:", 4 ))
-         {
-            idx = 5;
-            if ( !scanforchar((char*)bufPtr, idx, '>' ))
-               goto textemit;
-
-            bufPtr += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "color:", 6))
-         {
-            idx = 7;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            if(idx != 13)
-               goto textemit;
-
-            bufPtr += 14;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "bitmap:", 7))
-         {
-            idx = 8;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-
-            bufPtr += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "spush>", 6))
-         {
-            bufPtr += 7;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "spop>", 5))
-         {
-            bufPtr += 6;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "sbreak>", 7))
-         {
-            bufPtr += 8;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "just:left>", 10))
-         {
-            bufPtr += 11;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "just:right>", 11))
-         {
-            bufPtr += 12;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "just:center>", 12))
-         {
-            bufPtr += 13;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr +1, "a:", 2))
-         {
-            idx = 3;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-
-            bufPtr += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr+1, "/a>", 3))
-         {
-            bufPtr += 4;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "lmargin%:", 9))
-         {
-            idx = 10;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-            goto setleftmargin;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "lmargin:", 8))
-         {
-            idx = 9;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-setleftmargin:
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "rmargin%:", 9))
-         {
-            idx = 10;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-            goto setrightmargin;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "rmargin:", 8))
-         {
-            idx = 9;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-setrightmargin:
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "clip:", 5))
-         {
-            idx = 6;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "/clip>", 6))
-         {
-            bufPtr += 7;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "div:", 4))
-         {
-            idx = 5;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-            continue;
-         }
-
-         if(!dStrnicmp(bufPtr + 1, "tab:", 4))
-         {
-            idx = 5;
-            if(!scanforchar((char*)bufPtr, idx, '>'))
-               goto textemit;
-            bufPtr += idx + 1;
-            continue;
-         }
-      }
-
-      // default case:
-textemit:
-      *stripBufPtr++ = *bufPtr++;
-      while(*bufPtr != '\t' && *bufPtr != '<' && *bufPtr != '\n' && (*bufPtr >= 0x20 || *bufPtr < 0))
-         *stripBufPtr++ = *bufPtr++;
-   }
-
-   //we're finished - terminate the string
-   *stripBufPtr = '\0';
-   return strippedBuffer;
-}
-

+ 0 - 292
engine/source/gui/guiMLTextCtrl.h

@@ -1,292 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIMLTEXTCTRL_H_
-#define _GUIMLTEXTCTRL_H_
-
-#ifndef _GUICONTROL_H_
-#include "gui/guiControl.h"
-#endif
-
-#ifndef _STRINGBUFFER_H_
-#include "string/stringBuffer.h"
-#endif
-
-class GFont;
-
-class GuiMLTextCtrl : public GuiControl
-{
-   typedef GuiControl Parent;
-
-   //-------------------------------------- Public interfaces...
-  public:
-   enum Justification
-   {
-      LeftAlign,
-      RightAlign,
-      CenterAlign,
-   };
-
-   struct Font {
-      char *faceName;
-      U32 faceNameLen;
-      U32 size;
-      Resource<GFont> fontRes;
-      Font *next;
-   };
-
-   struct Bitmap {
-      const char *bitmapName;
-      U32 bitmapNameLen;
-      TextureHandle bitmapHandle;
-      Bitmap *next;
-   };
-
-   struct URL
-   {
-      bool mouseDown;
-      U32 textStart;
-      U32 len;
-      bool noUnderline;
-   };
-
-   struct Style
-   {
-      ColorI color;
-      ColorI shadowColor;
-      ColorI linkColor;
-      ColorI linkColorHL;
-      Point2I shadowOffset;
-      Font *font;
-      bool used;
-      Style *next;
-   };
-
-   struct Atom
-   {
-      U32 textStart;
-      U32 len;
-      U32 xStart;
-      U32 yStart;
-      U32 width;
-      U32 baseLine;
-      U32 descent;
-      Style *style;
-      bool isClipped;
-
-      URL *url;
-      Atom *next;
-   };
-
-   struct Line {
-      U32 y;
-      U32 height;
-      U32 divStyle;
-      U32 textStart;
-      U32 len;
-      Atom *atomList;
-      Line *next;
-   };
-
-   struct BitmapRef : public RectI
-   {
-      BitmapRef *nextBlocker;
-      U32 textStart;
-      U32 len;
-      Bitmap *bitmap;
-      BitmapRef *next;
-   };
-
-   struct LineTag {
-      U32 id;
-      S32 y;
-      LineTag *next;
-   };
-
-   GuiMLTextCtrl();
-   ~GuiMLTextCtrl();
-
-   // Text retrieval functions
-   U32 getNumChars() const;
-   U32 getText(char* pBuffer, const U32 bufferSize) const;
-   U32 getWrappedText(char* pBuffer, const U32 bufferSize) const;
-   const char* getTextContent();
-   void insertChars(const char* inputChars,
-                    const U32   numInputChars,
-                    const U32   position);
-
-   // Text substitution functions
-   void setText(const char* textBuffer, const U32 numChars);
-   void addText(const char* textBuffer, const U32 numChars, bool reformat);
-
-   void setAlpha(F32 alpha) { mAlpha = alpha;}
-
-   bool setCursorPosition(const S32);
-   void ensureCursorOnScreen();
-
-   // Scroll functions
-   void scrollToTag( U32 id );
-   void scrollToTop();
-   void scrollToBottom();
-
-   virtual void reflow();
-
-   DECLARE_CONOBJECT(GuiMLTextCtrl);
-   static void initPersistFields();
-
-   void setScriptValue(const char *value);
-   const char *getScriptValue();
-
-   static char *stripControlChars(const char *inString);
-
-   //-------------------------------------- Protected Structures and constants
-  protected:
-   bool mIsEditCtrl;
-
-   U32 *mTabStops;
-   U32 mTabStopCount;
-   U32 mCurTabStop;
-
-   F32 mAlpha;
-
-   DataChunker mViewChunker;
-   DataChunker mResourceChunker;
-   Line *mLineList;
-   Bitmap *mBitmapList;
-   BitmapRef *mBitmapRefList;
-   Font *mFontList;
-   LineTag *mTagList;
-   bool mDirty;
-   Style *mCurStyle;
-
-   U32 mCurLMargin;
-   U32 mCurRMargin;
-   U32 mCurJustify;
-   U32 mCurDiv;
-   U32 mCurY;
-   U32 mCurClipX;
-   Atom *mLineAtoms;
-   Atom **mLineAtomPtr;
-
-   Atom *mEmitAtoms;
-   Atom **mEmitAtomPtr;
-
-   BitmapRef mSentinel;
-   Line **mLineInsert;
-   BitmapRef *mBlockList;
-   U32 mScanPos;
-   U32 mCurX;
-   U32 mMaxY;
-   URL *mCurURL;
-
-   URL *mHitURL;
-
-   void freeLineBuffers();
-   void freeResources();
-
-   Bitmap *allocBitmap(const char *bitmapName, U32 bitmapNameLen);
-   Font *allocFont(const char *faceName, U32 faceNameLen, U32 size);
-   LineTag *allocLineTag(U32 id);
-   void emitNewLine(U32 textStart);
-   Atom *buildTextAtom(U32 start, U32 len, U32 left, U32 right, URL *url);
-   void emitTextToken(U32 textStart, U32 len);
-   void emitBitmapToken(Bitmap *bmp, U32 textStart, bool bitmapBreak);
-   void processEmitAtoms();
-   Atom *splitAtomListEmit(Atom *list, U32 width);
-   void drawAtomText(bool sel, U32 start, U32 end, Atom *atom, Line *line, Point2I offset);
-   Atom *findHitAtom(const Point2I localCoords);
-   Style *allocStyle(Style *style);
-
-   static const U32 csmTextBufferGrowthSize;
-
-   //-------------------------------------- Data...
-  protected:
-   // Cursor position should always be <= mCurrTextSize
-   U32  mCursorPosition;
-
-   // Actual text data. The line buffer is rebuilt from the linear text
-   //  given a specific width.  TextBuffer is /not/ \0 terminated
-   StringBuffer mTextBuffer;
-   U32   mLineStart;
-	S32	mMaxBufferSize;
-   StringTableEntry mInitialText;
-
-   // Selection information
-   bool mSelectionActive;
-   U32  mSelectionStart;
-   U32  mSelectionEnd;
-
-   U32  mVertMoveAnchor;
-   bool mVertMoveAnchorValid;
-
-   S32     mSelectionAnchor;
-   Point2I mSelectionAnchorDropped;
-
-   // Font resource
-   Resource<GFont> mFont;
-   U32             mMinSensibleWidth;
-
-   // Console settable parameters
-   U32 mLineSpacingPixels;
-   bool  mAllowColorChars;
-
-   // Too many chars sound:
-   AssetPtr<AudioAsset>  mDeniedSound; 
-
-   //-------------------------------------- Protected interface
-  protected:
-   // Inserting and deleting character blocks...
-   void deleteChars(const U32 rangeStart,
-                    const U32 rangeEnd);
-   void copyToClipboard(const U32 rangeStart,
-                     const U32 rangeEnd);
-
-   // Selection maintainance
-   bool isSelectionActive() const;
-   void clearSelection();
-
-   // Pixel -> textposition mappings
-   S32 getTextPosition(const Point2I& localPosition);
-
-	// Gui control overrides
-   bool onAdd();
-   bool onWake();
-   void onSleep();
-   void onPreRender();
-   void onRender(Point2I offset, const RectI &updateRect);
-   void getCursorPositionAndColor(Point2I &cursorTop, Point2I &cursorBottom, ColorI &color);
-   void inspectPostApply();
-   void resize(const Point2I &newPosition, const Point2I &newExtent);
-   void parentResized(const Point2I &oldParentExtent, const Point2I &newParentExtent);
-   bool onKeyDown(const GuiEvent& event);
-   void onMouseDown(const GuiEvent&);
-   void onMouseDragged(const GuiEvent&);
-   void onMouseUp(const GuiEvent&);
-
-  public:
-   void setSelectionStart( U32 start ) { clearSelection(); mSelectionStart = start; };
-   void setSelectionEnd( U32 end ) { mSelectionEnd = end;};
-   void setSelectionActive(bool active) { mSelectionActive = active; };
-   S32 getCursorPosition()  { return( mCursorPosition ); }
-};
-
-#endif  // _H_GUIMLTEXTCTRL_

+ 0 - 395
engine/source/gui/guiMLTextEditCtrl.cc

@@ -1,395 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#include "gui/guiMLTextEditCtrl.h"
-#include "gui/containers/guiScrollCtrl.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "platform/event.h"
-#include "memory/frameAllocator.h"
-#include "string/stringBuffer.h"
-
-IMPLEMENT_CONOBJECT(GuiMLTextEditCtrl);
-
-//--------------------------------------------------------------------------
-GuiMLTextEditCtrl::GuiMLTextEditCtrl()
-{
-   mEscapeCommand = StringTable->EmptyString;
-
-	mIsEditCtrl = true;
-
-   mActive = true;
-
-   mVertMoveAnchorValid = false;
-}
-
-
-//--------------------------------------------------------------------------
-GuiMLTextEditCtrl::~GuiMLTextEditCtrl()
-{
-
-}
-
-
-//--------------------------------------------------------------------------
-void GuiMLTextEditCtrl::resize(const Point2I &newPosition, const Point2I &newExtent)
-{
-   // We don't want to get any smaller than our parent:
-   Point2I newExt = newExtent;
-   GuiControl* parent = getParent();
-   if ( parent )
-      newExt.y = getMax( parent->mBounds.extent.y, newExt.y );
-
-   Parent::resize( newPosition, newExt );
-}
-
-
-//--------------------------------------------------------------------------
-void GuiMLTextEditCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addField( "escapeCommand", TypeString, Offset( mEscapeCommand, GuiMLTextEditCtrl ) );
-}
-
-//--------------------------------------------------------------------------
-// Key events...
-bool GuiMLTextEditCtrl::onKeyDown(const GuiEvent& event)
-{
-	setUpdate();
-	//handle modifiers first...
-   if (event.modifier & SI_CTRL)
-   {
-      switch(event.keyCode)
-      {
-			//copy/cut
-         case KEY_C:
-         case KEY_X:
-			{
-				//make sure we actually have something selected
-				if (mSelectionActive)
-				{
-		         copyToClipboard(mSelectionStart, mSelectionEnd);
-
-					//if we're cutting, also delete the selection
-					if (event.keyCode == KEY_X)
-					{
-			         mSelectionActive = false;
-			         deleteChars(mSelectionStart, mSelectionEnd);
-			         mCursorPosition = mSelectionStart;
-					}
-					else
-			         mCursorPosition = mSelectionEnd + 1;
-				}
-				return true;
-			}
-
-			//paste
-         case KEY_V:
-			{
-				const char *clipBuf = Platform::getClipboard();
-				if (dStrlen(clipBuf) > 0)
-				{
-			      // Normal ascii keypress.  Go ahead and add the chars...
-			      if (mSelectionActive == true)
-			      {
-			         mSelectionActive = false;
-			         deleteChars(mSelectionStart, mSelectionEnd);
-			         mCursorPosition = mSelectionStart;
-			      }
-
-			      insertChars(clipBuf, dStrlen(clipBuf), mCursorPosition);
-				}
-				return true;
-			}
-		}
-   }
-   else if ( event.modifier & SI_SHIFT )
-   {
-      switch ( event.keyCode )
-      {
-         case KEY_TAB:
-            return( Parent::onKeyDown( event ) );
-      }
-   }
-   else if ( event.modifier == 0 )
-   {
-      switch (event.keyCode)
-      {
-         // Escape:
-         case KEY_ESCAPE:
-            if ( mEscapeCommand[0] )
-            {
-               Con::evaluate( mEscapeCommand );
-               return( true );
-            }
-            return( Parent::onKeyDown( event ) );
-
-         // Deletion
-         case KEY_BACKSPACE:
-         case KEY_DELETE:
-            handleDeleteKeys(event);
-            return true;
-
-         // Cursor movement
-         case KEY_LEFT:
-         case KEY_RIGHT:
-         case KEY_UP:
-         case KEY_DOWN:
-         case KEY_HOME:
-         case KEY_END:
-            handleMoveKeys(event);
-            return true;
-
-         // Special chars...
-         case KEY_TAB:
-            // insert 3 spaces
-            if (mSelectionActive == true)
-            {
-               mSelectionActive = false;
-               deleteChars(mSelectionStart, mSelectionEnd);
-               mCursorPosition = mSelectionStart;
-            }
-            insertChars( "\t", 1, mCursorPosition );
-            return true;
-
-         case KEY_RETURN:
-            // insert carriage return
-            if (mSelectionActive == true)
-            {
-               mSelectionActive = false;
-               deleteChars(mSelectionStart, mSelectionEnd);
-               mCursorPosition = mSelectionStart;
-            }
-            insertChars( "\n", 1, mCursorPosition );
-            return true;
-      }
-   }
-
-   if (event.ascii != 0)
-   {
-      // Normal ascii keypress.  Go ahead and add the chars...
-      if (mSelectionActive == true)
-      {
-         mSelectionActive = false;
-         deleteChars(mSelectionStart, mSelectionEnd);
-         mCursorPosition = mSelectionStart;
-      }
-
-      UTF8 *outString = NULL;
-      U32 outStringLen = 0;
-
-#ifdef TORQUE_UNICODE
-
-      UTF16 inData[2] = { event.ascii, 0 };
-      StringBuffer inBuff(inData);
-
-      FrameTemp<UTF8> outBuff(4);
-      //[neo, 5/7/2007]: StringBuffer::get() is gone baby, gone...
-      //inBuff.get(outBuff, 4);
-      inBuff.getCopy8(outBuff,4);
-
-      outString = outBuff;
-      outStringLen = dStrlen(outBuff);
-#else
-      char ascii = char(event.ascii);
-      outString = &ascii;
-      outStringLen = 1;
-#endif
-
-      insertChars(outString, outStringLen, mCursorPosition);
-      mVertMoveAnchorValid = false;
-      return true;
-   }
-
-   // Otherwise, let the parent have the event...
-   return Parent::onKeyDown(event);
-}
-
-
-//--------------------------------------
-void GuiMLTextEditCtrl::handleDeleteKeys(const GuiEvent& event)
-{
-   if ( isSelectionActive() )
-   {
-      mSelectionActive = false;
-      deleteChars(mSelectionStart, mSelectionEnd+1);
-      mCursorPosition = mSelectionStart;
-   }
-   else
-   {
-      switch ( event.keyCode )
-      {
-         case KEY_BACKSPACE:
-            if (mCursorPosition != 0)
-            {
-               // delete one character left
-               deleteChars(mCursorPosition-1, mCursorPosition);
-               setUpdate();
-            }
-            break;
-
-         case KEY_DELETE:
-            if (mCursorPosition != mTextBuffer.length())
-            {
-               // delete one character right
-               deleteChars(mCursorPosition, mCursorPosition+1);
-               setUpdate();
-            }
-            break;
-
-        default:
-            AssertFatal(false, "Unknown key code received!");
-      }
-   }
-}
-
-
-//--------------------------------------
-void GuiMLTextEditCtrl::handleMoveKeys(const GuiEvent& event)
-{
-   if ( event.modifier & SI_SHIFT )
-      return;
-
-   mSelectionActive = false;
-
-   switch ( event.keyCode )
-   {
-      case KEY_LEFT:
-         mVertMoveAnchorValid = false;
-         // move one left
-         if ( mCursorPosition != 0 )
-         {
-            mCursorPosition--;
-            setUpdate();
-         }
-         break;
-
-      case KEY_RIGHT:
-         mVertMoveAnchorValid = false;
-         // move one right
-         if ( mCursorPosition != mTextBuffer.length() )
-         {
-            mCursorPosition++;
-            setUpdate();
-         }
-         break;
-
-      case KEY_UP:
-      case KEY_DOWN:
-      {
-         Line* walk;
-         for ( walk = mLineList; walk->next; walk = walk->next )
-         {
-            if ( mCursorPosition <= ( walk->textStart + walk->len ) )
-               break;
-         }
-
-         if ( !walk )
-            return;
-
-         if ( event.keyCode == KEY_UP )
-         {
-            if ( walk == mLineList )
-               return;
-         }
-         else if ( walk->next == NULL )
-            return;
-
-         Point2I newPos;
-         newPos.set( 0, walk->y );
-
-         // Find the x-position:
-         if ( !mVertMoveAnchorValid )
-         {
-            Point2I cursorTopP, cursorBottomP;
-            ColorI color;
-            getCursorPositionAndColor(cursorTopP, cursorBottomP, color);
-            mVertMoveAnchor = cursorTopP.x;
-            mVertMoveAnchorValid = true;
-         }
-
-         newPos.x = mVertMoveAnchor;
-
-         // Set the new y-position:
-         if (event.keyCode == KEY_UP)
-            newPos.y--;
-         else
-            newPos.y += (walk->height + 1);
-
-         if (setCursorPosition(getTextPosition(newPos)))
-            mVertMoveAnchorValid = false;
-         break;
-      }
-
-      case KEY_HOME:
-      case KEY_END:
-      {
-         mVertMoveAnchorValid = false;
-         Line* walk;
-         for (walk = mLineList; walk->next; walk = walk->next)
-         {
-            if (mCursorPosition <= (walk->textStart + walk->len))
-               break;
-         }
-
-         if (walk)
-         {
-            if (event.keyCode == KEY_HOME)
-            {
-               //place the cursor at the beginning of the first atom if there is one
-               if (walk->atomList)
-                  mCursorPosition = walk->atomList->textStart;
-               else
-                  mCursorPosition = walk->textStart;
-            }
-            else
-            {
-               mCursorPosition = walk->textStart;
-               mCursorPosition += walk->len;
-            }
-            setUpdate();
-         }
-         break;
-      }
-
-      default:
-         AssertFatal(false, "Unknown move key code was received!");
-   }
-
-   ensureCursorOnScreen();
-}
-
-//--------------------------------------------------------------------------
-void GuiMLTextEditCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   Parent::onRender(offset, updateRect);
-
-   // We are the first responder, draw our cursor in the appropriate position...
-   if (isFirstResponder()) 
-   {
-      Point2I top, bottom;
-      ColorI color;
-      getCursorPositionAndColor(top, bottom, color);
-      dglDrawLine(top + offset, bottom + offset, mProfile->mCursorColor);
-   }
-}
-

+ 0 - 58
engine/source/gui/guiMLTextEditCtrl.h

@@ -1,58 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIMLTEXTEDITCTRL_H_
-#define _GUIMLTEXTEDITCTRL_H_
-
-#ifndef _GUIMLTEXTCTRL_H_
-#include "gui/guiMLTextCtrl.h"
-#endif
-
-class GuiMLTextEditCtrl : public GuiMLTextCtrl
-{
-   typedef GuiMLTextCtrl Parent;
-
-   //-------------------------------------- Overrides
-  protected:
-   StringTableEntry mEscapeCommand;
-
-   // Events
-   bool onKeyDown(const GuiEvent&event);
-
-   // Event forwards
-   void handleMoveKeys(const GuiEvent&);
-   void handleDeleteKeys(const GuiEvent&);
-
-   // rendering
-   void onRender(Point2I offset, const RectI &updateRect);
-
-  public:
-   GuiMLTextEditCtrl();
-   ~GuiMLTextEditCtrl();
-
-   void resize(const Point2I &newPosition, const Point2I &newExtent);
-
-   DECLARE_CONOBJECT(GuiMLTextEditCtrl);
-   static void initPersistFields();
-};
-
-#endif  // _H_GUIMLTEXTEDITCTRL_

+ 0 - 112
engine/source/gui/guiMouseEventCtrl.cc

@@ -1,112 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#include "gui/guiMouseEventCtrl.h"
-#include "console/consoleTypes.h"
-
-IMPLEMENT_CONOBJECT(GuiMouseEventCtrl);
-
-GuiMouseEventCtrl::GuiMouseEventCtrl()
-{
-   mLockMouse = false;
-}
-
-//------------------------------------------------------------------------------
-void GuiMouseEventCtrl::sendMouseEvent(const char * name, const GuiEvent & event)
-{
-   char buf[3][32];
-   dSprintf(buf[0], 32, "%d", event.modifier);
-   dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
-   dSprintf(buf[2], 32, "%d", event.mouseClickCount);
-   Con::executef(this, 4, name, buf[0], buf[1], buf[2]);
-}
-
-//------------------------------------------------------------------------------
-void GuiMouseEventCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addField("lockMouse", TypeBool, Offset(mLockMouse, GuiMouseEventCtrl));
-
-   Con::setIntVariable("$EventModifier::LSHIFT",      SI_LSHIFT);
-   Con::setIntVariable("$EventModifier::RSHIFT",      SI_RSHIFT);
-   Con::setIntVariable("$EventModifier::SHIFT",       SI_SHIFT);
-   Con::setIntVariable("$EventModifier::LCTRL",       SI_LCTRL);
-   Con::setIntVariable("$EventModifier::RCTRL",       SI_RCTRL);
-   Con::setIntVariable("$EventModifier::CTRL",        SI_CTRL);
-   Con::setIntVariable("$EventModifier::LALT",        SI_LALT);
-   Con::setIntVariable("$EventModifier::RALT",        SI_RALT);
-   Con::setIntVariable("$EventModifier::ALT",         SI_ALT);
-}
-
-//------------------------------------------------------------------------------
-void GuiMouseEventCtrl::onMouseDown(const GuiEvent & event)
-{
-   if(mLockMouse)
-      mouseLock();
-   sendMouseEvent("onMouseDown", event);
-}
-
-void GuiMouseEventCtrl::onMouseUp(const GuiEvent & event)
-{
-   if(mLockMouse)
-      mouseUnlock();
-   sendMouseEvent("onMouseUp", event);
-}
-
-void GuiMouseEventCtrl::onMouseMove(const GuiEvent & event)
-{
-   sendMouseEvent("onMouseMove", event);
-}
-
-void GuiMouseEventCtrl::onMouseDragged(const GuiEvent & event)
-{
-   sendMouseEvent("onMouseDragged", event);
-}
-
-void GuiMouseEventCtrl::onMouseEnter(const GuiEvent & event)
-{
-   sendMouseEvent("onMouseEnter", event);
-}
-
-void GuiMouseEventCtrl::onMouseLeave(const GuiEvent & event)
-{
-   sendMouseEvent("onMouseLeave", event);
-}
-
-void GuiMouseEventCtrl::onRightMouseDown(const GuiEvent & event)
-{
-   if(mLockMouse)
-      mouseLock();
-   sendMouseEvent("onRightMouseDown", event);
-}
-
-void GuiMouseEventCtrl::onRightMouseUp(const GuiEvent & event)
-{
-   if(mLockMouse)
-      mouseUnlock();
-   sendMouseEvent("onRightMouseUp", event);
-}
-
-void GuiMouseEventCtrl::onRightMouseDragged(const GuiEvent & event)
-{
-   sendMouseEvent("onRightMouseDragged", event);
-}

+ 0 - 63
engine/source/gui/guiMouseEventCtrl.h

@@ -1,63 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// 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.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIMOUSEEVENTCTRL_H_
-#define _GUIMOUSEEVENTCTRL_H_
-
-#ifndef _GUICONTROL_H_
-#include "gui/guiControl.h"
-#endif
-#ifndef _EVENT_H_
-#include "platform/event.h"
-#endif
-
-
-class GuiMouseEventCtrl : public GuiControl
-{
-   private:
-      typedef  GuiControl     Parent;
-      void sendMouseEvent(const char * name, const GuiEvent &);
-
-      // field info
-      bool        mLockMouse;
-
-   public:
-
-      GuiMouseEventCtrl();
-
-      // GuiControl
-      void onMouseDown(const GuiEvent & event);
-      void onMouseUp(const GuiEvent & event);
-      void onMouseMove(const GuiEvent & event);
-      void onMouseDragged(const GuiEvent & event);
-      void onMouseEnter(const GuiEvent & event);
-      void onMouseLeave(const GuiEvent & event);
-      void onRightMouseDown(const GuiEvent & event);
-      void onRightMouseUp(const GuiEvent & event);
-      void onRightMouseDragged(const GuiEvent & event);
-
-      static void initPersistFields();
-
-      DECLARE_CONOBJECT(GuiMouseEventCtrl);
-};
-
-#endif

+ 8 - 13
engine/source/gui/guiTextEditCtrl.cc

@@ -25,7 +25,6 @@
 #include "graphics/gColor.h"
 #include "graphics/gColor.h"
 #include "graphics/dgl.h"
 #include "graphics/dgl.h"
 #include "gui/guiCanvas.h"
 #include "gui/guiCanvas.h"
-#include "gui/guiMLTextCtrl.h"
 #include "gui/guiTextEditCtrl.h"
 #include "gui/guiTextEditCtrl.h"
 #include "gui/guiDefaultControlRender.h"
 #include "gui/guiDefaultControlRender.h"
 #include "memory/frameAllocator.h"
 #include "memory/frameAllocator.h"
@@ -735,30 +734,28 @@ void GuiTextEditCtrl::onTouchUp(const GuiEvent &event)
     }
     }
 }
 }
 
 
-bool GuiTextEditCtrl::onMouseWheelUp(const GuiEvent& event)
+void GuiTextEditCtrl::onMouseWheelUp(const GuiEvent& event)
 {
 {
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
-        return true;
+        return;
 
 
     if(mTextWrap && mTextOffsetY > 0)
     if(mTextWrap && mTextOffsetY > 0)
     {
     {
         mScrollVelocity = 0;
         mScrollVelocity = 0;
         mSuspendVerticalScrollJump = true;
         mSuspendVerticalScrollJump = true;
         mTextOffsetY = getMax(mTextOffsetY - static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), 0);
         mTextOffsetY = getMax(mTextOffsetY - static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), 0);
-        return true;
+        return;
     }
     }
 
 
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
     if (parent)
     if (parent)
-        return parent->onMouseWheelUp(event);
-    else
-        return false;
+        parent->onMouseWheelUp(event);
 }
 }
 
 
-bool GuiTextEditCtrl::onMouseWheelDown(const GuiEvent& event)
+void GuiTextEditCtrl::onMouseWheelDown(const GuiEvent& event)
 {
 {
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
-        return true;
+        return;
 
 
     U32 blockHeight = mTextBlockList.size() * mProfile->getFont(mFontSizeAdjust)->getHeight();
     U32 blockHeight = mTextBlockList.size() * mProfile->getFont(mFontSizeAdjust)->getHeight();
     RectI innerRect = getGlobalInnerRect();
     RectI innerRect = getGlobalInnerRect();
@@ -768,14 +765,12 @@ bool GuiTextEditCtrl::onMouseWheelDown(const GuiEvent& event)
         mScrollVelocity = 0;
         mScrollVelocity = 0;
         mSuspendVerticalScrollJump = true;
         mSuspendVerticalScrollJump = true;
         mTextOffsetY = getMin(mTextOffsetY + static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), max);
         mTextOffsetY = getMin(mTextOffsetY + static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), max);
-        return true;
+        return;
     }
     }
 
 
     GuiControl* parent = getParent();
     GuiControl* parent = getParent();
     if (parent)
     if (parent)
-        return parent->onMouseWheelDown(event);
-    else
-        return false;
+        parent->onMouseWheelDown(event);
 }
 }
 
 
 void GuiTextEditCtrl::onTouchEnter(const GuiEvent& event)
 void GuiTextEditCtrl::onTouchEnter(const GuiEvent& event)

+ 2 - 2
engine/source/gui/guiTextEditCtrl.h

@@ -207,8 +207,8 @@ public:
    void onTouchUp(const GuiEvent& event);
    void onTouchUp(const GuiEvent& event);
    void onTouchEnter(const GuiEvent& event);
    void onTouchEnter(const GuiEvent& event);
    void onTouchLeave(const GuiEvent& event);
    void onTouchLeave(const GuiEvent& event);
-   bool onMouseWheelUp(const GuiEvent& event);
-   bool onMouseWheelDown(const GuiEvent& event);
+   void onMouseWheelUp(const GuiEvent& event);
+   void onMouseWheelDown(const GuiEvent& event);
    
    
    void onCopy(bool andCut);
    void onCopy(bool andCut);
    void onPaste();
    void onPaste();