[dali_1.0.41] Merge branch 'tizen' 06/39106/1
authorNick Holland <nick.holland@partner.samsung.com>
Fri, 8 May 2015 13:05:18 +0000 (14:05 +0100)
committerNick Holland <nick.holland@partner.samsung.com>
Fri, 8 May 2015 13:07:08 +0000 (14:07 +0100)
Change-Id: Ib38aa28f8520bb2bd492ff1ac07fbee92ba9ef16

77 files changed:
build/tizen/docs/dali.doxy.in
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/text/character-set-conversion.cpp
dali-toolkit/internal/text/character-set-conversion.h
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/basic/text-basic-renderer.cpp
dali-toolkit/internal/text/segmentation.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
docs/content/images/animation/keyframe-animation.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/keyframe-animation.png with 100% similarity]
docs/content/images/example-documentation/example-code.png [new file with mode: 0644]
docs/content/images/focus-manager/focus-manager.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/focus-manager.png with 100% similarity]
docs/content/images/javascript-wrapping-guide/adding-function.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/base-wrapped-types.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/constructors.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/folder-view.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/high-level-design.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/plugin-creation.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/plugin-execution.png [new file with mode: 0644]
docs/content/images/javascript-wrapping-guide/scripting-overview.png [new file with mode: 0644]
docs/content/images/path/path.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/path.png with 100% similarity]
docs/content/images/performance/update-render.png [new file with mode: 0644]
docs/content/images/screen-shot.png [moved from docs/content/images/screenshot.png with 100% similarity]
docs/content/images/shaders/fragment-shader-color.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/fragment-shader-color.png with 100% similarity]
docs/content/images/shaders/fragment-shader-reveal.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/fragment-shader-reveal.png with 100% similarity]
docs/content/images/shaders/shader-animation.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/shader-animation.png with 100% similarity]
docs/content/images/shaders/shader-grid-hint.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/shader-grid-hint.png with 100% similarity]
docs/content/images/shaders/vertex-shader.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/vertex-shader.png with 100% similarity]
docs/content/images/spinner.gif [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/spinner.gif with 100% similarity]
docs/content/images/stage/stage.png [moved from plugins/dali-script-v8/docs/dali-theme/assets/img/stage.png with 100% similarity]
docs/content/images/texture-atlas/example-javascript-code.jpg [new file with mode: 0644]
docs/content/main-page.h [deleted file]
docs/content/main.md [new file with mode: 0644]
docs/content/programming-guide/constraints-intro.h [deleted file]
docs/content/programming-guide/constraints.h [new file with mode: 0644]
docs/content/programming-guide/dali-application.h
docs/content/programming-guide/fundamentals.h
docs/content/programming-guide/performance-profiling.h [deleted file]
docs/content/programming-guide/performance-tips.h [deleted file]
docs/content/programming-guide/resource-tracking.h [deleted file]
docs/content/programming-guide/script-howto.h [deleted file]
docs/content/programming-guide/script-overview.h [deleted file]
docs/content/programming-guide/texture-atlases.h [deleted file]
docs/content/shared-javascript-and-cpp-documentation/documentation-guide.md
docs/content/shared-javascript-and-cpp-documentation/javascript-wrapping-guide.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/performance-profiling.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/performance-tips.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/resource-tracking.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/scene-graph.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/script-overview.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/texture-atlas.md [new file with mode: 0644]
docs/content/shared-javascript-and-cpp-documentation/texture-compression.md [moved from plugins/dali-script-v8/docs/content/texture-compression.js with 50% similarity]
packaging/dali-toolkit.spec
plugins/dali-script-v8/docs/content/actor.js
plugins/dali-script-v8/docs/content/animation.js
plugins/dali-script-v8/docs/content/constants.js
plugins/dali-script-v8/docs/content/dali.js
plugins/dali-script-v8/docs/content/image-actor.js
plugins/dali-script-v8/docs/content/image.js
plugins/dali-script-v8/docs/content/keyboard-focus-manager.js
plugins/dali-script-v8/docs/content/path-animation.js
plugins/dali-script-v8/docs/content/renderable-actor.js
plugins/dali-script-v8/docs/content/shader-effect.js
plugins/dali-script-v8/docs/content/stage.js
plugins/dali-script-v8/docs/content/texture-atlases.js [deleted file]
plugins/dali-script-v8/docs/dali-theme/assets/img [new symlink]
plugins/dali-script-v8/docs/dali-theme/assets/img/example-javascript-code.png [deleted file]
plugins/dali-script-v8/docs/dali-theme/assets/img/shared [deleted symlink]
plugins/dali-script-v8/src/animation/animation-api.cpp
plugins/dali-script-v8/src/object/property-value-wrapper.cpp
texture-atlas-exporter/dali-exporter/dali3d_exporter.cpp

index e072023..bbb08c2 100644 (file)
@@ -931,7 +931,7 @@ FILTER_SOURCE_PATTERNS =
 # (index.html). This can be useful if you have a project on for instance GitHub
 # and want to reuse the introduction page also for the doxygen output.
 
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE = main.md
 
 #---------------------------------------------------------------------------
 # Configuration options related to source browsing
index f07eb32..43ff434 100644 (file)
@@ -661,7 +661,21 @@ void PushButton::ConfigureSizeNegotiation()
 
   if( label )
   {
-    label.SetPadding( Padding( TEXT_PADDING, TEXT_PADDING, TEXT_PADDING, TEXT_PADDING) );
+    Padding padding;
+
+    if( label.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::USE_NATURAL_SIZE )
+    {
+      padding.left = TEXT_PADDING;
+      padding.right = TEXT_PADDING;
+    }
+
+    if( label.GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::USE_NATURAL_SIZE )
+    {
+      padding.top = TEXT_PADDING;
+      padding.bottom = TEXT_PADDING;
+    }
+
+    label.SetPadding( padding );
   }
 }
 
index 0dc5fd7..ec6f12d 100644 (file)
@@ -28,8 +28,8 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/scripting/scripting.h>
-#include <dali/integration-api/debug.h>
 #include <dali/public-api/adaptor-framework/virtual-keyboard.h>
+#include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
@@ -48,10 +48,16 @@ namespace Toolkit
 namespace Internal
 {
 
-namespace
+namespace // unnamed namespace
 {
+
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+#endif
+
   const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
-}
+
+} // unnamed namespace
 
 namespace
 {
@@ -146,6 +152,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::RENDERING_BACKEND:
       {
         int backend = value.Get< int >();
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p RENDERING_BACKEND %d\n", impl.mController.Get(), backend );
 
         if( impl.mRenderingBackend != backend )
         {
@@ -158,7 +165,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
-          impl.mController->SetText( value.Get< std::string >() );
+          std::string text = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() );
+
+          impl.mController->SetText( text );
         }
         break;
       }
@@ -166,7 +176,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
-          impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_INACTIVE, value.Get< std::string >() );
+          std::string text = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
+
+          impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_INACTIVE, text );
         }
         break;
       }
@@ -174,7 +187,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
-          impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_ACTIVE, value.Get< std::string >() );
+          std::string text = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
+
+          impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_ACTIVE, text );
         }
         break;
       }
@@ -183,6 +199,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           std::string fontFamily = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
 
           if( impl.mController->GetDefaultFontFamily() != fontFamily )
           {
@@ -197,6 +214,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           std::string fontStyle = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_STYLE %s\n", impl.mController.Get(), fontStyle.c_str() );
 
           if( impl.mController->GetDefaultFontStyle() != fontStyle )
           {
@@ -211,6 +229,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           float pointSize = value.Get< float >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_STYLE %f\n", impl.mController.Get(), pointSize );
 
           if( !Equals( impl.mController->GetDefaultPointSize(), pointSize ) )
           {
@@ -222,34 +241,46 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       }
       case Toolkit::TextField::Property::EXCEED_POLICY:
       {
-        impl.mExceedPolicy = value.Get< int >();
+        // TODO
         break;
       }
       case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
       {
-        LayoutEngine& engine = impl.mController->GetLayoutEngine();
-        const LayoutEngine::HorizontalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( value.Get< std::string >().c_str(),
-                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE,
-                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
-
-        if( engine.GetHorizontalAlignment() != alignment )
+        if( impl.mController )
         {
-          engine.SetHorizontalAlignment( alignment );
-          impl.RequestTextRelayout();
+          std::string alignStr = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %f\n", impl.mController.Get(), alignStr.c_str() );
+
+          LayoutEngine& engine = impl.mController->GetLayoutEngine();
+          LayoutEngine::HorizontalAlignment alignment = Scripting::GetEnumeration< LayoutEngine::HorizontalAlignment >( alignStr.c_str(),
+                                                                                                                        HORIZONTAL_ALIGNMENT_STRING_TABLE,
+                                                                                                                        HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+
+          if( engine.GetHorizontalAlignment() != alignment )
+          {
+            engine.SetHorizontalAlignment( alignment );
+            impl.RequestTextRelayout();
+          }
         }
         break;
       }
       case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
       {
-        LayoutEngine& engine = impl.mController->GetLayoutEngine();
-        const LayoutEngine::VerticalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( value.Get< std::string >().c_str(),
-                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE,
-                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
-
-        if( engine.GetVerticalAlignment() != alignment )
+        if( impl.mController )
         {
-          engine.SetVerticalAlignment( alignment );
-          impl.RequestTextRelayout();
+          std::string alignStr = value.Get< std::string >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %f\n", impl.mController.Get(), alignStr.c_str() );
+
+          LayoutEngine& engine = impl.mController->GetLayoutEngine();
+          LayoutEngine::VerticalAlignment alignment = Scripting::GetEnumeration< LayoutEngine::VerticalAlignment >( alignStr.c_str(),
+                                                                                                                    VERTICAL_ALIGNMENT_STRING_TABLE,
+                                                                                                                    VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+
+          if( engine.GetVerticalAlignment() != alignment )
+          {
+            engine.SetVerticalAlignment( alignment );
+            impl.RequestTextRelayout();
+          }
         }
         break;
       }
@@ -258,6 +289,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if ( impl.mController )
         {
           Vector4 textColor = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
           if ( impl.mController->GetTextColor() != textColor )
           {
             impl.mController->SetTextColor( textColor );
@@ -271,6 +304,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if ( impl.mController )
         {
           Vector4 textColor = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
           if ( impl.mController->GetPlaceholderTextColor() != textColor )
           {
             impl.mController->SetPlaceholderTextColor( textColor );
@@ -284,6 +319,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           Vector2 shadowOffset = value.Get< Vector2 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_OFFSET %f,%f\n", impl.mController.Get(), shadowOffset.x, shadowOffset.y );
+
           if ( impl.mController->GetShadowOffset() != shadowOffset )
           {
             impl.mController->SetShadowOffset( shadowOffset );
@@ -297,6 +334,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           Vector4 shadowColor = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_COLOR %f,%f,%f,%f\n", impl.mController.Get(), shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a );
+
           if ( impl.mController->GetShadowColor() != shadowColor )
           {
             impl.mController->SetShadowColor( shadowColor );
@@ -309,7 +348,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mDecorator )
         {
-          impl.mDecorator->SetColor( PRIMARY_CURSOR, value.Get< Vector4 >() );
+          Vector4 color = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+
+          impl.mDecorator->SetColor( PRIMARY_CURSOR, color );
         }
         break;
       }
@@ -317,7 +359,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mDecorator )
         {
-          impl.mDecorator->SetColor( SECONDARY_CURSOR, value.Get< Vector4 >() );
+          Vector4 color = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+
+          impl.mDecorator->SetColor( SECONDARY_CURSOR, color );
         }
         break;
       }
@@ -325,7 +370,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
-          impl.mController->SetEnableCursorBlink( value.Get< bool >() );
+          bool enable = value.Get< bool >();
+          DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
+
+          impl.mController->SetEnableCursorBlink( enable );
         }
         break;
       }
@@ -333,7 +381,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mDecorator )
         {
-          impl.mDecorator->SetCursorBlinkInterval( value.Get< float >() );
+          float interval = value.Get< float >();
+          DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
+
+          impl.mDecorator->SetCursorBlinkInterval( interval );
         }
         break;
       }
@@ -341,13 +392,17 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mDecorator )
         {
-          impl.mDecorator->SetCursorBlinkDuration( value.Get< float >() );
+          float duration = value.Get< float >();
+          DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), duration );
+
+          impl.mDecorator->SetCursorBlinkDuration( duration );
         }
         break;
       }
       case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -358,6 +413,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -368,6 +424,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SCROLL_THRESHOLD:
       {
         float threshold = value.Get< float >();
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold );
 
         if( impl.mDecorator )
         {
@@ -378,6 +435,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SCROLL_SPEED:
       {
         float speed = value.Get< float >();
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_SPEED %f\n", impl.mController.Get(), speed );
 
         if( impl.mDecorator )
         {
@@ -388,6 +446,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SELECTION_HANDLE_IMAGE_LEFT %f\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -398,6 +457,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SELECTION_HANDLE_IMAGE_RIGHT %f\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -408,6 +468,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SELECTION_HANDLE_PRESSED_IMAGE_LEFT %f\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -418,6 +479,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
       {
         ResourceImage image = ResourceImage::New( value.Get< std::string >() );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SELECTION_HANDLE_PRESSED_IMAGE_RIGHT %f\n", impl.mController.Get(), image.GetUrl().c_str() );
 
         if( impl.mDecorator )
         {
@@ -428,6 +490,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
       {
         Vector4 color = value.Get< Vector4 >();
+        DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTION_HIGHLIGHT_COLOR %f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
 
         if( impl.mDecorator )
         {
@@ -439,7 +502,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mDecorator )
         {
-          impl.mDecorator->SetBoundingBox( value.Get< Rect<int> >() );
+          Rect<int> box = value.Get< Rect<int> >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
+
+          impl.mDecorator->SetBoundingBox( box );
         }
         break;
       }
@@ -447,7 +513,10 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
-          impl.mController->SetMaximumNumberOfCharacters( value.Get< int >() );
+          int max = value.Get< int >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max );
+
+          impl.mController->SetMaximumNumberOfCharacters( max );
         }
         break;
       }
@@ -478,6 +547,7 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
         {
           std::string text;
           impl.mController->GetText( text );
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() );
           value = text;
         }
         break;
@@ -788,6 +858,8 @@ void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
   if( mController->Relayout( size ) ||
       !mRenderer )
   {
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnRelayout %p Displaying new contents\n", mController.Get() );
+
     if( mDecorator )
     {
       mDecorator->Relayout( size );
@@ -833,6 +905,8 @@ void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
 
 void TextField::OnKeyInputFocusGained()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() );
+
   VirtualKeyboard::StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
 
   ImfManager imfManager = ImfManager::Get();
@@ -855,6 +929,8 @@ void TextField::OnKeyInputFocusGained()
 
 void TextField::OnKeyInputFocusLost()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField:OnKeyInputFocusLost %p\n", mController.Get() );
+
   VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
 
   ImfManager imfManager = ImfManager::Get();
@@ -876,6 +952,8 @@ void TextField::OnKeyInputFocusLost()
 
 void TextField::OnTap( const TapGesture& gesture )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get() );
+
   // Show the keyboard if it was hidden.
   if (!VirtualKeyboard::IsVisible())
   {
@@ -895,6 +973,8 @@ void TextField::OnPan( const PanGesture& gesture )
 
 bool TextField::OnKeyEvent( const KeyEvent& event )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
+
   if( Dali::DALI_KEY_ESCAPE == event.keyCode ||
       "Return" == event.keyPressedName ) // Make a Dali key code for this
   {
@@ -907,6 +987,8 @@ bool TextField::OnKeyEvent( const KeyEvent& event )
 
 ImfManager::ImfCallbackData TextField::OnImfEvent( Dali::ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnImfEvent %p eventName %d\n", mController.Get(), imfEvent.eventName );
+
   bool update( false );
 
   std::string text;
@@ -998,6 +1080,8 @@ void TextField::EnableClipping( bool clipping, const Vector2& size )
 
 void TextField::KeyboardStatusChanged(bool keyboardShown)
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::KeyboardStatusChanged %p keyboardShown %d\n", mController.Get(), keyboardShown );
+
   // Just hide the grab handle when keyboard is hidden.
   if (!keyboardShown )
   {
index 3afecbb..b1b9993 100644 (file)
@@ -211,6 +211,17 @@ uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters,
   return utf8 - utf8Begin;
 }
 
+void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8 )
+{
+  utf8.clear();
+
+  uint32_t numberOfBytes = GetNumberOfUtf8Bytes( &utf32[0], numberOfCharacters );
+  utf8.resize( numberOfBytes );
+
+  // This is a bit horrible but std::string returns a (signed) char*
+  Utf32ToUtf8( utf32, numberOfCharacters, reinterpret_cast<uint8_t*>(&utf8[0]) );
+}
+
 } // namespace Toolkit
 
 } // namespace Dali
index 7a62498..19784fb 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <stdint.h>
+#include <string>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
@@ -76,6 +77,15 @@ uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf3
  */
 uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 );
 
+/**
+ * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
+ *
+ * @param[in] utf32 The pointer to the UTF32 array.
+ * @param[in] numberOfCharacters The number of characters of the UTF32 array.
+ * @param[out] utf8 The UTF8 characters will be stored here.
+ */
+void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8 );
+
 } // namespace Toolkit
 
 } // namespace Dali
index 6553c51..c596045 100644 (file)
@@ -454,6 +454,9 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
         if( NULL == validateFontsPerScript )
         {
           validateFontsPerScript = new ValidateFontsPerScript();
+
+          mValidFontsPerScriptCache.PushBack( validateFontsPerScript );
+          validFontsPerScriptCacheBuffer = mValidFontsPerScriptCache.Begin();
         }
 
         if( NULL != validateFontsPerScript )
index 1825840..9e8a3fa 100644 (file)
@@ -29,9 +29,6 @@
 #include <dali-toolkit/internal/text/rendering/shaders/text-basic-shader.h>
 #include <dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.h>
 #include <dali-toolkit/internal/text/rendering/shaders/text-basic-shadow-shader.h>
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_ATLAS_RENDERER");
-#endif
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -39,6 +36,10 @@ using namespace Dali::Toolkit::Text;
 
 namespace
 {
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
+#endif
+
   const float ZERO( 0.0f );
   const float HALF( 0.5f );
   const float ONE( 1.0f );
@@ -307,7 +308,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker
     }
 #if defined(DEBUG_ENABLED)
     Toolkit::AtlasGlyphManager::Metrics metrics = mGlyphManager.GetMetrics();
-    DALI_LOG_INFO( gLogFilter, Debug::Concise, "TextAtlasRenderer::GlyphManager::GlyphCount: %i, AtlasCount: %i, TextureMemoryUse: %iK\n",
+    DALI_LOG_INFO( gLogFilter, Debug::General, "TextAtlasRenderer::GlyphManager::GlyphCount: %i, AtlasCount: %i, TextureMemoryUse: %iK\n",
                                                 metrics.mGlyphCount,
                                                 metrics.mAtlasMetrics.mAtlasCount,
                                                 metrics.mAtlasMetrics.mTextureMemoryUsed / 1024 );
@@ -684,6 +685,8 @@ struct AtlasRenderer::Impl : public ConnectionTracker
 
 Text::RendererPtr AtlasRenderer::New()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::AtlasRenderer::New()\n" );
+
   return Text::RendererPtr( new AtlasRenderer() );
 }
 
index dc6ec3e..68ba70c 100644 (file)
 // CLASS HEADER
 #include <dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h>
 
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
 #include <dali/public-api/text-abstraction/font-client.h>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/mesh-actor.h>
 #include <dali/public-api/images/atlas.h>
 #include <dali/public-api/geometry/mesh.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/rendering/shaders/text-basic-shader.h>
 #include <dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.h>
 
@@ -35,6 +38,10 @@ using namespace Dali::Toolkit::Text;
 namespace
 {
 
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
+#endif
+
 const std::size_t PADDING = 2; //< To avoid GL filtering artefacts
 
 struct TextureCoordinates
@@ -330,6 +337,8 @@ struct BasicRenderer::Impl
 
 Text::RendererPtr BasicRenderer::New()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::BasicRenderer::New()\n" );
+
   return Text::RendererPtr( new BasicRenderer() );
 }
 
index efac834..d89a935 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/text-abstraction/segmentation.h>
+#ifdef DEBUG_ENABLED
+#include <string>
+#include <dali/integration-api/debug.h>
+#endif
+
+// INTERNAL INCLUDES
+#ifdef DEBUG_ENABLED
+#include <dali-toolkit/internal/text/character-set-conversion.h>
+#endif
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_SEGMENTATION");
+#endif
+
+} // namespace
+
 
 namespace Dali
 {
@@ -46,6 +65,23 @@ void SetLineBreakInfo( const Vector<Character>& text,
   TextAbstraction::Segmentation::Get().GetLineBreakPositions( text.Begin(),
                                                               numberOfCharacters,
                                                               lineBreakInfo.Begin() );
+#ifdef DEBUG_ENABLED
+  if( gLogFilter->IsEnabledFor(Debug::Verbose) )
+  {
+    std::string utf8;
+    Utf32ToUtf8( text.Begin(), numberOfCharacters, utf8 );
+
+    std::string info;
+    info.reserve( numberOfCharacters );
+    for( unsigned int i=0; i<lineBreakInfo.Count(); ++i )
+    {
+      info.push_back( static_cast<char>('0' + lineBreakInfo[i]) );
+    }
+
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "SetLineBreakInfo Characters: %s\n", utf8.c_str() );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "SetLineBreakInfo Break info: %s\n", info.c_str() );
+  }
+#endif
 }
 
 void ReplaceLineBreakInfo( LogicalModel& model,
@@ -71,6 +107,23 @@ void SetWordBreakInfo( const Vector<Character>& text,
   TextAbstraction::Segmentation::Get().GetWordBreakPositions( text.Begin(),
                                                               numberOfCharacters,
                                                               wordBreakInfo.Begin() );
+#ifdef DEBUG_ENABLED
+  if( gLogFilter->IsEnabledFor(Debug::Verbose) )
+  {
+    std::string utf8;
+    Utf32ToUtf8( text.Begin(), numberOfCharacters, utf8 );
+
+    std::string info;
+    info.reserve( numberOfCharacters );
+    for( unsigned int i=0; i<wordBreakInfo.Count(); ++i )
+    {
+      info.push_back( static_cast<char>('0' + wordBreakInfo[i]) );
+    }
+
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "SetWordBreakInfo Characters: %s\n", utf8.c_str() );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "SetWordBreakInfo Break info: %s\n", info.c_str() );
+  }
+#endif
 }
 
 void ReplaceWordBreakInfo( LogicalModel& model,
index f39effe..f77714c 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 namespace
 {
 
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+#endif
+
 /**
  * @brief Some characters can be shaped in more than one glyph.
  * This struct is used to retrieve metrics from these group of glyphs.
@@ -138,14 +143,14 @@ EventData::~EventData()
 
 bool Controller::Impl::ProcessInputEvents()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::ProcessInputEvents\n" );
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents no event data\n" );
     return false;
   }
 
-  mEventData->mDecoratorUpdated = false;
-
   if( mEventData->mDecorator )
   {
     for( std::vector<Event>::iterator iter = mEventData->mEventQueue.begin();
@@ -154,16 +159,6 @@ bool Controller::Impl::ProcessInputEvents()
     {
       switch( iter->type )
       {
-      case Event::KEYBOARD_FOCUS_GAIN_EVENT:
-      {
-        OnKeyboardFocus( true );
-        break;
-      }
-      case Event::KEYBOARD_FOCUS_LOST_EVENT:
-      {
-        OnKeyboardFocus( false );
-        break;
-      }
       case Event::CURSOR_KEY_EVENT:
       {
         OnCursorKeyEvent( *iter );
@@ -235,84 +230,11 @@ bool Controller::Impl::ProcessInputEvents()
 
   mEventData->mEventQueue.clear();
 
-  return mEventData->mDecoratorUpdated;
-}
-
-void Controller::Impl::ReplaceTextWithPlaceholder()
-{
-  DALI_ASSERT_DEBUG( mEventData && "No placeholder text available" );
-  if( !mEventData )
-  {
-    return;
-  }
-
-  // Disable handles when showing place-holder text
-  mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, false );
-  mEventData->mDecorator->SetHandleActive( LEFT_SELECTION_HANDLE, false );
-  mEventData->mDecorator->SetHandleActive( RIGHT_SELECTION_HANDLE, false );
-
-  const char* text( NULL );
-  size_t size( 0 );
-
-  if( EventData::INACTIVE != mEventData->mState &&
-      0u != mEventData->mPlaceholderTextActive.c_str() )
-  {
-    text = mEventData->mPlaceholderTextActive.c_str();
-    size = mEventData->mPlaceholderTextActive.size();
-  }
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents\n" );
 
-  else
-  {
-    text = mEventData->mPlaceholderTextInactive.c_str();
-    size = mEventData->mPlaceholderTextInactive.size();
-  }
-
-  // Reset buffers.
-  mLogicalModel->mText.Clear();
-  mLogicalModel->mScriptRuns.Clear();
-  mLogicalModel->mFontRuns.Clear();
-  mLogicalModel->mLineBreakInfo.Clear();
-  mLogicalModel->mWordBreakInfo.Clear();
-  mLogicalModel->mBidirectionalParagraphInfo.Clear();
-  mLogicalModel->mCharacterDirections.Clear();
-  mLogicalModel->mBidirectionalLineInfo.Clear();
-  mLogicalModel->mLogicalToVisualMap.Clear();
-  mLogicalModel->mVisualToLogicalMap.Clear();
-  mVisualModel->mGlyphs.Clear();
-  mVisualModel->mGlyphsToCharacters.Clear();
-  mVisualModel->mCharactersToGlyph.Clear();
-  mVisualModel->mCharactersPerGlyph.Clear();
-  mVisualModel->mGlyphsPerCharacter.Clear();
-  mVisualModel->mGlyphPositions.Clear();
-  mVisualModel->mLines.Clear();
-  mVisualModel->ClearCaches();
-  mVisualModel->SetTextColor( mEventData->mPlaceholderTextColor );
-
-  //  Convert text into UTF-32
-  Vector<Character>& utf32Characters = mLogicalModel->mText;
-  utf32Characters.Resize( size );
-
-  // This is a bit horrible but std::string returns a (signed) char*
-  const uint8_t* utf8 = reinterpret_cast<const uint8_t*>( text );
-
-  // Transform a text array encoded in utf8 into an array encoded in utf32.
-  // It returns the actual number of characters.
-  Length characterCount = Utf8ToUtf32( utf8, size, utf32Characters.Begin() );
-  utf32Characters.Resize( characterCount );
-
-  // Reset the cursor position
-  mEventData->mPrimaryCursorPosition = 0;
-
-  // The natural size needs to be re-calculated.
-  mRecalculateNaturalSize = true;
-
-  // Apply modifications to the model
-  mOperationsPending = ALL_OPERATIONS;
-  UpdateModel( ALL_OPERATIONS );
-  mOperationsPending = static_cast<OperationsMask>( LAYOUT             |
-                                                    ALIGN              |
-                                                    UPDATE_ACTUAL_SIZE |
-                                                    REORDER );
+  bool decoratorUpdated = mEventData->mDecoratorUpdated;
+  mEventData->mDecoratorUpdated = false;
+  return decoratorUpdated;
 }
 
 void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
@@ -322,7 +244,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
 
   Vector<Character>& utf32Characters = mLogicalModel->mText;
 
-  const Length numberOfCharacters = mLogicalModel->GetNumberOfCharacters();
+  const Length numberOfCharacters = utf32Characters.Count();
 
   Vector<LineBreakInfo>& lineBreakInfo = mLogicalModel->mLineBreakInfo;
   if( GET_LINE_BREAKS & operations )
@@ -475,24 +397,6 @@ void Controller::Impl::GetDefaultFonts( Vector<FontRun>& fonts, Length numberOfC
   }
 }
 
-void Controller::Impl::OnKeyboardFocus( bool hasFocus )
-{
-  if( NULL == mEventData )
-  {
-    // Nothing to do if there is no text input.
-    return;
-  }
-
-  if( !hasFocus )
-  {
-    ChangeState( EventData::INACTIVE );
-  }
-  else
-  {
-    ChangeState( EventData::EDITING );
-  }
-}
-
 void Controller::Impl::OnCursorKeyEvent( const Event& event )
 {
   if( NULL == mEventData )
@@ -532,44 +436,33 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
 
 void Controller::Impl::OnTapEvent( const Event& event )
 {
-  if( NULL == mEventData )
+  if( NULL != mEventData )
   {
-    // Nothing to do if there is no text input.
-    return;
-  }
+    const unsigned int tapCount = event.p1.mUint;
 
-  const unsigned int tapCount = event.p1.mUint;
-
-  if( 1u == tapCount )
-  {
-    // Grab handle is not shown until a tap is received whilst EDITING
-    if( EventData::EDITING == mEventData->mState &&
-        !IsShowingPlaceholderText() )
+    if( 1u == tapCount )
     {
-      if( mEventData->mGrabHandleEnabled )
+      if( ! IsShowingPlaceholderText() )
       {
-        mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true );
-      }
-      mEventData->mDecorator->SetPopupActive( false );
-    }
-
-    ChangeState( EventData::EDITING );
-
-    const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
-    const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
-
-    mEventData->mPrimaryCursorPosition = GetClosestCursorIndex( xPosition,
-                                                                yPosition );
+        const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
+        const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
 
-    mEventData->mUpdateCursorPosition = true;
-    mEventData->mScrollAfterUpdateCursorPosition = true;
-  }
-  else if( mEventData->mSelectionEnabled &&
-           ( 2u == tapCount ) )
-  {
-    ChangeState( EventData::SELECTING );
+        mEventData->mPrimaryCursorPosition = GetClosestCursorIndex( xPosition,
+                                                                    yPosition );
+      }
+      else
+      {
+        mEventData->mPrimaryCursorPosition = 0u;
+      }
 
-    RepositionSelectionHandles( event.p2.mFloat, event.p3.mFloat );
+      mEventData->mUpdateCursorPosition = true;
+      mEventData->mScrollAfterUpdateCursorPosition = true;
+    }
+    else if( mEventData->mSelectionEnabled &&
+             ( 2u == tapCount ) )
+    {
+      RepositionSelectionHandles( event.p2.mFloat, event.p3.mFloat );
+    }
   }
 }
 
@@ -740,23 +633,8 @@ void Controller::Impl::ChangeState( EventData::State newState )
 
   if( mEventData->mState != newState )
   {
-    // Show different placeholder when switching between active & inactive
-    bool updatePlaceholder( false );
-    if( IsShowingPlaceholderText() &&
-        ( EventData::INACTIVE == newState ||
-          EventData::INACTIVE == mEventData->mState ) )
-    {
-      updatePlaceholder = true;
-    }
-
     mEventData->mState = newState;
 
-    if( updatePlaceholder )
-    {
-      ReplaceTextWithPlaceholder();
-      mEventData->mDecoratorUpdated = true;
-    }
-
     if( EventData::INACTIVE == mEventData->mState )
     {
       mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_NONE );
@@ -1155,9 +1033,11 @@ CharacterIndex Controller::Impl::CalculateNewCursorIndex( CharacterIndex index )
 
 void Controller::Impl::UpdateCursorPosition()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::UpdateCursorPosition %p\n", this );
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition no event data\n" );
     return;
   }
 
@@ -1174,6 +1054,7 @@ void Controller::Impl::UpdateCursorPosition()
                                        cursorPosition.y,
                                        cursorInfo.primaryCursorHeight,
                                        cursorInfo.lineHeight );
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Primary cursor position: %f,%f\n", cursorPosition.x, cursorPosition.y );
 
   // Sets the grab handle position.
   mEventData->mDecorator->SetPosition( GRAB_HANDLE,
@@ -1189,11 +1070,13 @@ void Controller::Impl::UpdateCursorPosition()
                                          cursorInfo.secondaryPosition.y + offset.y,
                                          cursorInfo.secondaryCursorHeight,
                                          cursorInfo.lineHeight );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + offset.x, cursorInfo.secondaryPosition.y + offset.y );
   }
   else
   {
     mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
   }
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition\n" );
 }
 
 void Controller::Impl::UpdateSelectionHandle( HandleType handleType )
index 9295d5f..79792c9 100644 (file)
@@ -42,8 +42,6 @@ struct Event
   // Used to queue input events until DoRelayout()
   enum Type
   {
-    KEYBOARD_FOCUS_GAIN_EVENT,
-    KEYBOARD_FOCUS_LOST_EVENT,
     CURSOR_KEY_EVENT,
     TAP_EVENT,
     PAN_EVENT,
@@ -154,9 +152,8 @@ struct ModifyEvent
 {
   enum Type
   {
-    PLACEHOLDER_TEXT, ///< Show the placeholder text if necessary
     TEXT_REPLACED,    ///< The entire text was replaced
-    TEXT_INSERTED,      ///< Insert characters at the current cursor position
+    TEXT_INSERTED,    ///< Insert characters at the current cursor position
     TEXT_DELETED      ///< Characters were deleted
   };
 
@@ -263,17 +260,6 @@ struct Controller::Impl
     return ( mEventData && mEventData->mIsShowingPlaceholderText );
   }
 
-  void ShowPlaceholderText()
-  {
-    if( IsPlaceholderAvailable() )
-    {
-      mEventData->mIsShowingPlaceholderText = true;
-
-      // Placeholder-text is dependent on focus state i.e. replace after event processing
-      QueueModifyEvent( ModifyEvent::PLACEHOLDER_TEXT );
-    }
-  }
-
   /**
    * @brief Called when placeholder-text is hidden
    */
@@ -298,11 +284,6 @@ struct Controller::Impl
     }
   }
 
-  /**
-   * @brief Called when placeholder-text is shown
-   */
-  void ReplaceTextWithPlaceholder();
-
   void UpdateModel( OperationsMask operationsRequired );
 
   /**
@@ -313,8 +294,6 @@ struct Controller::Impl
    */
   void GetDefaultFonts( Dali::Vector<FontRun>& fonts, Length numberOfCharacters );
 
-  void OnKeyboardFocus( bool hasFocus );
-
   void OnCursorKeyEvent( const Event& event );
 
   void OnTapEvent( const Event& event );
index a26f5f5..5e7a45b 100644 (file)
@@ -22,6 +22,7 @@
 #include <limits>
 #include <iostream>
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 namespace
 {
 
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+#endif
+
 const float MAX_FLOAT = std::numeric_limits<float>::max();
 
 const std::string EMPTY_STRING("");
@@ -58,6 +63,14 @@ ControllerPtr Controller::New( ControlInterface& controlInterface )
   return ControllerPtr( new Controller( controlInterface ) );
 }
 
+void Controller::EnableTextInput( DecoratorPtr decorator )
+{
+  if( !mImpl->mEventData )
+  {
+    mImpl->mEventData = new EventData( decorator );
+  }
+}
+
 void Controller::SetText( const std::string& text )
 {
   // Cancel previously queued inserts etc.
@@ -80,6 +93,9 @@ void Controller::SetText( const std::string& text )
     Length characterCount = Utf8ToUtf32( utf8, text.size(), utf32Characters.Begin() );
     utf32Characters.Resize( characterCount );
 
+    DALI_ASSERT_DEBUG( text.size() >= characterCount && "Invalid UTF32 conversion length" );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText %p UTF8 size %d, UTF32 size %d\n", this, text.size(), mImpl->mLogicalModel->mText.Count() );
+
     // Reset the cursor position
     if( mImpl->mEventData )
     {
@@ -91,7 +107,7 @@ void Controller::SetText( const std::string& text )
   }
   else
   {
-    mImpl->ShowPlaceholderText();
+    ShowPlaceholderText();
   }
 
   if( mImpl->mEventData )
@@ -112,14 +128,13 @@ void Controller::GetText( std::string& text ) const
 
     if( 0u != utf32Characters.Count() )
     {
-      uint32_t numberOfBytes = GetNumberOfUtf8Bytes( &utf32Characters[0], utf32Characters.Count() );
-
-      text.resize( numberOfBytes );
-
-      // This is a bit horrible but std::string returns a (signed) char*
-      Utf32ToUtf8( &utf32Characters[0], utf32Characters.Count(), reinterpret_cast<uint8_t*>(&text[0]) );
+      Utf32ToUtf8( &utf32Characters[0], utf32Characters.Count(), text );
     }
   }
+  else
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::GetText %p empty (but showing placeholder)\n", this );
+  }
 }
 
 unsigned int Controller::GetLogicalCursorPosition() const
@@ -145,7 +160,7 @@ void Controller::SetPlaceholderText( PlaceholderType type, const std::string& te
       mImpl->mEventData->mPlaceholderTextActive = text;
     }
 
-    mImpl->ShowPlaceholderText();
+    ShowPlaceholderText();
   }
 }
 
@@ -185,20 +200,12 @@ void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
   }
 
   mImpl->mFontDefaults->mDefaultFontFamily = defaultFontFamily;
-  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
-  mImpl->mOperationsPending = ALL_OPERATIONS;
-  mImpl->mRecalculateNaturalSize = true;
 
   // Clear the font-specific data
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearFontData();
+
+  mImpl->mOperationsPending = ALL_OPERATIONS;
+  mImpl->mRecalculateNaturalSize = true;
 
   mImpl->RequestRelayout();
 }
@@ -221,20 +228,12 @@ void Controller::SetDefaultFontStyle( const std::string& defaultFontStyle )
   }
 
   mImpl->mFontDefaults->mDefaultFontStyle = defaultFontStyle;
-  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
-  mImpl->mOperationsPending = ALL_OPERATIONS;
-  mImpl->mRecalculateNaturalSize = true;
 
   // Clear the font-specific data
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearFontData();
+
+  mImpl->mOperationsPending = ALL_OPERATIONS;
+  mImpl->mRecalculateNaturalSize = true;
 
   mImpl->RequestRelayout();
 }
@@ -257,20 +256,12 @@ void Controller::SetDefaultPointSize( float pointSize )
   }
 
   mImpl->mFontDefaults->mDefaultPointSize = pointSize;
-  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
-  mImpl->mOperationsPending = ALL_OPERATIONS;
-  mImpl->mRecalculateNaturalSize = true;
 
   // Clear the font-specific data
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearFontData();
+
+  mImpl->mOperationsPending = ALL_OPERATIONS;
+  mImpl->mRecalculateNaturalSize = true;
 
   mImpl->RequestRelayout();
 }
@@ -304,6 +295,9 @@ bool Controller::RemoveText( int cursorOffset, int numberOfChars )
 {
   bool removed( false );
 
+  DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfChars %d\n",
+                 this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfChars );
+
   if( ! mImpl->IsShowingPlaceholderText() )
   {
     // Delete at current cursor position
@@ -313,7 +307,7 @@ bool Controller::RemoveText( int cursorOffset, int numberOfChars )
     CharacterIndex cursorIndex = oldCursorIndex;
 
     // Validate the cursor position & number of characters
-    if( std::abs( cursorOffset ) <= cursorIndex )
+    if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
     {
       cursorIndex = oldCursorIndex + cursorOffset;
     }
@@ -334,6 +328,7 @@ bool Controller::RemoveText( int cursorOffset, int numberOfChars )
       // Cursor position retreat
       oldCursorIndex = cursorIndex;
 
+      DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", this, numberOfChars );
       removed = true;
     }
   }
@@ -414,14 +409,6 @@ float Controller::GetUnderlineHeight() const
   return mImpl->mVisualModel->GetUnderlineHeight();
 }
 
-void Controller::EnableTextInput( DecoratorPtr decorator )
-{
-  if( !mImpl->mEventData )
-  {
-    mImpl->mEventData = new EventData( decorator );
-  }
-}
-
 void Controller::SetEnableCursorBlink( bool enable )
 {
   DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
@@ -465,6 +452,7 @@ const Vector2& Controller::GetAlignmentOffset() const
 
 Vector3 Controller::GetNaturalSize()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" );
   Vector3 naturalSize;
 
   // Make sure the model is up-to-date before layouting
@@ -505,10 +493,14 @@ Vector3 Controller::GetNaturalSize()
     mImpl->mVisualModel->SetNaturalSize( naturalSize.GetVectorXY() );
 
     mImpl->mRecalculateNaturalSize = false;
+
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
   }
   else
   {
     naturalSize = mImpl->mVisualModel->GetNaturalSize();
+
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
   }
 
   return naturalSize;
@@ -516,6 +508,7 @@ Vector3 Controller::GetNaturalSize()
 
 float Controller::GetHeightForWidth( float width )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetHeightForWidth %p width %f\n", this, width );
   // Make sure the model is up-to-date before layouting
   ProcessModifyEvents();
 
@@ -549,10 +542,12 @@ float Controller::GetHeightForWidth( float width )
 
     // Do the size related operations again.
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | sizeOperations );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height );
   }
   else
   {
     layoutSize = mImpl->mVisualModel->GetActualSize();
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height );
   }
 
   return layoutSize.height;
@@ -560,6 +555,8 @@ float Controller::GetHeightForWidth( float width )
 
 bool Controller::Relayout( const Size& size )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f\n", this, size.width, size.height );
+
   if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
   {
     bool glyphsRemoved( false );
@@ -569,11 +566,14 @@ bool Controller::Relayout( const Size& size )
       glyphsRemoved = true;
     }
     // Not worth to relayout if width or height is equal to zero.
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout (skipped)\n" );
     return glyphsRemoved;
   }
 
   if( size != mImpl->mControlSize )
   {
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "new size (previous size %f,%f)\n", mImpl->mControlSize.width, mImpl->mControlSize.height );
+
     // Operations that need to be done if the size changes.
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
                                                              LAYOUT                    |
@@ -605,6 +605,7 @@ bool Controller::Relayout( const Size& size )
     updated = mImpl->ProcessInputEvents() || updated;
   }
 
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout\n" );
   return updated;
 }
 
@@ -614,16 +615,7 @@ void Controller::ProcessModifyEvents()
 
   for( unsigned int i=0; i<events.size(); ++i )
   {
-    if( ModifyEvent::PLACEHOLDER_TEXT == events[0].type )
-    {
-      // Use placeholder if text is empty
-      if( 0u == mImpl->mLogicalModel->mText.Count() &&
-          mImpl->IsShowingPlaceholderText() )
-      {
-        mImpl->ReplaceTextWithPlaceholder();
-      }
-    }
-    else if( ModifyEvent::TEXT_REPLACED == events[0].type )
+    if( ModifyEvent::TEXT_REPLACED == events[0].type )
     {
       // A (single) replace event should come first, otherwise we wasted time processing NOOP events
       DALI_ASSERT_DEBUG( 0 == i && "Unexpected TEXT_REPLACED event" );
@@ -652,23 +644,7 @@ void Controller::ResetText()
 {
   // Reset buffers.
   mImpl->mLogicalModel->mText.Clear();
-  mImpl->mLogicalModel->mScriptRuns.Clear();
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mLogicalModel->mLineBreakInfo.Clear();
-  mImpl->mLogicalModel->mWordBreakInfo.Clear();
-  mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
-  mImpl->mLogicalModel->mCharacterDirections.Clear();
-  mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
-  mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
-  mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearModelData();
 
   // Reset the cursor position
   if( mImpl->mEventData )
@@ -689,23 +665,7 @@ void Controller::ResetText()
 void Controller::TextReplacedEvent()
 {
   // Reset buffers.
-  mImpl->mLogicalModel->mScriptRuns.Clear();
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mLogicalModel->mLineBreakInfo.Clear();
-  mImpl->mLogicalModel->mWordBreakInfo.Clear();
-  mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
-  mImpl->mLogicalModel->mCharacterDirections.Clear();
-  mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
-  mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
-  mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearModelData();
 
   // The natural size needs to be re-calculated.
   mImpl->mRecalculateNaturalSize = true;
@@ -724,23 +684,7 @@ void Controller::TextInsertedEvent()
   DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextInsertedEvent" );
 
   // TODO - Optimize this
-  mImpl->mLogicalModel->mScriptRuns.Clear();
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mLogicalModel->mLineBreakInfo.Clear();
-  mImpl->mLogicalModel->mWordBreakInfo.Clear();
-  mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
-  mImpl->mLogicalModel->mCharacterDirections.Clear();
-  mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
-  mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
-  mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearModelData();
 
   // The natural size needs to be re-calculated.
   mImpl->mRecalculateNaturalSize = true;
@@ -763,23 +707,7 @@ void Controller::TextDeletedEvent()
   DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextDeletedEvent" );
 
   // TODO - Optimize this
-  mImpl->mLogicalModel->mScriptRuns.Clear();
-  mImpl->mLogicalModel->mFontRuns.Clear();
-  mImpl->mLogicalModel->mLineBreakInfo.Clear();
-  mImpl->mLogicalModel->mWordBreakInfo.Clear();
-  mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
-  mImpl->mLogicalModel->mCharacterDirections.Clear();
-  mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
-  mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
-  mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
-  mImpl->mVisualModel->mGlyphs.Clear();
-  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
-  mImpl->mVisualModel->mCharactersToGlyph.Clear();
-  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
-  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
-  mImpl->mVisualModel->mGlyphPositions.Clear();
-  mImpl->mVisualModel->mLines.Clear();
-  mImpl->mVisualModel->ClearCaches();
+  ClearModelData();
 
   // The natural size needs to be re-calculated.
   mImpl->mRecalculateNaturalSize = true;
@@ -801,6 +729,7 @@ bool Controller::DoRelayout( const Size& size,
                              OperationsMask operationsRequired,
                              Size& layoutSize )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
   bool viewUpdated( false );
 
   // Calculate the operations to be done.
@@ -817,6 +746,7 @@ bool Controller::DoRelayout( const Size& size,
     if( 0u == numberOfGlyphs )
     {
       // Nothing else to do if there is no glyphs.
+      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
       return true;
     }
 
@@ -932,6 +862,7 @@ bool Controller::DoRelayout( const Size& size,
     layoutSize = mImpl->mVisualModel->GetActualSize();
   }
 
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
   return viewUpdated;
 }
 
@@ -1015,8 +946,13 @@ void Controller::KeyboardFocusGainEvent()
 
   if( mImpl->mEventData )
   {
-    Event event( Event::KEYBOARD_FOCUS_GAIN_EVENT );
-    mImpl->mEventData->mEventQueue.push_back( event );
+    mImpl->ChangeState( EventData::EDITING );
+
+    if( mImpl->IsShowingPlaceholderText() )
+    {
+      // Show alternative placeholder-text when editing
+      ShowPlaceholderText();
+    }
 
     mImpl->RequestRelayout();
   }
@@ -1028,8 +964,13 @@ void Controller::KeyboardFocusLostEvent()
 
   if( mImpl->mEventData )
   {
-    Event event( Event::KEYBOARD_FOCUS_LOST_EVENT );
-    mImpl->mEventData->mEventQueue.push_back( event );
+    mImpl->ChangeState( EventData::INACTIVE );
+
+    if( mImpl->IsShowingPlaceholderText() )
+    {
+      // Revert to regular placeholder-text when not editing
+      ShowPlaceholderText();
+    }
 
     mImpl->RequestRelayout();
   }
@@ -1069,7 +1010,8 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
       {
         if( 0u == mImpl->mLogicalModel->mText.Count() )
         {
-          mImpl->ShowPlaceholderText();
+          ShowPlaceholderText();
+          mImpl->mEventData->mUpdateCursorPosition = true;
         }
         else
         {
@@ -1095,6 +1037,10 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
   bool removedPreEdit( false );
   bool maxLengthReached( false );
 
+  DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::InsertText %p %s (%s) mPreEditFlag %d cursor %d\n",
+                 this, text.c_str(), (COMMIT == type ? "COMMIT" : "PRE_EDIT"), mImpl->mEventData->mPreEditFlag, mImpl->mEventData->mPrimaryCursorPosition );
+
   if( ! text.empty() )
   {
     if( mImpl->IsShowingPlaceholderText() )
@@ -1123,6 +1069,8 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
         // Record the start of the pre-edit text
         mImpl->mEventData->mPreEditStartPosition = mImpl->mEventData->mPrimaryCursorPosition;
         mImpl->mEventData->mPreEditLength = text.size();
+
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "mPreEditStartPosition %d mPreEditLength %d\n", mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength );
       }
 
       mImpl->mEventData->mPreEditFlag = true;
@@ -1143,6 +1091,9 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
     Length characterCount = Utf8ToUtf32( utf8, text.size(), utf32Characters.Begin() );
     utf32Characters.Resize( characterCount );
 
+    DALI_ASSERT_DEBUG( text.size() >= utf32Characters.Count() && "Invalid UTF32 conversion length" );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "UTF8 size %d, UTF32 size %d\n", text.size(), utf32Characters.Count() );
+
     const Length numberOfCharactersInModel = mImpl->mLogicalModel->GetNumberOfCharacters();
 
     // Restrict new text to fit within Maximum characters setting
@@ -1164,6 +1115,8 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
     }
 
     cursorIndex += maxSizeOfNewText;
+
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Inserted %d characters, new size %d new cursor %d\n", maxSizeOfNewText, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition );
   }
 
   if( removedPreEdit || !text.empty() )
@@ -1174,6 +1127,8 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
 
   if( maxLengthReached )
   {
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mLogicalModel->mText.Count() );
+
     mImpl->mControlInterface.MaxLengthReached();
 
     mImpl->PreEditReset();
@@ -1184,6 +1139,33 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y )
 {
   DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
 
+  if( NULL != mImpl->mEventData )
+  {
+    if( 1u == tapCount )
+    {
+      bool tapDuringEditMode( EventData::EDITING == mImpl->mEventData->mState );
+
+      if( ! mImpl->IsShowingPlaceholderText() &&
+          EventData::EDITING == mImpl->mEventData->mState )
+      {
+        // Grab handle is not shown until a tap is received whilst EDITING
+        if( tapDuringEditMode )
+        {
+          mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true );
+        }
+        mImpl->mEventData->mDecorator->SetPopupActive( false );
+      }
+
+      mImpl->ChangeState( EventData::EDITING );
+    }
+    else if( mImpl->mEventData->mSelectionEnabled &&
+             ( 2u == tapCount ) )
+    {
+      mImpl->ChangeState( EventData::SELECTING );
+    }
+  }
+
+  // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
   if( mImpl->mEventData )
   {
     Event event( Event::TAP_EVENT );
@@ -1268,6 +1250,103 @@ Controller::~Controller()
   delete mImpl;
 }
 
+void Controller::ShowPlaceholderText()
+{
+  if( mImpl->IsPlaceholderAvailable() )
+  {
+    DALI_ASSERT_DEBUG( mImpl->mEventData && "No placeholder text available" );
+
+    mImpl->mEventData->mIsShowingPlaceholderText = true;
+
+    // Cancel previously queued inserts etc.
+    mImpl->mModifyEvents.clear();
+
+    // Disable handles when showing place-holder text
+    mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, false );
+    mImpl->mEventData->mDecorator->SetHandleActive( LEFT_SELECTION_HANDLE, false );
+    mImpl->mEventData->mDecorator->SetHandleActive( RIGHT_SELECTION_HANDLE, false );
+
+    const char* text( NULL );
+    size_t size( 0 );
+
+    // TODO - Switch placeholder text styles when changing state
+    if( EventData::INACTIVE != mImpl->mEventData->mState &&
+        0u != mImpl->mEventData->mPlaceholderTextActive.c_str() )
+    {
+      text = mImpl->mEventData->mPlaceholderTextActive.c_str();
+      size = mImpl->mEventData->mPlaceholderTextActive.size();
+    }
+    else
+    {
+      text = mImpl->mEventData->mPlaceholderTextInactive.c_str();
+      size = mImpl->mEventData->mPlaceholderTextInactive.size();
+    }
+
+    // Reset model for showing placeholder.
+    mImpl->mLogicalModel->mText.Clear();
+    ClearModelData();
+    mImpl->mVisualModel->SetTextColor( mImpl->mEventData->mPlaceholderTextColor );
+
+    // Convert text into UTF-32
+    Vector<Character>& utf32Characters = mImpl->mLogicalModel->mText;
+    utf32Characters.Resize( size );
+
+    // This is a bit horrible but std::string returns a (signed) char*
+    const uint8_t* utf8 = reinterpret_cast<const uint8_t*>( text );
+
+    // Transform a text array encoded in utf8 into an array encoded in utf32.
+    // It returns the actual number of characters.
+    Length characterCount = Utf8ToUtf32( utf8, size, utf32Characters.Begin() );
+    utf32Characters.Resize( characterCount );
+
+    // Reset the cursor position
+    mImpl->mEventData->mPrimaryCursorPosition = 0;
+
+    // The natural size needs to be re-calculated.
+    mImpl->mRecalculateNaturalSize = true;
+
+    // Apply modifications to the model
+    mImpl->mOperationsPending = ALL_OPERATIONS;
+    mImpl->QueueModifyEvent( ModifyEvent::TEXT_REPLACED );
+  }
+}
+
+void Controller::ClearModelData()
+{
+  // n.b. This does not Clear the mText from mLogicalModel
+  mImpl->mLogicalModel->mScriptRuns.Clear();
+  mImpl->mLogicalModel->mFontRuns.Clear();
+  mImpl->mLogicalModel->mLineBreakInfo.Clear();
+  mImpl->mLogicalModel->mWordBreakInfo.Clear();
+  mImpl->mLogicalModel->mBidirectionalParagraphInfo.Clear();
+  mImpl->mLogicalModel->mCharacterDirections.Clear();
+  mImpl->mLogicalModel->mBidirectionalLineInfo.Clear();
+  mImpl->mLogicalModel->mLogicalToVisualMap.Clear();
+  mImpl->mLogicalModel->mVisualToLogicalMap.Clear();
+  mImpl->mVisualModel->mGlyphs.Clear();
+  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
+  mImpl->mVisualModel->mCharactersToGlyph.Clear();
+  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
+  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
+  mImpl->mVisualModel->mGlyphPositions.Clear();
+  mImpl->mVisualModel->mLines.Clear();
+  mImpl->mVisualModel->ClearCaches();
+}
+
+void Controller::ClearFontData()
+{
+  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
+  mImpl->mLogicalModel->mFontRuns.Clear();
+  mImpl->mVisualModel->mGlyphs.Clear();
+  mImpl->mVisualModel->mGlyphsToCharacters.Clear();
+  mImpl->mVisualModel->mCharactersToGlyph.Clear();
+  mImpl->mVisualModel->mCharactersPerGlyph.Clear();
+  mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
+  mImpl->mVisualModel->mGlyphPositions.Clear();
+  mImpl->mVisualModel->mLines.Clear();
+  mImpl->mVisualModel->ClearCaches();
+}
+
 Controller::Controller( ControlInterface& controlInterface )
 : mImpl( NULL )
 {
index 4edd281..63ec1c3 100644 (file)
@@ -110,6 +110,14 @@ public:
   static ControllerPtr New( ControlInterface& controlInterface );
 
   /**
+   * @brief Called to enable text input.
+   *
+   * @note Selectable or editable controls should call this once after Controller::New().
+   * @param[in] decorator Used to create cursor, selection handle decorations etc.
+   */
+  void EnableTextInput( DecoratorPtr decorator );
+
+  /**
    * @brief Replaces any text previously set.
    *
    * @note This will be converted into UTF-32 when stored in the text model.
@@ -311,14 +319,6 @@ public:
   float GetUnderlineHeight() const;
 
   /**
-   * @brief Called to enable text input.
-   *
-   * @note Only selectable or editable controls should calls this.
-   * @param[in] decorator Used to create cursor, selection handle decorations etc.
-   */
-  void EnableTextInput( DecoratorPtr decorator );
-
-  /**
    * @brief Called to enable/disable cursor blink.
    *
    * @note Only editable controls should calls this.
@@ -484,6 +484,21 @@ protected:
 private:
 
   /**
+   * @brief Helper to clear font-specific data.
+   */
+  void ShowPlaceholderText();
+
+  /**
+   * @brief Helper to clear all the model data except for LogicalModel::mText.
+   */
+  void ClearModelData();
+
+  /**
+   * @brief Helper to clear font-specific data (only).
+   */
+  void ClearFontData();
+
+  /**
    * @brief Private constructor.
    */
   Controller( ControlInterface& controlInterface );
index 7d6d17f..6b570cc 100644 (file)
 namespace
 {
 
-// Lerps between current and target using the progress
+// Lerps between initial and target using the progress
 template< typename Type >
-void Lerp( Type& current, const Type& target, float progress )
+void Lerp( Type& current, const Type& initial, const Type& target, float progress )
 {
-  current += ((target - current) * progress);
+  current = initial + ((target - initial) * progress);
 }
 
 // Functors which wrap constraint functions with stored item IDs
@@ -41,7 +41,8 @@ struct WrappedQuaternionConstraint
 {
   WrappedQuaternionConstraint( Dali::Toolkit::ItemLayout::QuaternionFunction wrapMe, unsigned int itemId )
   :mWrapMe(wrapMe),
-   mItemId(itemId)
+   mItemId(itemId),
+   mInitialised( false )
   {
   }
 
@@ -50,18 +51,28 @@ struct WrappedQuaternionConstraint
     float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
     float weight = inputs[3]->GetFloat();
 
-    current = Dali::Quaternion::Slerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+    if( !mInitialised )
+    {
+      mInitialised = true;
+      mInitial = current;
+    }
+
+    current = Dali::Quaternion::Slerp( mInitial, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
   }
 
   Dali::Toolkit::ItemLayout::QuaternionFunction mWrapMe;
   unsigned int mItemId;
+  Dali::Quaternion mInitial;
+  bool mInitialised:1;
 };
 
 struct WrappedVector3Constraint
 {
   WrappedVector3Constraint( Dali::Toolkit::ItemLayout::Vector3Function wrapMe, unsigned int itemId )
   : mWrapMe(wrapMe),
-    mItemId(itemId)
+    mItemId(itemId),
+    mInitial(),
+    mInitialised( false )
   {
   }
 
@@ -70,18 +81,28 @@ struct WrappedVector3Constraint
     float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
     float weight = inputs[3]->GetFloat();
 
-    Lerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+    if( !mInitialised )
+    {
+      mInitialised = true;
+      mInitial = current;
+    }
+
+    Lerp( current, mInitial, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
   }
 
   Dali::Toolkit::ItemLayout::Vector3Function mWrapMe;
   unsigned int mItemId;
+  Dali::Vector3 mInitial;
+  bool mInitialised:1;
 };
 
 struct WrappedVector4Constraint
 {
   WrappedVector4Constraint( Dali::Toolkit::ItemLayout::Vector4Function wrapMe, unsigned int itemId )
   : mWrapMe(wrapMe),
-    mItemId(itemId)
+    mItemId(itemId),
+    mInitial(),
+    mInitialised( false )
   {
   }
 
@@ -90,11 +111,19 @@ struct WrappedVector4Constraint
     float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
     float weight = inputs[3]->GetFloat();
 
-    Lerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+    if( !mInitialised )
+    {
+      mInitialised = true;
+      mInitial = current;
+    }
+
+    Lerp( current, mInitial, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
   }
 
   Dali::Toolkit::ItemLayout::Vector4Function mWrapMe;
   unsigned int mItemId;
+  Dali::Vector4 mInitial;
+  bool mInitialised:1;
 };
 
 struct WrappedBoolConstraint
index 3222c87..d1c1763 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 40;
+const unsigned int TOOLKIT_MICRO_VERSION = 41;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
diff --git a/docs/content/images/example-documentation/example-code.png b/docs/content/images/example-documentation/example-code.png
new file mode 100644 (file)
index 0000000..881dc8f
Binary files /dev/null and b/docs/content/images/example-documentation/example-code.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/adding-function.png b/docs/content/images/javascript-wrapping-guide/adding-function.png
new file mode 100644 (file)
index 0000000..9d1c311
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/adding-function.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/base-wrapped-types.png b/docs/content/images/javascript-wrapping-guide/base-wrapped-types.png
new file mode 100644 (file)
index 0000000..6fd2707
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/base-wrapped-types.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/constructors.png b/docs/content/images/javascript-wrapping-guide/constructors.png
new file mode 100644 (file)
index 0000000..07c4111
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/constructors.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/folder-view.png b/docs/content/images/javascript-wrapping-guide/folder-view.png
new file mode 100644 (file)
index 0000000..2e12028
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/folder-view.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/high-level-design.png b/docs/content/images/javascript-wrapping-guide/high-level-design.png
new file mode 100644 (file)
index 0000000..e1acc8f
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/high-level-design.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/plugin-creation.png b/docs/content/images/javascript-wrapping-guide/plugin-creation.png
new file mode 100644 (file)
index 0000000..e9f26be
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/plugin-creation.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/plugin-execution.png b/docs/content/images/javascript-wrapping-guide/plugin-execution.png
new file mode 100644 (file)
index 0000000..8f3006c
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/plugin-execution.png differ
diff --git a/docs/content/images/javascript-wrapping-guide/scripting-overview.png b/docs/content/images/javascript-wrapping-guide/scripting-overview.png
new file mode 100644 (file)
index 0000000..0dea37b
Binary files /dev/null and b/docs/content/images/javascript-wrapping-guide/scripting-overview.png differ
diff --git a/docs/content/images/performance/update-render.png b/docs/content/images/performance/update-render.png
new file mode 100644 (file)
index 0000000..018f6a8
Binary files /dev/null and b/docs/content/images/performance/update-render.png differ
diff --git a/docs/content/images/texture-atlas/example-javascript-code.jpg b/docs/content/images/texture-atlas/example-javascript-code.jpg
new file mode 100644 (file)
index 0000000..a4f0805
Binary files /dev/null and b/docs/content/images/texture-atlas/example-javascript-code.jpg differ
diff --git a/docs/content/main-page.h b/docs/content/main-page.h
deleted file mode 100644 (file)
index 5074819..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*! \mainpage
- *
- * \section mainintro_sec Introduction
- *
- * It is a quick and easy way of allowing developers to create Rich UI Applications like Home
- * screen, Gallery, Music player, Games, Maps...
- *
- * DALI is based on OpenGL ES 2.0, however it hides the complexity of
- * the OpenGL API from developers and provides a clean cross-platform C++ framework.
- *
- * \section Introduction Introduction
- * - \link fundamentals Dali Fundamentals \endlink
- * - \link dali-application Dali Application and Adaptor \endlink
- * - \link hello-world Hello World - explained \endlink
- * - \link handle-body-idiom Handle – body idiom \endlink
- *
- * \section Actors Actors
- * - \link image-mesh-actor Image and Mesh actors \endlink
- * - \link event-system Event Handling \endlink
- * - \link custom-actor Custom Actor \endlink
- *
- * \section ShaderEffects Shader Effects
- * - \link shader-intro Shader Effects\endlink
- *
- * \section Animation Animation
- * - \link animation-example Example and Usage\endlink
- * - \link animation-rotation Rotation with quaternions \endlink
- * - \link animation-shader Shader Animation \endlink
- * - \link animation-multi-threading-notes Multi-threading Notes \endlink
- *
- * \section Constraints
- * - \link constraints-intro Introduction to Constraints \endlink
- *
- * \section SizeNegotiation Size Negotiation
- * - \link size-negotiation Size Negotiation \endlink
- *
- * \section UIControls UI Controls
- * - \link text-label Text Label \endlink
- * - \link item-view Item View \endlink
- * - \link scroll-view Scroll View \endlink
- * - \link size-negotiation-controls Size Negotiation for Controls \endlink
- * - \link type-registration Type Registration \endlink
- * - \link properties Properties \endlink
- * - \link background Background \endlink
- *
- * \section Dynamics Dynamics
- * - \link dynamics-intro Introduction to Dynamics\endlink
- * - \link dynamics-initialization Initializing the Simulation\endlink
- * - \link dynamics-bodies Bodies - adding and controlling dynamic objects \endlink
- * - \link dynamics-joints Joints - linking objects\endlink
- * - \link dynamics-collisions Collision Detection and Filtering\endlink
- *
- * \section Scripting
- * - \link script-overview Overview \endlink
- * - \link script-howto How to Add a Custom Control \endlink
- * - \link script-hello Hello World in script \endlink
- * - \link script-json-specification.html JSON Specification\endlink
- *
- * \section Rendering
- * - \link viewing-modes Viewing modes \endlink
- *
- * \section Profiling
- * - \link resource-tracking Resource Tracking \endlink
- * - \link performance-profiling Performance Profiling \endlink
- *
- * \section Performance
- * - \link performance-tips Performance Tips \endlink
- * - \link texture-atlases Texture Atlases  \endlink
- * - \link Texture_Compression Compressing Textures \endlink
- *
- * \section Testing
- * See [Automated Tests](@ref auto_testing) for instructions.
- */
-
-/*! \page scene-graph
- *
- * \section scene_intro What is a scene graph?
- * From wikipedia...
- * A scene graph is a collection of nodes in a graph or tree structure.
- * A node may have many children but often only a single parent,
- * with the effect of a parent applied to all its child nodes;
- * an operation performed on a group automatically propagates
- * its effect to all of its members. In many programs, associating
- * a geometrical transformation matrix (see also transformation and matrix)
- * at each group level and concatenating such matrices together is an
- * efficient and natural way to process such operations. A common feature,
- * for instance, is the ability to group related shapes/objects into a
- * compound object that can then be moved, transformed, selected,
- * etc. as easily as a single object.
- *
- * \section scene_dali How does this relate to the Dali public API?
- *
- * Actors are effectively nodes that receive input (touch events) and act as a
- * container for draw-able elements (which are also nodes) and other actors.
- *
- * For example a Button actor will be an actor with several elements such as button background,
- * text label and button face. When the actor is moved around, it's child elements will move with it.
- * When the button is pressed, the actor will receive an event and adjust the color of its button face
- * element.
- *
- * \section scene_internal Why does Dali internally have a second scene graph?
- * Actors and elements are contained in a scene graph which deals with input, layout and some animation
- * it doesn't perform any drawing.
- *
- * All the drawing is done via the Render Manager which has it's own render scene graph, where it's nodes
- * are just for drawing things like image/text and moving them around. So when you create an Image element
- * it will ask the RenderManager to create an Image node. The separation allows the RenderManager to
- * run in a separate thread to maintain a high frame rate, without being slowed down by any logic
- * performed on the actor/element side.
- *
- */
diff --git a/docs/content/main.md b/docs/content/main.md
new file mode 100644 (file)
index 0000000..54bff7c
--- /dev/null
@@ -0,0 +1,93 @@
+# DALi introduction
+
+## DALi 3D ( Dynamic Animation Library )
+
+DALi is a quick and easy way of allowing developers to create Rich UI Applications like:
+
+ + Image & Video galleries
+ + Music players
+ + Games
+ + Maps
+ + Homescreens / launch pads
+ + Advanced watch faces for wearable devices
+
+DALi is based on OpenGL ES 2.0 & 3.0, however it hides the complexity of
+the OpenGL API from developers and provides a clean cross-platform C++ & JavaScript framework.
+
++ Create Images, Text and Meshes
++ Create shaders using GLSL
++ Provide multiple cameras and render targets
++ Provides Layers to aid in 2D UI layout
++ Easy to use Animation framework
++ Automatic background loading of resources ( images / text / meshes )
++ Runs all animations in a seperate thread. This helps maintain 60 FPS even if JavaScript is performing a long operation ( e.g. Garbage Collection ).
++ Provides keyboard / touch / mouse handling
+
+![ ](screen-shot.png)
+
+## Introduction
+- \link fundamentals Dali Fundamentals \endlink
+- \link dali-application Dali Application and Adaptor \endlink
+- \link hello-world Hello World - explained \endlink
+- \link handle-body-idiom Handle – body idiom \endlink
+
+## Actors
+ - \link image-mesh-actor Image, Text and Mesh actors \endlink
+ - \link event-system Event Handling \endlink
+ - \link custom-actor Custom Actor \endlink
+
+ ## ShaderEffects
+ - \link shader-intro Shader Effects\endlink
+
+ ## Animation
+ - \link animation-example Example and Usage\endlink
+ - \link animation-rotation Rotation with quaternions \endlink
+ - \link animation-shader Shader Animation \endlink
+ - \link animation-multi-threading-notes Multi-threading Notes \endlink
+
+ ## Constraints
+ - \link constraints Introduction to Constraints \endlink
+
+## Size Negotation
+ - \link size-negotiation Size Negotiation \endlink
+
+ ## UI Controls
+ - \link scroll-view Scroll View \endlink
+ - \link size-negotiation-controls Size Negotiation for Controls \endlink
+ - \link type-registration Type Registration \endlink
+ - \link properties Properties \endlink
+ - \link background Background \endlink
+
+ ## Dynamics
+ - \link dynamics-intro Introduction to Dynamics\endlink
+ - \link dynamics-initialization Initializing the Simulation\endlink
+ - \link dynamics-bodies Bodies - adding and controlling dynamic objects \endlink
+ - \link dynamics-joints Joints - linking objects\endlink
+ - \link dynamics-collisions Collision Detection and Filtering\endlink
+
+ ## Scripting
+ - \link scriptoverview.html JSON and JavaScript Overview \endlink
+ - \link javascriptwrapping.html JavaScript Wrapping Guide for DALi developers\endlink
+ - \link script-hello Hello World in script \endlink
+ - \link script-json-specification JSON Specification\endlink
+
+ ## Rendering
+ - \link viewing-modes Viewing modes \endlink
+
+ ## Profiling
+ - \link performanceprofiling.html Performance Profiling \endlink
+ - \link resourcetracking.html Resource Tracking \endlink
+
+ ## Performance
+ - \link performancetips.html Performance Tips \endlink
+ - \link textureatlases.html Texture Atlases  \endlink
+ - \link texturecompression.html Compressing Textures \endlink
+
+## Testing
+ See [Automated Tests](@ref auto_testing) for instructions.
+
+
+## Modifying this documentation
+- \link documentationguide.html Modifying this documentation \endlink
+
+
diff --git a/docs/content/programming-guide/constraints-intro.h b/docs/content/programming-guide/constraints-intro.h
deleted file mode 100644 (file)
index fb8752d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*! \page constraints-intro Constraints
- *
-
-<h2 class="pg">Introduction</h2>
-
-Constraints can be used to modify the property of an actor, based on the properties of another actor.  Custom a functions or functors can be supplied, to describe the relationship between these properties.  A common example is alignment e.g. modifying an actor's position, when the size of the parent actor changes.  Multiple constraints can be applied to the same actor at the same time.
-
-Constraints are applied in the dedicated render thread, after animations have been applied.  This means that Constraints override the values set by Animations.  Constraints may behave in a similar way to animations, since they can be applied or removed gradually.  By default the apply-time is zero, meaning that the constraint will be applied immediately.
-
-<h2 class="pg">Local Constraints</h2>
-
-A local constraint is based on the local properties (i.e. size, position, scale, rotation, color) of an actor.  For example you could change the color of an actor, based its rotation.
-
-<h2 class="pg">Parent Constraints</h2>
-
-A parent constraint is based on properties of the actor's parent.  The following example shows how to constrain an actor to be 80% of its parent's size:
-
-@code
-Actor actor = Actor::New();
-Vector3 scale(0.8f, 0.8f, 0.8f); // Set width/height/depth at 80% of parent
-Constraint constraint = ParentConstraint::Size::New(Dali::ParentSize(scale));
-actor.ApplyConstraint(constraint);
-@endcode
-
-The actor's constraints can later be removed:
-
-@code
-  actor.RemoveConstraints();
-@endcode
-
-*
-*/
diff --git a/docs/content/programming-guide/constraints.h b/docs/content/programming-guide/constraints.h
new file mode 100644 (file)
index 0000000..9394b3c
--- /dev/null
@@ -0,0 +1,232 @@
+/*! \page constraints Constraints
+ *
+
+<h2 class="pg">Introduction</h2>
+
+Constraints are used to modify the property of an actor, based on other properties of the same actor; properties of the actor's parent; or properties of another actor altogether, when the modification needs to be at run-time.
+Custom functions or functors can be supplied, where the desired value of the property can be calculated.
+These functions (or functors) are called in every frame so should be fast and not too complex otherwise it will hit performance.
+
+Multiple constraints can be applied to the same actor at the same time.
+The order in which constraints are applied is important as this is the order in which they are processed in the update thread.
+
+Constraints are applied after animations have been applied.
+This means that Constraints override the values set by Animations.
+
+Not all properties can be used as a constraint input, please see Dali::Handle::IsPropertyAConstraintInput() for more details.
+
+<h2 class="pg">When to use a Constraint</h2>
+
+Constraints are designed as a way of modifying properties that cannot be modified by any existing built in functionality; Like Animations, Size negotiation or Parent anchor, origin settings.
+As they provide the ability for the application developer to execute their own code within the update thread, DALi can no-longer guarantee the timeliness of this code, or how optimised it may be.
+
+Generally, you should not use constraints with the SIZE property as constraining the size and size negotiation are mutually exclusive.
+Consider the following use cases as an example of when and when not to use a constraint:
+
+<table>
+  <tr>
+    <td><b>Requirement:</b></td>
+    <td><b>Desired Solution:</b></td>
+  </tr>
+  <tr>
+    <td>Need a child to be 50% the size of it's parent.</td>
+    <td>Use Size negotiation.</td>
+  </tr>
+  <tr>
+    <td>Need to zoom an actor in to the screen via it's scale property.</td>
+    <td>Use an Animation.</td>
+  </tr>
+  <tr>
+    <td>Need an actor to appear centered around the bottom-right corner of it's parent.</td>
+    <td>Use ParentOrigin & AnchorPoint.</td>
+  </tr>
+  <tr>
+    <td>Need to lay out a series of controls with various alignment requirements.</td>
+    <td>Use either Anchor & origin settings, or a TableView.</td>
+  </tr>
+  <tr>
+    <td>Need to automatically modify the position property of one actor based on the position property of another actor, that is neither a parent OR a child.</td>
+    <td>Use a Constraint.</td>
+  </tr>
+  <tr>
+    <td>Need to position an actor relative to it's parent actor in a NON-UNIFORM way, IE. a non-linear calculation needs to be performed that requires a functor.</td>
+    <td>Use a Constraint.</td>
+  </tr>
+  <tr>
+    <td>Need to modify an actor's property in real time based on some calculations that require additional data to be stored in-between frames.</td>
+    <td>Use a Constraint. The constraint functor can hold any variables within it that need to be preserved frame-to-frame.</td>
+  </tr>
+</table>
+
+For most general cases, the position and size requirements of a child or parent actor (from it's child or parent) can be calculated with Size Negotiation.
+
+<h2 class="pg">Constraint Sources</h2>
+
+These are properties of this (or another actor) that are used as inputs into the constraint.
+The constraint will take these values, optionally perform a calculation on them (if using a custom functor) and write the result to the specified property of the target actor.
+The source actor is specified as either the same actor, it's parent or another actor.
+
+<h3 class="pg">Local Source</h3>
+
+A local source is based on the local properties (i.e. size, position, scale, orientation, color) of an actor.
+For example, the actor's orientation could be used as a constraint input source.
+
+@code
+Dali::ConstraintSource source( Dali::LocalSource( Dali::Actor::Property::ORIENTATION ) );
+@endcode
+
+<h3 class="pg">Parent Source</h3>
+
+A parent source is based on properties of the actor's parent.
+For example, a parent's position can be used as a constraint input source.
+
+@code
+Dali::ConstraintSource source( Dali::ParentSource( Dali::Actor::Property::POSITION ) );
+@endcode
+
+<h3 class="pg">Source</h3>
+
+Finally, you can base your source on the properties of another handle altogether.
+For example, a sibling actor's color could be used as a constraint input source.
+
+@code
+Dali::ConstraintSource source( Dali::Source( anotherHandle, Dali::Actor::Property::COLOR ) );
+@endcode
+
+<h2 class="pg">The Constraint Function</h2>
+
+The signature of the constraint function is:
+
+@code
+void Function( PropertyType& current, const Dali::PropertyInputContainer& inputs );
+@endcode
+
+Here 'current' is a reference to the target property type, e.g. float, Vector2, Vector3 etc.
+This is an in/out parameter.
+It represents the current value of the property and the expectation is that it will be modified by the function to the desired value.
+
+The 'inputs' parameter holds all the constraint input sources.
+Each element is a pointer to the property-input and can be accessed using the indexing operator[].
+The order in which the sources are added is the order in which the property-inputs are sorted in the container. For example:
+
+@code
+constraint.AddSource( Dali::LocalSource( Dali::Actor::Property::POSITION ) );
+constraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) );
+constraint.AddSource( Dali::ParentSource( Dali::Actor::Property::POSITION ) );
+constraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+@endcode
+
+In the constraint function this equates to:
+@code
+const Dali::Vector3& position( inputs[0]->GetVector3() );
+const Dali::Vector3& size( inputs[1]->GetVector3() );
+const Dali::Vector3& parentPosition( inputs[2]->GetVector3() );
+const Dali::Vector3& parentSize( inputs[3]->GetVector3() );
+@endcode
+
+<h2 class="pg">Creating a Constraint</h2>
+
+<h3 class="pg">Using C Functions</h3>
+
+If you do not have any data that is changed at runtime, then C functions should be used.
+For example, the color of an actor could be changed based on its position along the x-axis till a preset distance of 100, beyond which it is transparent.
+
+@code
+Dali::Actor actor = Actor::New();
+
+Dali::Constraint constraint = Dali::Constraint::New< Vector4 >( actor, Dali::Actor::Property::COLOR, MyConstraintFunction ); // Creates a constraint that targets actor
+constraint.AddSource( Dali::LocalSource( Dali::Actor::Property::POSITION ) ); // Adds the POSITION property as a constraint input
+constraint.Apply(); // The constraint is applied
+@endcode
+
+And the actual C Function:
+
+@code
+void MyConstraintFunction( Dali::Vector4& current, const Dali::PropertyInputContainer& inputs )
+{
+  const Dali::Vector3& position( inputs[0]->GetVector3() );
+
+  float distance = fabs( position.x );
+
+  // More than 100.0f away, opacity is 0.0f
+  if ( distance > 100.0f )
+  {
+    current.a = 0.0f;
+  }
+  else
+  {
+    // Otherwise it will blend between fully opaque and transparent
+    current.a = ( 100.0f - distance ) / 100.0f;
+  }
+}
+@endcode
+
+Please have a look at Dali::Constraint::New() for more details.
+
+<h3 class="pg">Using Functors</h3>
+
+If you need to store some data in a struct/class, then a functor can be used.
+Reusing the last example, the color of an actor is changed based on its position along the x-axis, but the distance when it is transparent is different for each applied constraint.
+
+@code
+Dali::Actor actor = Actor::New();
+
+Dali::Constraint constraint = Dali::Constraint::New< Vector4 >( actor, Dali::Actor::Property::COLOR, MyFunctor( 200 ) ); // Creates a constraint that targets actor, and uses MyFunctor with a distance of 200
+constraint.AddSource( Dali::LocalSource( Dali::Actor::Property::POSITION ) ); // Adds the POSITION property as a constraint input
+constraint.Apply(); // The constraint is applied
+@endcode
+
+And the struct:
+
+@code
+struct MyFunctor
+{
+  /// Constructor which takes the distance at which the actor will be fully transparent
+  MyFunctor( float distance )
+  : mDistance( distance )
+  {
+  }
+
+  /// Functor
+  void operator()( Dali::Vector4& current, const Dali::PropertyInputContainer& inputs )
+  {
+    const Dali::Vector3& position( inputs[0]->GetVector3() );
+
+    float distance = fabs( position.x );
+
+    // More than mDistance away, opacity is 0.0f
+    if ( distance > mDistance )
+    {
+      current.a = 0.0f;
+    }
+    else
+    {
+      // Otherwise it will blend between fully opaque and transparent
+      current.a = ( 100.0f - mDistance ) / 100.0f;
+    }
+  }
+
+  // Data
+  const float mDistance;
+};
+@endcode
+
+MyFunctor could then be used with another constraint with a different distance.
+
+Please have a look at Dali::Constraint::New(Handle, Property::Index, const T&) for more details.
+
+Instead of using the default functor, another method can be declared in the class or struct and used as the constraint function.
+Please have a look at appropriate Dali::Constraint::New() method for more details.
+
+<h2 class="pg">Removing Constraints</h2>
+
+The actor's constraints can later be removed in several ways:
+
+@code
+mConstraint.Remove(); // mConstraint is a base-handle to a constraint
+actor.RemoveConstraints(); // Removes ALL constraints applied to an actor
+actor.RemoveConstraint( tag ); // All constraints with the tag are removed from the actor (tag can be set using SetTag)
+@endcode
+
+*
+*/
index c17b910..07cc934 100644 (file)
@@ -149,7 +149,7 @@ void OrientationChanged(const Orientation& orientation)
 int main(int argc, char **argv)
 {
   Application app = Application::New(&argc, &argv);
-  app.GetOrientation().SignalChanged().Connect(&OrientationChanged);
+  app.GetWindow().GetOrientation().SignalChanged().Connect(&OrientationChanged);
 }
 @endcode
 
index 7ab85c7..506934e 100644 (file)
@@ -18,7 +18,7 @@ Stage::GetCurrent().Add(actor);
 The Stage has a 2D size, which matches the size of the application window.  The default coordinate system in Dali has the origin at the top-left corner, with positive X to right, and position Y going
 downwards.  This is intended to be convenient when laying-out 2D views.
 
-\image html coordinate-system-and-stage.png
+![ ](../assets/img/coordinate-system-and-stage.png)
 
 <h2 class="pg">Positioning Actors</h2>
 
@@ -26,19 +26,19 @@ An actor inherits its parent's position.  The relative position between the acto
 
 1) ParentOrigin.  This Vector3 property defines a point within the parent actor's area.
 
-\image html parent-origin.png
+![ ](../assets/img/parent-origin.png)
 
 The default is "top-left", which can be visualized in 2D as (0, 0), but is actually Vector3(0, 0, 0.5) in the 3D Dali world.  The actor's position is relative to this point.
 
 2) AnchorPoint.  This Vector3 property defines a point within the child actor's area.
 
-\image html anchor-point.png
+![ ](../assets/img/anchor-point.png)
 
 The default is "center", which can be visualized in 2D as (0.5, 0.5), but is actually Vector3(0.5, 0.5, 0.5) in the 3D Dali world.  The actor's position is also relative to this point.
 
 3) Position.  This is the position vector between the parent-origin and anchor-point.
 
-\image html actor-position.png
+![ ](../assets/img/actor-position.png)
 
 Therefore by default, an actors position is the distance between its center and the top-left corner of its parent.
 
diff --git a/docs/content/programming-guide/performance-profiling.h b/docs/content/programming-guide/performance-profiling.h
deleted file mode 100644 (file)
index 8e70c5d..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*! \page performance-profiling Performance Profiling
- *
- * <h2 class="pg">Enable Logging</h2>
- *
- * Setting DALI_LOG_PERFORMANCE environment variable will enable performance profiling <br>
- * It uses a bit mask to decide what to log. <br>
- * The log options are:<br>
- * \code
- * Bit 0 = Log update and render threads  (e.g.  DALI_LOG_PERFORMANCE=1 dali-demo)
- * Bit 1 = Log event process time         (e.g.  DALI_LOG_PERFORMANCE=2 dali-demo)
- * Bit 2 = Log Dali markers to trace file (e.g.  DALI_LOG_PERFORMANCE=4 dali-demo)
- *
- * To log both update, render and event times, then combine bits 0 and 1.<br>
- * DALI_LOG_PERFORMANCE=3 dali-demo
- * \endcode
- *
- *
- * <h2 class="pg">Background</h2>
- * The Dali rendering pipeline has 2 stages.
- * Each stage is typically run once per frame.
- * <h3> 1. Update </h3>
- * <ul>
- * <li> Run animations</li>
- * <li> Run constraints</li>
- * <li> Run physics</li>
- * <li> Update the scene-graph</li>
- * </ul>
- * <h3> 2. Render </h3>
- * <ul>
- * <li> Upload 3D data using OpenGL ( textures, vertex buffers etc).</li>
- * <li> Draw the scene using OpenGL</li>
- * </ul>
- *
- *
- * To run at 60 FPS (16 milliseconds per frame), it is recommended to stay below the following times:
- * <ul>
- * <li> Update: 4 milliseconds</li>
- * <li> Render: 4 milliseconds</li>
- * </ul>
- *
- * This will leave enough time for the output to be composited (if the system uses a compositor) and to avoid using
- * too much CPU power.
- * The main Dali application thread which deals with event processing is independent of the update / render threads. <br>
- * This means animations won't stop if the main thread decides to do a long operation like downloading a file from the internet.
- *
- * Performance logging uses Dali log output which on Tizen is dlog, but this can also be used on desktop by redirecting stderr to a file.<br>
- *
- * Example:
- * \code
- * $ export DALI_LOG_PERFORMANCE=1
- * $ dali-demo
- * $
- * $ ...
- * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Update , min 0.59 ms, max 6.43 ms, total (3.4 secs), avg 1.26 ms
- * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Render , min 1.67 ms, max 5.01 ms, total (4.5 secs), avg 3.71 ms
- * \endcode
- *
- * If nothing is animating Dali will enter a paused state to save power. At this
- * point nothing will be logged.
- *
- *
- *  <h2 class="pg">Application profiling</h2>
- *
- *  The main application thread in Dali is used to process and respond to events such as touch, key, mouse, gestures and timers. <br>
- *  The time taken to process events can be measured by setting DALI_LOG_PERFORMANCE environment variable to 2 <br>
- *
- * Example:
- * \code
- * $ export DALI_LOG_PERFORMANCE=2
- * $ dali-demo
- * $
- * $ ...
- * $ INFO: DALI: Event , min 0.01 ms, max 14.99 ms, total (2.4 secs), avg 1.83 ms
- * \endcode
- *
- * Inside the event processing, the application may be listening for certain events. <br>
- * For example when an actor is touched, some application code may be run in an OnTouchEvent callback. <br>
- * By checking the max times you can check for any spikes that occur when interacting with the application.
- *
- * Example:
- * \code
- * $ INFO: DALI: Event , min 0.10 ms, max 500.01 ms, total (6.4 secs), avg 20.83 ms
- *
- * - Something has taken 500 ms = 1/2 second during event processing.
- * - Need to investigate what the application is doing for 1/2 a second.
- * \endcode
- *
- *
- * <h2 class="pg">Logging performance markers to Kernel trace file</h2>
- *
- * Ftrace is a kernel tracer designed to help developers find out what is going on inside the kernel.<br>
- * It can be used for analysing how long Dali takes to perform different tasks and <br>
- * what Dali is doing in relation to other system processes / interrupts.
- *
- * On Tizen if the kernel has been built with ftrace enabled, then Dali can log out to ftrace.<br>
- * This gives exact time stamps of the main events in Dali.
- * Current markers that are logged:
- * <ul>
- * <li> DALI_V_SYNC. The heart beat which represents Dali should start creating a new frame if anything has changed.<br>
- * Typically runs 60 Frames per second, depending on display refresh rate.
- * <li> DALI_UPDATE_START. Dali update task has started.
- * <li> DALI_UPDATE_START. Dali update task has finished
- * <li> DALI_RENDER_START. Dali render task has started
- * <li> DALI_RENDER_END. Dali render task has finished
- * </ul>
- *
- * <h3> Checking ftrace is working on Linux</h3>
- *
- * Documentation for ftrace:
- * Follow these instructions to ensure the debugfs has been mounted, and the kernel you are using
- * has been built with ftrace enabled. <br>
- * https://www.kernel.org/doc/Documentation/trace/ftrace.txt
- *
- * To check ftrace is working:
- * \code
- * $ cd /sys/kernel/debug/tracing
- * $ echo 1 > tracing_enabled    (enabled tracing)
- * $ echo "test" > trace_marker
- * $ echo 0 > tracing_enabled    (disable tracing)
- * $ cat trace
- * #
- * #          TASK-PID    CPU#    TIMESTAMP  FUNCTION
- * #             | |       |          |         |
- *          <...>-2539  [001] 267964.345607: tracing_mark_write: test
- *
- *
- * If the message did not get added to the trace, then check the write permissions on trace_marker file. E.g.
- * $ chmod ugoa+w trace_marker
- * \endcode
- *
- * To view Dali markers in trace file<br>
- *
- * \code
- * $ export DALI_LOG_PERFORMANCE=4
- * $ dali-demo
- * $
- * $ cat /sys/kernel/debug/tracing/trace
- *
- *   <...>-3330  [000] 785155.216611: tracing_mark_write: SPI_EV_DALI_V_SYNC
- *   <...>-3328  [003] 785155.216644: tracing_mark_write: SPI_EV_DALI_UPDATE_START
- *   <...>-3328  [003] 785155.217045: tracing_mark_write: SPI_EV_DALI_UPDATE_END
- *   <...>-3329  [001] 785155.227418: tracing_mark_write: SPI_EV_DALI_RENDER_START
- *   <...>-3329  [001] 785155.227807: tracing_mark_write: SPI_EV_DALI_RENDER_END
- *   <...>-3330  [000] 785155.233336: tracing_mark_write: SPI_EV_DALI_V_SYNC
- *   <...>-3328  [002] 785155.233374: tracing_mark_write: SPI_EV_DALI_UPDATE_START
- *   <...>-3328  [002] 785155.233672: tracing_mark_write: SPI_EV_DALI_UPDATE_END
- *   <...>-3329  [001] 785155.235161: tracing_mark_write: SPI_EV_DALI_RENDER_START
- *   <...>-3329  [001] 785155.235475: tracing_mark_write: SPI_EV_DALI_RENDER_END
- *   <...>-3330  [000] 785155.250029: tracing_mark_write: SPI_EV_DALI_V_SYNC
- *   <...>-3328  [003] 785155.250065: tracing_mark_write: SPI_EV_DALI_UPDATE_START
- *   <...>-3328  [003] 785155.250330: tracing_mark_write: SPI_EV_DALI_UPDATE_END
- *   <...>-3329  [001] 785155.252860: tracing_mark_write: SPI_EV_DALI_RENDER_START
- *   <...>-3329  [001] 785155.253178: tracing_mark_write: SPI_EV_DALI_RENDER_END
- *   <...>-3329  [001] 785155.264508: tracing_mark_write: SPI_EV_DALI_RENDER_START
- *   <...>-3329  [001] 785155.265006: tracing_mark_write: SPI_EV_DALI_RENDER_END
- * \endcode
- */
diff --git a/docs/content/programming-guide/performance-tips.h b/docs/content/programming-guide/performance-tips.h
deleted file mode 100644 (file)
index 969054a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*! \page performance-tips Performance Tips
-
-
-<table>
-  <tr>
-    <th>High CPU occupancy <br></th>
-  </tr>
-  <tr>
-  <td>
-       - Try to reduce actor count ( less actors == less processing) <br>
-       - Delete any actors that are not visible, or move them off stage <br>
-       - Use TextureAtlases ( greatly reduces OpenGL driver calls to glBindTexture <br>
-       - Optimise / reduce any constraints used
-       </td>
-       </tr>
-</table>
-<br><br>
-<table>
-  <tr>
-    <th>High GPU occupancy <br></th>
-  </tr>
-  <tr>
-  <td>
-       - Reduce visible actor count ( == less draw calls) <br>
-       - For 2D UI graphics which require no z sorting use @code Actor::SetDrawMode( DrawMode::OVERLAY );
-// In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
-        @endcode
-       - Use TextureAtlases ( reduces state changes in the GPU) <br>
-       - Use compressed textures
-       - Use lower quality textures, e.g. smaller, lower number of bits per pixel
-       - Use Dali::NinePatchImage  where possible.
-       - Avoid using too many textures which contain alpha and require blending
-       - Avoid using too many Dali::Layer with depth testing enabled. Otherwise the layer has to clear the depth buffer.
-       - Optimise any shaders used. Pixel shaders should be kept as lean as possible.
-       </td>
-       </tr>
-</table>
-
- */
diff --git a/docs/content/programming-guide/resource-tracking.h b/docs/content/programming-guide/resource-tracking.h
deleted file mode 100644 (file)
index 5782eff..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*! \page resource-tracking Resource Tracking
- *
- *
- * <h2 class="pg">Enable Logging</h2>
- * Setting DALI_ENABLE_LOG environment variable to RESOURCE_LOG will enable resource usage logging in Dali applications.<br>
- *
- * On target resource logging utilizes dlog, but this can also be used on desktop by redirecting stderr to a file.<br>
- *
- * The generated information includes any image files that are loaded with their dimensions,<br>
- *  GPU memory consumption, CPU RAM used and details of texture atlases created.
- *
- * <h2 class="pg">Viewing Resource Logs</h2>
- * dalireslog.sh is installed as part of the dali-adaptor package and can be found in the adaptors/tizen/scripts folder.<br>
- * The script shows a summary of memory used by resources.
- *
- * USAGE:
- * ./dalireslog.sh [FILE]<br>
- * if FILE isn't specified, the script will try to use dlogutil.
- *
- * Example:
- *
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sh-4.1$ ./dalireslog.sh<br>
- *
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>On a separate terminal:</i><br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sh-4.1$ DALI_ENABLE_LOG=RESOURCE_LOG /opt/apps/com.samsung.dali-demo/bin/album.example
- *
- * Example on desktop:<br><br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jon-doe\@ws-1234$ DALI_ENABLE_LOG=RESOURCE_LOG blind-effect.example 2>/home/SERILOCAL/john.doe/log.txt<br>
- *
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>On a separate terminal:</i><br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dalireslog.sh ~/log.txt
- *
- * Displayed information:<br>
- *
- * <ul>
- * <li>3D - amount of GPU memory used by application.<br>
- * <li>MEM Atlas - amount of GPU memory used by texture atlases (usually this refers to font atlases). <br>
- * <li>Number of atlases - how many texture atlases are present in memory.<br>
- * </ul>
- * A list of files is displayed in the main view, with different color codes representing different states:<br>
- *
- * <ul>
- * <li>CPU - resource is in memory, but hasn't been uploaded to a GL texture.<br>
- * <li>GPU - resource has been uploaded to a GL texture, bitmap buffer discarded.<br>
- * <li>CPUGPU - resource has been uploaded to a GL texture, but still present in CPU memory as well.<br>
- * <li>DISCARDED - resource has been discarded, memory freed up.
- * </ul>
- */
diff --git a/docs/content/programming-guide/script-howto.h b/docs/content/programming-guide/script-howto.h
deleted file mode 100644 (file)
index b9d3da0..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*! \page script-howto Scripting HowTo
- *
- * <h2 class="pg">Scripting A Custom Control</h2>
- *
- * These steps must be taken to provide scripting access for your control.
- *
- * <ul>
- *   <li>Register your class Type.
- *   <li>Register Signals and Actions (optional).
- *   <li>Register properties (optional).
- * </ul>
- *
-*
- * <h3 class="pg">Registering your Type, Signals and Actions</h3>
- *
- * As part of your <b>my-actor.cpp</b> a <em>static</em> "Dali::TypeRegistration" object is created to register MyActor for scripting.
- *
- * Functions for Creation, Signal Connection and Action are registered with this object.
- *
- * @code
- * namespace   // type registration
- * {
- *
- * // Register MyActor with base actor CustomActor and creation function CreateCustom
- * Dali::TypeRegistration mCustomType( typeid(MyActor), typeid(Dali::CustomActor), MyActor::Create );
- *
- * // Add a signal to the type registration
- * Dali::TypeSignalConnector signal1( mCustomType, "page-changed", MyActor::DoConnectSignalCustom);
- *
- * // Add an action to the type registration
- * Dali::TypeAction action1( mCustomType, "SelectPage", MyActor::DoActionCustom);
- *
- * }
- * @endcode
- *
- * The registered handling functions are also static. For example.
- *
- * @code
- * BaseHandle MyActor::Create(void)
- * {
- *   return MyActor::New();
- * }
- *
- * Dali::Connection MyActor::DoConnectSignalCustom(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
- * {
- *   Dali::Connection connection ;
- *
- *   MyActor* actor = dynamic_cast<MyActor*>(object);
- *
- *   if(actor && "page-changed" == signalName)
- *   {
- *     connection = return actor->PageChangedSignal().Connect( tracker, functor );
- *   }
- *
- *   return connection ;
- * }
- *
- * bool MyActor::DoActionCustom(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
- * {
- *   bool actioned = false ;
- *
- *   MyActor* actor = dynamic_cast<MyActor*>(object) ;
- *
- *   if(actor && "SelectPage" == actionName)
- *   {
- *      actor->DoSelectPage() ;
- *      actioned = true;
- *   }
- *
- *   return actioned ;
- * }
- * @endcode
- *
- * <h3 class="pg">Providing Properties for scripting</h3>
- *
- * Properties can be registered by name to allow script access.
- *
- * A RegisterProperty() call with property attributes allows the custom class to register non animatable properties.
- *
- * @code
- * void MyActor::Initialize()
- * {
- *   // Register a non animatable and writeable property.
- *   mPropertyAlphaIndex = Self().RegisterProperty("alpha", 0.0f, Dali::Property::WRITEABLE);
- * }
- * @endcode
- *
- * If a non animatable property is set then the class is notified via the OnPropertySet virtual function.
- *
- * @code
- * void MyActor::OnPropertySet(Property::Index index, Property::Value propertyValue)
- * {
- *  if(index == mPropertyAlphaIndex)
- *  {
- *    SetAlpha(propertyValue.<float>Get());
- *  }
- * }
- *
- * @endcode
- *
- */
diff --git a/docs/content/programming-guide/script-overview.h b/docs/content/programming-guide/script-overview.h
deleted file mode 100644 (file)
index f9eb951..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*! \page script-overview Scripting Overview
- *
- * Dali has scripting support to
- *
- * <ul>
- *   <li>Provide a mechanism to allow custom controls in scripting.
- *   <li>Support layouts using JSON.
- *   <li>Support a dynamic Javascript runtime.
- * </ul>
- *
- * This is accessed via the Dali script external application which wraps Dali with a scripting engine. For example
- *
- * @code
- * daliscript hello-world.js
- * @endcode
- *
- * <h1 class="pg">A Mechanism To Allow Custom Controls in Scripting</h1>
- *
- * <h2 class="pg">The TypeRegistry</h2>
- *
- * The TypeRegistry allows class 'types' to register themselves as creatable from a scripting environment.
- *
- * Custom controls can register a creation function using class run time type information (RTTI).
- *
- * The RTTI typeid provides Dali with a unique name to register the type. In this registration the creation function is responsible for creating new instances of the custom class.
- *
- * Signals can be added to this type registration with a signal connection function.
- *
- * Actions can be similarly added with an action function.
- *
- *
- * <h2 class="pg">Non Animatable Properies</h2>
- *
- * The property system has non animatable properties that can be used by the scripting runtime to set actor attributes.
- *
- * Custom controls can register properties for scripting access. The custom control is notified of a non animatable property value change.
- *
- *
- * <h2 class="pg">A Javascript example</h2>
- *
- * A Javascript runtime wrapping Dali and the V8 Javacript engine is being developed to allow the creation of pure Javascript applications.
- *
- * ie 'daliscript helloworld.js'.
- *
- * This example shows how a Javacript file relates to the TypeRegistry and Property system.
- *
- * @code
- * // Creation
- * // This line looks for a type registered as "MyActor" and calls its creation function
- * var custom = new MyActor();
- *
- * // Property access
- * // This line finds a property called "alpha" and Sets with SetProperty(index, Property::Value(2.0))
- * // If the property is non animatable it calls OnPropertySet(Property::Value(2.0))
- * custom.alpha = 2.0;
- *
- * // NB: non animatable properties can be strings
- * custom.text = "a label";
- *
- * // Actions
- * // This line finds the action function registered as "SelectPage" and calls its with a list of arguments
- * // (NB: arguments are currently limited to non aggregate types ie no list, maps or objects)
- * custom.SelectPage("one");
- *
- * // Signals
- * // This line finds the signal registered as "touched" and sets the "OnTouch" callback function
- * custom.signals.touched = OnTouch;
- *
- * // OnTouch could have been previously defined as
- * function OnTouch(name)
- * {
- *   custom.text = name
- * }
- * @endcode
- *
- * <h1 class="pg">Supporting Layouts Using JSON</h1>
- *
- * The builder in Dali Toolkit provides a means to define layouts using the JSON file format.
- *
- * This format defines a text representation for key value pairs and lists of data. Lists and Maps can hold the fundamental Javascript data types of string, number(float/int), true, false, nil.
- *
- * *** Current Status
- *
- * Currently the builder supports internal Toolkit and Dali controls.
- *
- * *** Next Iteration
- *
- * The builder will be improved to make use of the TypeRegistry and non animatable properties and allow Custom Controls to be added into Scripting.
- *
- * This means the current JSON format will alter slightly (for example; properties will not be defined as a tree but as one level below the actor definition)
- *
- * An actor tree defined in JSON will be retrievable as a "Buildable" class instance.
- *
- * This buildable class allows the creation of the actor tree. It will also aid resource managment as a buildable can store the layout representation and unload resources when off stage (reconstructing the object when its added back onto the stage).
- *
- * <h1 class="pg">Supporting A Javascript Runtime</h1>
- *
- * As a separate project an application will be available that can execute Javascript.
- *
- * This application will provide a wrapping layer between V8 and Dali and allow a natural interface to the Javascript developer.
- *
- *
- *
- *
- *
- *
- *
- *
- */
diff --git a/docs/content/programming-guide/texture-atlases.h b/docs/content/programming-guide/texture-atlases.h
deleted file mode 100644 (file)
index b664d3e..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*! \page texture-atlases Texture Atlases
- *
- * <h2 class="pg">Using Texture Atlases in DALi </h2>
- *
- *
- * <h3> Example demo application </h3>
-
-  \image html image-wall.jpg
-
-
-<h3> Application above is running slow as there are many small individual images displayed (50)</h3>
-
-<table>
-  <tr>
-    <td> Launch Time </td>
-    <td> Slow </td>
-    <td> Has to perform: <br>- 50 file open requests and multiple reads for each image</td>
-  </tr>
-  <tr>
-    <td> Memory Usage </td>
-    <td> High </td>
-    <td> Has to create:
-      <br>- 50 Dali::Image objects
-      <br>- 50 OpenGL Textures
-    </td>
-  </tr>
-  <tr>
-    <td>Rendering Performance </td>
-    <td> Slow </td>
-    <td> Has to perform:
-      <br>- 50 glBindTexture calls per frame ( each OpenGL calls takes time)
-      <br>- 50 a frame = 3000 calls per second @60 FPS.
-      <br>- Texture switching is a major state change in the GPU
-    </td>
-  </tr>
-</table>
-<br><br>
-
-
-* <h3> Solutions to problem: Use a Texture Atlas</h3>
-
-A texture atlas is simply one larger image that contains smaller images. A texture atlas is sometimes called a
-sprite sheet, bitmap sheet or texture pack.
-
- \image html atlas.jpg
-
-<br>
-Dali::ImageActor has the ability to display a portion of an image using ImageActor::PixelArea setting.
-For example to display the first 3 image in the atlas
-
-  \image html example-code.jpg
-
-<h3> Result of using an Atlas</h3>
-<table>
-  <tr>
-    <td> Launch Time </td>
-    <td> Fast </td>
-    <td> Has to perform: <br>- 1 file open request </td>
-  </tr>
-  <tr>
-    <td> Memory Usage </td>
-    <td> Better </td>
-    <td> Has to create:
-      <br>- 1 Dali::Image objects
-      <br>- 1 OpenGL Textures
-    </td>
-  </tr>
-  <tr>
-    <td>Rendering Performance </td>
-    <td> Fast </td>
-    <td> Has to perform:
-      <br>- 1 glBindTexture calls per frame ( each OpenGL calls takes time)
-      <br>- 1 a frame = 6- calls per second @60 FPS.
-    </td>
-  </tr>
-</table>
-<br>
-<h2> Atlas creation guide </h2>
-
-Many tools exist for creating texture atlases.<br>
-In the following example we are using a tool called TexturePacker as DALi has an exporter script for it.
-The exporter automatically generates a source file that has the ImageActor::PixelArea pre-defined.
-<br>
-<ul>
-  <li> Download http://www.codeandweb.com/texturepacker </li>
-  <li> Launch TexturePacker </li>
-  <li> Go to the menu File -> Preferences</li>
-  <li> Set the "Exporter directory" to be the location of dali-toolkit/texture-atlas-exporter  <br></li>
-  \image html texture-packer-preferences.jpg
-  <br>
-  <li> <b> Restart the application! </b></li>
-  <li> Select DALi 3D framework for new project</li>
-  <br>
-  \image html texture-packer-startup.jpg
-  <br>
-  <li><h3> Create the atlas </h3> <br></li>
-  \image html texture-packer-add-sprites.jpg <br><br>
-  <li><h3> Click publish to produce the files </h3></li><br><br>
-  \image html texture-packer-publish.jpg  <br><br>
-</ul>
-<h2> Using the generated cpp file </h2>
-
-The generated cpp file contains 3 different ways of describing the atlas. <br>
-Copy and paste the section that best suits your application.
-<ul><li> Lookup table. Includes code for storing the table in a std::map for fast lookup.</li>
-<li> constants.  </li>
-<li> JavaScript property map ( see the Dali JavaScript programming guide on how to use it).
-</ul>
-<h3> Using the lookup table </h3>
-
-Cut and paste the lookup table code into your application.
-
-\code
-
-\\ The following code is automatically generated.
-\\
-const char* ATLAS_FILE_NAME( "my_first_atlas.png" );  ///< Atlas image filename
-
-/**
- * Structure to hold image name and position within the atlas.
- *
- */
-struct ImageInfo
-{
-  const char* name;
-  unsigned int x,y,w,h;
-  Dali::BlendingMode::Type blendMode;  // only enable blending if image has alpha
-};
-
-/**
- * lookup table
- */
-const ImageInfo ImageAtlas[]=
-{
- { "blocks-ball", 2, 198, 51, 51, BlendingMode::ON },
- { "bubble-ball", 288, 74, 32, 32, BlendingMode::ON },
- { "gallery-small-52", 2, 2, 128, 128, BlendingMode::OFF },
- { "icon-change", 219, 2, 37, 34, BlendingMode::ON },
- { "icon-cluster-carousel", 180, 2, 37, 34, BlendingMode::ON }
-};
-
-const ImageInfo* GetImageInfo(const char* name)
-{
-  typedef std::map< const char*, const ImageInfo* > LookupMap;
-  static LookupMap lookup;
-  if( lookup.empty() )
-  {
-    for( unsigned int i = 0; i < ATLAS_IMAGE_COUNT; ++i)
-    {
-      lookup[ ImageAtlas[i].name ] =  &ImageAtlas[i];
-    }
-  }
-  LookupMap::const_iterator iter = lookup.find(name);
-  if( iter != lookup.end() )
-  {
-   return (*iter).second;
-  }
-  DALI_ASSERT_ALWAYS(0 && "image name not found in atlas");
-  return NULL;
-}
-
-\endcode
-
-To use the lookup table you can do something like this:
-\code
-
-// Example function on how to get an image info from the table
-
-std::string fileName = std::string( DALI_IMAGE_DIR ) + ATLAS_FILE_NAME;
-Image imageImage = Image::New( fileName );
-
-const ImageInfo* info(NULL);
-
-info = GetImageInfo("blocks-ball");
-if( info)
-{
-  ImageActor ballActor = ImageActor::New( imageAtlas, ImageActor::PixelArea( info->x, info->y, info->w, info->h) );
-  ballActor->SetBlendMode( info->blendMode );
-}
-info = GetImageInfo("bubble-ball");
-if( info)
-{
-  ImageActor bubbleActor = ImageActor::New( imageAtlas, ImageActor::PixelArea( info->x, info->y, info->w, info->h) );
-  bubbleActor->SetBlendMode( info->blendMode );
-}
-
-\endcode
-<h3> Using the constant definitions </h3>
-
-1. Cut and paste the constant definition code into your application.
-
-You'll notice the code below won't compile because C++ variables can't have a dash character.<br>
-E.g. BLOCKS-BALL, BUBBLE-BALL will cause errors. Do a search and replace for - and replace with underscores.
-This is one reason why using lookup table which holds the filename as a string maybe easier to use.
-
-\code
-\\ The following code is automatically generated.
-\\
-const char* ATLAS_FILE_NAME( "my_first_atlas.png" );
-
-/**
- * Structure to hold position / blend mode within the atlas.
- *
- */
-struct ImageInfo
-{
-  ImageInfo(unsigned int x,unsigned int y,unsigned int w,unsigned int h,  Dali::BlendingMode::Type mode)
-  :pixelArea(x,y,w,h),blendMode(mode)
-  {}
-  ImageActor::PixelArea pixelArea;
-  Dali::BlendingMode::Type blendMode;  // only enable blending if image has alpha
-};
-
-
-const ImageInfo BLOCKS-BALL( 2, 198, 51, 51 ,BlendingMode::ON );
-const ImageInfo BUBBLE-BALL( 288, 74, 32, 32 ,BlendingMode::ON );
-const ImageInfo GALLERY-SMALL-52( 2, 2, 128, 128 ,BlendingMode::OFF );
-\endcode
-
-2. To use it, you can copy example code from the generated cpp file which looks
-like this
-\code
-void LoadAtlasImages()
-{
-  std::string fileName = std::string(DALI_IMAGE_DIR) + ATLAS_FILE_NAME;
-  Image atlasImage = Image::New( fileName );
-  ImageActor Blocksball = ImageActor::New( atlasImage,  BLOCKS_BALL.pixelArea);
-  Blocksball.SetBlendMode( BLOCKS_BALL.blendMode );
-
-  ImageActor Bubbleball = ImageActor::New( atlasImage,  BUBBLE_BALL.pixelArea);
-  Bubbleball.SetBlendMode( BUBBLE_BALL.blendMode );
-  ...
- \endcode
-
-
-
-<br><br>
-<h2> Atlas creation tips </h2>
-
-<ul>
-  <li> Compress the atlas  - \link Texture_Compression Compressing Textures \endlink <br></li>
-  <li> Avoid adding large images to the Atlas.<br>
-    E.g. don't add background images to it. Medium to large images should
-    be kept seperate. <br><br>
-    \image html atlas-size.jpg
-    <br><br>
-  </li>
-  <li> Try to ensure the atlas contains only images that are frequently used. <br>
-    There's no point in having images taking up GPU texture memory if they're not displayed.<br>
-  </li>
-  <li> Avoid very large atlases <br>
-    Try to create multiple atlases based on how they are used within your application.<br>
-    <br>
-    Alternatively Texture packer has the option to split atlases ( search help for Multipack)
-  </li>
-</ul>
-
-
-
- */
-
index 3be5549..a1200e6 100644 (file)
@@ -1,18 +1,44 @@
 /**
  *
-## Writing documentation for the DALi programing guide
+
+# Writing documentation for the DALi programing guide  {#documentationguide}
 
 To allow documentation to be shared between C++ and JavaScript, please follow these guidelines:
 
  - Create a mark down file (.md) using GitHub Flavoured Markdown https://help.github.com/articles/github-flavored-markdown/
- - Put it into the shared C++ / JavaScript documentation: ~dali-toolkit/docs/content/shared-javascript-and-cpp-documentation/~
+ - Put it into the shared C++ / JavaScript documentation: dali-toolkit/docs/content/shared-javascript-and-cpp-documentation/~
  - Include code samples for both C++ and JavaScript in the mark down.
- - See multi-touch-guide.md in toolkit for an example
+ - See script-overview.md overview in dali-toolkit/docs/content/shared-javascript-and-cpp-documentation for an example
+ - For YUIDOC to parse the file it needs:
+   - Enclosed in code comment block
+   - Have a class tag with a description of the file
+ - For DOXYGEN to link to the mark down it currently needs a reference {hash myfile}
+  
+
+#### Images
+ Images are shared between both Doxygen and YUIDOC tools using a symbolic link.
+ You need to link to the image twice in shared documentation.
+ This is because YUIDOC stores images in a folder called assets/img/  which is relative to the HTML pages.
+ Where as Doxygen copies all images in to the same folder as the HTML generated pages.
+
+ ~~~
+![ ](../assets/img/screen-shot.png)    // required for YUIDOC
+![ ](screen-shot.png)                  // required for Doxygen
+
+The space between the brackets is the alternative text. This means you will never see a broken image symbol.
+~~~
   
-Why use GitHub flavoured markdown?
+## Example
+![ ](../assets/img/example-documentation/example-code.png)
+![ ](example-code.png)
+
+
+
+#### Why use GitHub flavoured markdown?
  - Table support is good and language specific code blocks are easier to define ( javascript/C++).
  - Doxygen and YUIDOC both support it.
 
 
-@class Writing_DALi_Programming_Guide_Documentation
+@class _Guide_Writing_DALi_Programming_Guide_Documentation
+
 */
diff --git a/docs/content/shared-javascript-and-cpp-documentation/javascript-wrapping-guide.md b/docs/content/shared-javascript-and-cpp-documentation/javascript-wrapping-guide.md
new file mode 100644 (file)
index 0000000..50dd022
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ *
+# JavaScript wrapping guide  {#javascriptwrapping}
+
+This guide outlines what files to modify when the DALi C++ public API changes.
+
+## Background
+
+We use Google's V8 to run JavaScript code.
+https://developers.google.com/v8/get_started
+
+#### Folder structure
+
+There is a folder for each type of wrapped object.
+  
+
+The filename for a wrapped type are always object-wrapper.xxx
+The filename for the static functions that forward calls to DALi are always object-api.xxx
+  
+The current file / folder structure is as follows:
+  
+![ ](../assets/img/javascript-wrapping-guide/folder-view.png)
+![ ](folder-view.png)
+
+
+## What to do when the DALi public API changes:
+
+### New property has been added
+- No code change required.
+- It will be automatically avalable using the dot notation. E.g. actor.my_new_property = true;
+
+### New property type has been added
+- modify property-value-wrapper.h / .cpp to support the new type
+
+### New function added to an object
+- Add the function name to function table in my-object-wrapper.cpp
+- Add the forwarding function to my-object-api.cpp/.h
+- Ensure you have created YUIDOC documention above the function
+  
+![ ](../assets/img/javascript-wrapping-guide/adding-function.png)
+![ ](adding-function.png)
+
+### New object added
+
+This is an example of wrapping a new DALi C++ object called Light.
+
+- in dali-wrapper.cpp in ConstructorFunctionTable insert the constructor in the table.
+  
+![ ](../assets/img/javascript-wrapping-guide/constructors.png)
+![ ](constructors.png)
+  
+
+Objects registered in this table can be created in JavaScript as follows:
+
+~~~{.js}
+var light = new dali.Light();
+~~~
+
+- Add the Light to the Type enum in BaseWrappedObject class.
+  
+![ ](../assets/img/javascript-wrapping-guide/base-wrapped-types.png)
+![ ](base-wrapped-types.png)
+  
+
+-  Create the light-wrapper / light-api files
+  
+If Light inherits from Handle then use path-wrapper and path-api as a template to create light-wrapper and light-api
+( inherits from HandleWrapper)
+  
+Otherwise use animation-wrapper and animation-api as a template ( inherts from BaseWrappedObject)
+
+
+
+## Design
+![ ](../assets/img/javascript-wrapping-guide/high-level-design.png)
+![ ](high-level-design.png)
+
+
+![ ](../assets/img/javascript-wrapping-guide/plugin-creation.png)
+![ ](plugin-creation.png)
+
+
+![ ](../assets/img/javascript-wrapping-guide/plugin-execution.png)
+![ ](plugin-execution.png)
+
+### Internals
+In order to wrap DALi C++ objects in JavaScript, we use
+hidden fields inside the JavaScript object.
+
+
+  
+| JavaScript Object                     |   _   |  C++ WrappedObject  (e.g. ImageWrapper)|
+|---------------------------------------|-------|----------------------------------------|
+| Hidden internal fields                |       |                                        |
+| *Pointer to a     WrappedObject       | ----> |      Handle to a Dali::Image object    |
+| Type of wrapped object (e.g. Image)   |       |                                        |
+  
+
+So if you call
+~~~{.js}
+var name = myActor.getId();
+~~~
+v8 will detect myActor is a wrapped object, and call getId() on that wrapped object.
+The wrapped object, then forwards the command to the real DALi object.
+  
+Whenever we want to access functions / properties of that wrapped object, we unwrap it
+to get access to the Dali object.
+  
+Each wrapped object registers with Dali garbage collector so they can be deleted
+when Dali shuts down
+
+@class _Guide_JavaScript_Wrapping`
+*/
\ No newline at end of file
diff --git a/docs/content/shared-javascript-and-cpp-documentation/performance-profiling.md b/docs/content/shared-javascript-and-cpp-documentation/performance-profiling.md
new file mode 100644 (file)
index 0000000..1fb8f06
--- /dev/null
@@ -0,0 +1,258 @@
+/**
+ *
+
+# Performance Profiling  {#performanceprofiling}
+
+
+DALi has many mechanisms for analysing performance including kernel, system and network logging.
+
+
+## Background
+The Dali rendering pipeline has 2 stages.
+
+Each stage is typically run once per frame.
+
+- Update
+  - Run animations
+  - Run constraints
+  - Run physics
+  - Update the scene-graph
+- Render
+  - Upload 3D data using OpenGL ( textures, vertex buffers etc).
+  - Draw the scene using OpenGL
+  
+
+Update produces data - **Writes** final object positions to a buffer
+  
+Render consumes data - **Reads** object positions from a buffer and draws with OpenGL
+
+![ ](../assets/img/performance/update-render.png)
+![ ](update-render.png)
+
+  
+One reason for having 2 buffers is to allow both tasks to overlap and run in parallel in certain situations.
+E.g. if rendering is taking a long time (due to a texture upload), the Update thread can start work producing
+data for the next frame. The aim being to take advantage of multi-core CPU's.
+  
+To run at a solid 60 FPS (16 milliseconds per frame), it is recommended to stay below the following times:
+  
+ - Update: 4 milliseconds
+ - Render: 4 milliseconds
+  
+This will leave enough time for the output to be composited (if the system uses a compositor) and to avoid using
+too much CPU power.
+  
+The main Dali application thread which deals with event processing is independent of the update / render threads.
+This means animations won't stop if the main thread decides to do a long operation like downloading a file from the internet.
+  
+
+## Time Stamp Logging
+
+This type of logging is used for recording individual time stamped events.
+  
+Setting DALI_PERFORMANCE_TIMESTAMP_OUTPUT environment variable will enable time stamps.
+
+Tools such as Tizen dynamic analyser and StageHand can be used to provide a GUI display of
+the output.
+
+
+The log options are:
+
+|  Bit |  Function                | Example      |
+|------|--------------------------|--------------|
+|   0  |  log markers to DALi log (dlog on Tizen) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=1 dali-demo |
+|   1  |  log markers to kernel trace ( logs to ftrace )| DALI_PERFORMANCE_TIMESTAMP_OUTPUT=2 dali-demo |
+|   2  |  log markers to system trace ( ttrace on Tizen for Tizen analyser) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=4 dali-demo |
+|   3  |  log markers to network client (tcp port 3001+) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=8 dali-demo |
+
+  
+
+~~~
+DALI_PERFORMANCE_TIMESTAMP_OUTPUT=1 dali-demo
+INFO: DALI: 1134155.500142 (seconds), V_SYNC
+INFO: DALI: 1134155.500167 (seconds), UPDATE_START
+INFO: DALI: 1134155.500214 (seconds), PROCESS_EVENT_END
+INFO: DALI: 1134155.500659 (seconds), UPDATE_END
+INFO: DALI: 1134155.508039 (seconds), PROCESS_EVENT_START
+INFO: DALI: 1134155.508295 (seconds), PROCESS_EVENT_END
+INFO: DALI: 1134155.511109 (seconds), RENDER_START
+INFO: DALI: 1134155.511548 (seconds), RENDER_END
+INFO: DALI: 1134155.516899 (seconds), V_SYNC
+INFO: DALI: 1134155.516945 (seconds), UPDATE_START
+INFO: DALI: 1134155.517462 (seconds), UPDATE_END
+INFO: DALI: 1134155.527884 (seconds), RENDER_START
+INFO: DALI: 1134155.528108 (seconds), PROCESS_EVENT_START
+INFO: DALI: 1134155.528327 (seconds), RENDER_END
+INFO: DALI: 1134155.528358 (seconds), PROCESS_EVENT_END
+INFO: DALI: 1134155.528388 (seconds), PROCESS_EVENT_START
+INFO: DALI: 1134155.528749 (seconds), PROCESS_EVENT_END
+INFO: DALI: 1134155.533672 (seconds), V_SYNC
+~~~
+
+### Markers that are logged
+
+| Marker | Description
+|--------|-------------
+| V_SYNC.| The heart beat which represents Dali should start creating a new frame if anything has changed. Runs at display refresh rate, typically 60Hz |
+| UPDATE_START | Dali update task has started |
+| UPDATE_START | Dali update task has finished |
+| RENDER_START | Dali render task has started |
+| RENDER_END | Dali render task has finished |
+| PROCESS_EVENT_START | Dali main thread processing events (e.g. in response to a touch event or a timer) |
+| PROCESS_EVENT_START | Dali main thread processing events finished |
+| SWAP_START | glSwapBuffers started (todo) |
+| SWAP_END | glSwapBuffers end  (todo) |
+| PAUSE  | Application paused |
+| RESUME | Application resumed |
+
+### Custom time stamps for application developers
+
+A developer can output custom markers using the PerformanceLogger API (C++ only currently)
+
+~~~
+PerformanceLogger logger = PerformanceLogger::New("MyMarker");
+logger.AddMarker(PerformanceLogger::START_EVENT);
+
+// do stuff
+
+logger.AddMarker(PerformanceLogger::END_EVENT);
+~~~
+
+## Statistics logging
+
+Statistics logging uses Dali log output which on Tizen is dlog, but this can also be used on desktop by redirecting stderr to a file.
+
+Setting DALI_LOG_PERFORMANCE_STATS environment variable will enable time stamps.
+
+The log options are:
+
+|  Bit |  Function                | Example      |
+|------|--------------------------|--------------|
+|   0  |  log all statistics to the DALi log | DALI_LOG_PERFORMANCE_STATS=1 dali-demo |
+|   1  |  log update and render statistics to the DALi log| DALI_LOG_PERFORMANCE_STATS=2 dali-demo |
+|   2  |  log event (main) task statistics to the DALi log| DALI_LOG_PERFORMANCE_STATS=4 dali-demo |
+|   3  |  log custom marker statistics to the DALi log | DALI_LOG_PERFORMANCE_STATS=8 dali-demo |
+
+Example output
+~~~
+$ export DALI_LOG_PERFORMANCE_STATS=1
+$ dali-demo
+
+ Event, min 0.04 ms, max 5.27 ms, total (0.1 secs), avg 0.28 ms, std dev 0.73 ms
+ Update, min 0.29 ms, max 0.91 ms, total (0.5 secs), avg 0.68 ms, std dev 0.15 ms
+ Render, min 0.33 ms, max 0.97 ms, total (0.6 secs), avg 0.73 ms, std dev 0.17 ms
+ TableViewInit, min 76.55 ms, max 76.55 ms, total (0.1 secs), avg 76.55 ms, std dev 0.00 ms
+~~~
+
+If nothing is animating Dali will enter a paused state to save power. At this
+point nothing will be logged.
+
+### Custom statistics for application developers
+
+This is identical to the custom timestamp example.
+~~~
+PerformanceLogger logger = PerformanceLogger::New("MyMarker");
+logger.AddMarker(PerformanceLogger::START_EVENT);
+
+// do stuff
+
+logger.AddMarker(PerformanceLogger::END_EVENT);
+~~~
+
+
+## Application profiling
+
+ The main application thread in Dali is used to process and respond to events such as touch, key, mouse, gestures and timers.
+
+Example:
+~~~
+$ export DALI_LOG_PERFORMANCE_STATS=4
+$ dali-demo
+$
+$ ...
+$ INFO: DALI:  Event, min 0.04 ms, max 5.27 ms, total (0.1 secs), avg 0.28 ms, std dev 0.73 ms
+~~~
+
+Inside the event processing, the application may be listening for certain events.
+For example when an actor is touched, some application code may be run in an OnTouchEvent callback.
+By checking the max times you can check for any spikes that occur when interacting with the application.
+
+Example:
+~~~
+$ INFO: DALI: Event , min 0.10 ms, max 500.01 ms, total (6.4 secs), avg 20.83 ms
+
+- Something has taken 500 ms = 1/2 second during event processing.
+- Need to investigate what the application is doing for 1/2 a second.
+~~~
+
+
+## Using ftrace for timestamp logging
+
+~~~
+DALI_PERFORMANCE_TIMESTAMP_OUTPUT=2 dali-demo
+~~~
+
+Ftrace is a kernel tracer designed to help developers find out what is going on inside the kernel.
+It can be used for analysing how long Dali takes to perform different tasks and
+what Dali is doing in relation to other system processes / interrupts.
+  
+On Tizen if the kernel has been built with ftrace enabled, then Dali can log out to ftrace.
+This gives exact time stamps of the main events in Dali.
+Current markers that are logged:
+
+
+
+### Checking ftrace is working on Linux
+
+Documentation for ftrace:
+Follow these instructions to ensure the debugfs has been mounted, and the kernel you are using
+has been built with ftrace enabled.
+
+https://www.kernel.org/doc/Documentation/trace/ftrace.txt
+
+To check ftrace is working:
+~~~
+$ cd /sys/kernel/debug/tracing
+$ echo 1 > tracing_enabled    (enabled tracing)
+$ echo "test" > trace_marker
+$ echo 0 > tracing_enabled    (disable tracing)
+$ cat trace
+#
+#          TASK-PID    CPU#    TIMESTAMP  FUNCTION
+#             | |       |          |         |
+         <...>-2539  [001] 267964.345607: tracing_mark_write: test
+
+
+If the message did not get added to the trace, then check the write permissions on trace_marker file. E.g.
+$ chmod ugoa+w trace_marker
+~~~
+To view Dali markers in trace file
+
+~~~
+$ export DALI_LOG_PERFORMANCE=2
+$ dali-demo
+$
+$ cat /sys/kernel/debug/tracing/trace
+
+  <...>-3330  [000] 785155.216611: tracing_mark_write: SPI_EV_DALI_V_SYNC
+  <...>-3328  [003] 785155.216644: tracing_mark_write: SPI_EV_DALI_UPDATE_START
+  <...>-3328  [003] 785155.217045: tracing_mark_write: SPI_EV_DALI_UPDATE_END
+  <...>-3329  [001] 785155.227418: tracing_mark_write: SPI_EV_DALI_RENDER_START
+  <...>-3329  [001] 785155.227807: tracing_mark_write: SPI_EV_DALI_RENDER_END
+  <...>-3330  [000] 785155.233336: tracing_mark_write: SPI_EV_DALI_V_SYNC
+  <...>-3328  [002] 785155.233374: tracing_mark_write: SPI_EV_DALI_UPDATE_START
+  <...>-3328  [002] 785155.233672: tracing_mark_write: SPI_EV_DALI_UPDATE_END
+  <...>-3329  [001] 785155.235161: tracing_mark_write: SPI_EV_DALI_RENDER_START
+  <...>-3329  [001] 785155.235475: tracing_mark_write: SPI_EV_DALI_RENDER_END
+  <...>-3330  [000] 785155.250029: tracing_mark_write: SPI_EV_DALI_V_SYNC
+  <...>-3328  [003] 785155.250065: tracing_mark_write: SPI_EV_DALI_UPDATE_START
+  <...>-3328  [003] 785155.250330: tracing_mark_write: SPI_EV_DALI_UPDATE_END
+  <...>-3329  [001] 785155.252860: tracing_mark_write: SPI_EV_DALI_RENDER_START
+  <...>-3329  [001] 785155.253178: tracing_mark_write: SPI_EV_DALI_RENDER_END
+  <...>-3329  [001] 785155.264508: tracing_mark_write: SPI_EV_DALI_RENDER_START
+  <...>-3329  [001] 785155.265006: tracing_mark_write: SPI_EV_DALI_RENDER_END
+~~~
+@class _Guide_Performance_Profiling
+*/
+
+
diff --git a/docs/content/shared-javascript-and-cpp-documentation/performance-tips.md b/docs/content/shared-javascript-and-cpp-documentation/performance-tips.md
new file mode 100644 (file)
index 0000000..e96ae4d
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ *
+
+# Performance Tips  {#performancetips}
+
+## High CPU occupancy
+
+  - Try to reduce actor count ( less actors == less processing)
+  - Delete any actors that are not visible, or move them off stage
+  - Use TextureAtlases ( reduces OpenGL driver calls to glBindTexture
+  - Optimise / reduce any constraints used
+
+## High GPU occupancy
+
+  - Reduce visible actor count ( == less draw calls)
+  - For 2D UI graphics which require no z sorting you can use
+~~~{.cpp}
+  // In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
+  // Not always recommended if there is going to be a lot of overdraw ( if lots of actors are on top of each other)
+
+  Actor::SetDrawMode( DrawMode::OVERLAY ); // C++
+~~~~
+~~~{.js}
+  actor.drawMode = dali.DRAW_MODE_OVERLAY; // JavaScript
+~~~
+  - Use TextureAtlases ( reduces state changes in the GPU)
+  - Use compressed textures
+  - Use lower quality textures, e.g. smaller, lower number of bits per pixel
+  - Use Dali::NinePatchImage  where possible.
+  - Avoid using too many textures which contain alpha and require blending
+  - Avoid using too many Dali::Layer with depth testing enabled. Otherwise the layer has to clear the depth buffer.
+  - Optimise any shaders used. Pixel shaders should be kept as lean as possible.
+
+
+@class _Guide_Performance_Tips
+*/
+
+
diff --git a/docs/content/shared-javascript-and-cpp-documentation/resource-tracking.md b/docs/content/shared-javascript-and-cpp-documentation/resource-tracking.md
new file mode 100644 (file)
index 0000000..92c1850
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ *
+# Resource Tracking {#resourcetracking}
+
+## Enable Logging
+
+Setting DALI_ENABLE_LOG environment variable to RESOURCE_LOG will enable resource usage logging in Dali applications.
+On target resource logging utilizes dlog, but this can also be used on desktop by redirecting stderr to a file.
+The generated information includes any image files that are loaded with their dimensions,
+GPU memory consumption, CPU RAM used and details of texture atlases created.
+
+## Viewing Resource Logs
+
+dalireslog.sh is installed as part of the dali-adaptor package and can be found in the adaptors/tizen/scripts folder.
+The script shows a summary of memory used by resources.
+USAGE:
+./dalireslog.sh [FILE]
+if FILE isn't specified, the script will try to use dlogutil.
+
+### Example:
+~~~{.bash}
+sh-4.1$ ./dalireslog.sh
+
+**On a separate terminal:**
+
+sh-4.1$ DALI_ENABLE_LOG=RESOURCE_LOG /opt/apps/com.samsung.dali-demo/bin/album.example
+~~~
+Example on desktop:
+~~~{.bash}
+jon-doe\@ws-1234$ DALI_ENABLE_LOG=RESOURCE_LOG blind-effect.example 2>/home/SERILOCAL/john.doe/log.txt
+
+**On a separate terminal:**
+
+dalireslog.sh ~/log.txt
+
+~~~
+
+### Displayed information:
+
+|  | |
+|--|-|
+| 3D | amount of GPU memory used by application |
+| MEM Atlas | amount of GPU memory used by texture atlases (usually this refers to font atlases)
+| Number of atlases | how many texture atlases are present in memory.|
+
+A list of files is displayed in the main view, with different color codes representing different states:
+
+| | |
+|-|-|
+|CPU | resource is in memory, but hasn't been uploaded to a GL texture.|
+|GPU | resource has been uploaded to a GL texture, bitmap buffer discarded.|
+|CPUGPU | resource has been uploaded to a GL texture, but still present in CPU memory as well.|
+|DISCARDED | resource has been discarded, memory freed up |
+
+@class _Guide_ResourceTracking
+ */
diff --git a/docs/content/shared-javascript-and-cpp-documentation/scene-graph.md b/docs/content/shared-javascript-and-cpp-documentation/scene-graph.md
new file mode 100644 (file)
index 0000000..3092fa2
--- /dev/null
@@ -0,0 +1,20 @@
+# Scene Graph
+## What is a scene graph?
+From wikipedia...
+  
+A scene graph is a collection of nodes in a graph or tree structure.
+A node may have many children but often only a single parent,
+with the effect of a parent applied to all its child nodes;
+an operation performed on a group automatically propagates
+its effect to all of its members. In many programs, associating
+a geometrical transformation matrix (see also transformation and matrix)
+at each group level and concatenating such matrices together is an
+efficient and natural way to process such operations. A common feature,
+for instance, is the ability to group related shapes/objects into a
+compound object that can then be moved, transformed, selected,
+etc. as easily as a single object.
+
+ ### How does this relate to the Dali public API?
+
+ Actors are effectively nodes that receive input (touch events) and act as a
+ container for draw-able elements (which are also nodes) and other actors.
\ No newline at end of file
diff --git a/docs/content/shared-javascript-and-cpp-documentation/script-overview.md b/docs/content/shared-javascript-and-cpp-documentation/script-overview.md
new file mode 100644 (file)
index 0000000..bb7bb5d
--- /dev/null
@@ -0,0 +1,262 @@
+/**
+ *
+# Scripting Overview  {#scriptoverview}
+
+Dali has:
+- JSON to support:
+ - layouting
+ - theme / styling
+ - templated actor/control creation
+ - basic actions
+ - DALi GUI builder generates JSON files. Allows UI designers to create / modify the application look and feel.
+
+- JavaScript to support:
+ - Rapid Application Development
+ - Hybrid C++/JavaScript applications
+ - Leaverage third party JavaScript modules (backbone.js etc)
+
+JSON support is built in to DALi.
+
+JavaScript support is via a plugin held in dali-toolkit, which builds automatically if Google's V8 engine is installed. 
+The V8 version required by DALi can be built and installed using dali-core/scripts/dali_env script.
+
+Files can be loaded inside any DALi application, or from command line using the launcher ( part of dali-demo).
+
+~~~{.cpp}
+scripting.example hello-world.json hello-world.js
+~~~
+
+We currently have JSON and JavaScript example files held in dali-demo/resources/scripts
+  
+![ ](../assets/img/javascript-wrapping-guide/scripting-overview.png)
+![ ](scripting-overview.png)
+
+# JSON
+
+JSON file contains different sections:
+- **Templates** actor & control tree creation
+- **Styles** used to style actor & control trees
+- **Animations**
+- **Instances** of objects for path, shader-effects, render-tasks, frame-buffers
+- **Stage**. A list of actors / controls that can be added to the stage
+- **Constants**  (e.g. positions / colors, that can be references by other parts of the JSON file);
+- **Actions**
+  
+## Examples
+
+### JSON templates section
+  
+~~~{.json}
+
+    “templates”:
+    {
+      "name":"users",
+      "type":"Actor",
+      "parent-origin":"TOP_CENTER",
+      "anchor-point":"TOP_CENTER",
+      "size":"{DEFAULT_MENU_USER_SIZE}",
+      "color-mode":"USE_OWN_COLOR",
+      "actors":
+      [
+        {
+          "name":"usersBackground",
+          "type":"ImageActor",
+          "parent-origin":"CENTER",
+          "anchor-point":"CENTER",
+          "size":"{DEFAULT_MENU_USER_SIZE}",
+          "color-mode":"USE_OWN_COLOR",
+          "image":{ "filename":"{IMAGE_PATH}white-pixel.png" },
+          "color":"{DEFAULT_MENU_BACKGROUND_COLOR}"
+        },
+        {
+          "name":"icon",
+          "type":"ImageActor",
+          "parent-origin":"TOP_CENTER",
+          "anchor-point":"TOP_CENTER",
+          "position":[0,41,1],
+          "image":{ "filename":"{IMAGE_PATH}ico_man_nor.png" }
+        },
+      ]
+    },
+
+
+~~~
+
+#### JavaScript example
+
+~~~{.js}
+
+var builder = new dali.Builder();
+
+builder.loadFromFile( "my-app.json");
+
+var userActorTree = builder.create( { template:"users"} );
+
+~~~
+
+#### C++ example
+
+~~~{.cpp}
+Builder builder = Builder::New();
+
+std::string jsonData = loadFile("my-app.json");
+
+builder.LoadFromString( jsonData );
+
+Actor userActorTree = builder.Create("users");
+~~~
+
+
+### JSON styles section
+
+~~~{.json}
+“styles”:
+  {
+    “live-tv-focus":
+    {
+      "actors":
+      {
+        "background":
+        {
+          "image":{ "filename":"{IMAGE_PATH}live_tv_background.png" },
+          "color":"{DEFAULT_MENU_ITEM_COLOR_1}"
+        },
+        "icon":
+        {
+          "image":{ "filename":"{IMAGE_PATH}icn_live_tv_foc.png" }
+        },
+        "label":
+        {
+          "color-alpha":1,
+          "text":"<font size='20' weight='bold'><b>LIVE</b></font>"
+        }
+      }
+    },
+  }
+~~~
+
+#### JavaScript example
+
+~~~{.js}
+builder.applyStyle = builder.create( "live-tv-focus", tvIcon );
+~~~
+
+#### C++ example
+
+~~~{.cpp}
+builder.ApplyStyle( "live-tv-focus", tvIcon );
+~~~
+
+### JSON animations section
+
+~~~{.json}
+"animations":
+  {
+    "animate-show":
+    {
+      "duration":0.5,
+      "properties":
+      [
+        {
+          "actor":"background",
+          "property":"position-x",
+          "value":30,
+          "alpha-function":"EASE_IN_OUT"
+        },
+        {
+          "actor":"itemsBackground",
+          "property":"color-alpha",
+          "value":0.85,
+          "time-period": {"delay": 0.25, "duration": 0.25 },
+          "alpha-function":"EASE_IN_OUT"
+        },
+        {
+          "actor":"usersBackground",
+          "property":"color-alpha",
+          "value":0.85,
+          "time-period": {"delay": 0.25, "duration": 0.25 },
+          "alpha-function":"EASE_IN_OUT"
+        }
+      ]
+    },
+~~~
+
+#### JavaScript example
+
+~~~{.js}
+var anim = builder.createAnimation( { animation:"animate-show", actor: myActor } );
+~~~
+
+#### C++ example
+
+~~~{.cpp}
+Animation anim = builder.createAnimation( "animate-show", propertyMap );
+~~~
+
+### JSON stage section
+
+~~~{.json}
+
+“stage": [{
+      "name":"simple-table",
+      "type":"TableView",
+      "background-color": [0.5,0.5,0,1],
+      "parent-origin": "CENTER",
+      "size":[400,500,1],
+      "rows": 4,
+      "columns":4,
+      "cell-padding": [10, 5],
+      "layout-animation-duration": 0.5,
+      "layout-rows": {  // set the height of the rows
+        "0": { "policy": "fixed", "value": 40 },
+        "1": { "policy": "relative", "value": 0.33 },
+        "2": { "policy": "fixed", "value": 120 }
+      },
+      "layout-columns": { // set the widths of the columns
+        "1": { "policy": "fixed", "value": 150 },
+        "2": { "policy": "relative", "value": 0.35 },
+        "3": { "policy": "relative", "value": 0.15 }
+      },
+      "actors": [{
+          "name":"gallery-1",
+          "type":"ImageActor",
+          "image": {
+            "filename": "{DALI_IMAGE_DIR}gallery-large-1.jpg"
+          },
+          "custom-properties": { // properties registered dynamically
+            "cell-indices": [0,0],// property to specify the top-left cell this child occupies
+            "row-span":4, // property to specify how many rows this child occupies, if not set, default value is 1
+            "column-spam":1 // property to specify how many columns this child occupies
+            ....
+~~~
+
+#### JavaScript example
+
+~~~{.js}
+// add all actors under stage section to the root layer
+builder.addActors( dali.stage.getRootLayer() );
+~~~
+
+#### C++ example
+
+~~~{.cpp}
+// add all actors under stage section to the root layer
+builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+~~~
+
+# JavaScript
+
+For the JavaScript API please build dali-toolkit with YUIDOC installed. This will generate the documentation.
+See dali-toolkit/plugins/dali-script-v8/docs/README.txt
+
+To execute JavaScript from C++
+
+~~~{.cpp}
+script = Toolkit::Script::New();
+
+script.ExecuteFile( scriptFileName );
+~~~
+
+@class _Guide_JSON_and_JavaScript_overview
+
+*/
\ No newline at end of file
diff --git a/docs/content/shared-javascript-and-cpp-documentation/texture-atlas.md b/docs/content/shared-javascript-and-cpp-documentation/texture-atlas.md
new file mode 100644 (file)
index 0000000..23f414a
--- /dev/null
@@ -0,0 +1,249 @@
+/**
+ *
+# Texture Atlases {#textureatlases}
+
+## Example demo application
+
+![ ](../assets/img/texture-atlas/image-wall.jpg)
+![ ](image-wall.jpg)
+  
+
+Application above is running slow as there are many small individual images displayed (50)
+  
+| Metric | Result | Explanation |
+|--------|--------|-------------|
+| Launch time | Slow | Has to perform: 50 file open requests and multiple reads for each image |
+| Memory consumption|  High | Has to create:50 Dali::Image objects,50 OpenGL Textures|
+| Rendering | Slow | Has to perform: 50 glBindTexture calls per frame ( each OpenGL calls takes time) 50 a frame = 3000 calls per second @60 FPS.Texture switching is a major state change in the GPU|
+  
+
+
+## Solutions to problem: Use a Texture Atlas
+
+A texture atlas is simply one larger image that contains smaller images. A texture atlas is sometimes called a
+sprite sheet, bitmap sheet or texture pack.
+
+![ ](../assets/img/texture-atlas/atlas.jpg)
+![ ](atlas.jpg)
+  
+Dali::ImageActor has the ability to display a portion of an image using ImageActor::PixelArea setting.
+For example to display the first 3 image in the atlas
+  
+![ ](../assets/img/texture-atlas/example-javascript-code.jpg)
+![ ](example-code.jpg)
+
+### Result of using an Atlas
+
+| Metric | Result | Explanation |
+|--------|--------|-------------|
+| Launch time | Fast | Has to perform: - 1 file open request  |
+| Memory consumption|  Low | Has to create: 1 Dali::Image objects 1 OpenGL Textures|
+| Rendering | Fast | HHas to perform: 1 glBindTexture calls per frame ( each OpenGL calls takes time) 1 a frame = 6- calls per second @60 FPS.|
+
+  
+## Atlas creation guide
+
+Many tools exist for creating texture atlases.
+In the following example we are using a tool called TexturePacker as DALi has an exporter script for it.
+The exporter automatically generates a source file that has the ImageActor::PixelArea pre-defined.
+  
+- Download http://www.codeandweb.com/texturepacker
+- Launch TexturePacker
+- Go to the menu File -> Preferences
+- Set the "Exporter directory" to be the location of dali-toolkit/texture-atlas-exporter
+  
+![ ](../assets/img/texture-atlas/texture-packer-preferences.jpg)
+![ ](texture-packer-preferences.jpg)
+  
+- Restart the application!
+- Select DALi 3D framework for new project
+  
+![ ](../assets/img/texture-atlas/texture-packer-startup.jpg)
+![ ](texture-packer-startup.jpg)
+  
+- Create the atlas
+![ ](../assets/img/texture-atlas/texture-packer-add-sprites.jpg)
+![ ](texture-packer-add-sprites.jpg)
+- Click publish to produce the files
+![ ](../assets/img/texture-atlas/texture-packer-publish.jpg)
+![ ](texture-packer-publish.jpg)
+
+
+
+## Using the generated cpp ( contains JavaScript code as well)
+
+The generated cpp file contains 3 different ways of describing the atlas.
+Copy and paste the section that best suits your application.
+-  Lookup table. Includes code for storing the table in a std::map for fast lookup.
+- constants.
+- JavaScript property map
+
+### Using the JavaScript generated property map
+
+The property map should be cut and paste in to your application. It just looks like
+  
+~~~{.js}
+var ATLAS_IMAGE_LIST : [
+    { name: "add_user_usericon_bg", x: 2, y:109, w:105, h:105,  blendMode:dali.BLENDING_ON  },
+    { name: "app_background", x: 180, y:183, w:1, h:1,  blendMode:dali.BLENDING_OFF  },
+    { name: "btn_arrow_left", x: 141, y:183, w:11, h:20,  blendMode:dali.BLENDING_ON  },
+    { name: "btn_arrow_right", x: 154, y:183, w:11, h:20,  blendMode:dali.BLENDING_ON  },
+    { name: "icn_app_foc", x: 194, y:2, w:72, h:72,  blendMode:dali.BLENDING_ON  },
+    { name: "icn_app_nor", x: 109, y:109, w:72, h:72, blendMode:dali.BLENDING_ON  }
+    ]
+var atlas = new dali.ResourceImage( { url: "atlas_filename.png" });
+
+// display the user icon using the size / position data in the ATLAS_IMAGE_LIST
+var userIconData = ATLAS_IMAGE_LIST[0];
+var userIconRect = [ userIconData.x, userIconData.y,userIconData.w,userIconData.h];
+
+var btnArrowLeft = new dali.ImageActor( atlas, userIconRect );
+btnArrowLeft.setBlendMode(userIconData.blendMode);
+
+~~~
+
+![ ](example-javascript-code.jpg)
+
+
+### Using the lookup table in C++
+
+Cut and paste the lookup table code into your application.
+
+~~~{.cpp}
+
+// The following code is automatically generated when TexturePacker publishes to a cpp file.
+const char* ATLAS_FILE_NAME( "my_first_atlas.png" );  ///< Atlas image filename
+
+// Structure to hold image name and position within the atlas.
+struct ImageInfo
+{
+  const char* name;
+  unsigned int x,y,w,h;
+  Dali::BlendingMode::Type blendMode;  // only enable blending if image has alpha
+};
+
+
+// lookup table
+const ImageInfo ImageAtlas[]=
+{
+ { "blocks-ball", 2, 198, 51, 51, BlendingMode::ON },
+ { "bubble-ball", 288, 74, 32, 32, BlendingMode::ON },
+ { "gallery-small-52", 2, 2, 128, 128, BlendingMode::OFF },
+ { "icon-change", 219, 2, 37, 34, BlendingMode::ON },
+ { "icon-cluster-carousel", 180, 2, 37, 34, BlendingMode::ON }
+};
+
+const ImageInfo* GetImageInfo(const char* name)
+{
+  typedef std::map< const char*, const ImageInfo* > LookupMap;
+  static LookupMap lookup;
+  if( lookup.empty() )
+  {
+    for( unsigned int i = 0; i < ATLAS_IMAGE_COUNT; ++i)
+    {
+      lookup[ ImageAtlas[i].name ] =  &ImageAtlas[i];
+    }
+  }
+  LookupMap::const_iterator iter = lookup.find(name);
+  if( iter != lookup.end() )
+  {
+   return (*iter).second;
+  }
+  DALI_ASSERT_ALWAYS(0 && "image name not found in atlas");
+  return NULL;
+}
+
+~~~
+
+To use the lookup table you can do something like this:
+
+~~~{.cpp}
+// Example function on how to get an image info from the table
+
+std::string fileName = std::string( DALI_IMAGE_DIR ) + ATLAS_FILE_NAME;
+Image imageImage = Image::New( fileName );
+
+const ImageInfo* info(NULL);
+
+info = GetImageInfo("blocks-ball");
+if( info)
+{
+  ImageActor ballActor = ImageActor::New( imageAtlas, ImageActor::PixelArea( info->x, info->y, info->w, info->h) );
+  ballActor->SetBlendMode( info->blendMode );
+}
+info = GetImageInfo("bubble-ball");
+if( info)
+{
+  ImageActor bubbleActor = ImageActor::New( imageAtlas, ImageActor::PixelArea( info->x, info->y, info->w, info->h) );
+  bubbleActor->SetBlendMode( info->blendMode );
+}
+
+~~~
+
+### Using the constant definitions (C++)
+
+1. Cut and paste the constant definition code into your application.
+
+You'll notice the code below won't compile because C++ variables can't have a dash character.
+E.g. BLOCKS-BALL, BUBBLE-BALL will cause errors. Do a search and replace for - and replace with underscores.
+This is one reason why using lookup table which holds the filename as a string maybe easier to use.
+  
+~~~{.cpp}
+
+// The following code is automatically generated when TexturePacker publishes to a cpp file.
+const char* ATLAS_FILE_NAME( "my_first_atlas.png" );
+
+
+// Structure to hold position / blend mode within the atlas.
+struct ImageInfo
+{
+  ImageInfo(unsigned int x,unsigned int y,unsigned int w,unsigned int h,  Dali::BlendingMode::Type mode)
+  :pixelArea(x,y,w,h),blendMode(mode)
+  {}
+  ImageActor::PixelArea pixelArea;
+  Dali::BlendingMode::Type blendMode;  // only enable blending if image has alpha
+};
+
+
+const ImageInfo BLOCKS-BALL( 2, 198, 51, 51 ,BlendingMode::ON );
+const ImageInfo BUBBLE-BALL( 288, 74, 32, 32 ,BlendingMode::ON );
+const ImageInfo GALLERY-SMALL-52( 2, 2, 128, 128 ,BlendingMode::OFF );
+~~~
+  
+  2. To use it, you can copy example code from the generated cpp file which looks
+like this
+
+~~~{.cpp}
+void LoadAtlasImages()
+{
+  std::string fileName = std::string(DALI_IMAGE_DIR) + ATLAS_FILE_NAME;
+  Image atlasImage = Image::New( fileName );
+  ImageActor Blocksball = ImageActor::New( atlasImage,  BLOCKS_BALL.pixelArea);
+  Blocksball.SetBlendMode( BLOCKS_BALL.blendMode );
+
+  ImageActor Bubbleball = ImageActor::New( atlasImage,  BUBBLE_BALL.pixelArea);
+  Bubbleball.SetBlendMode( BUBBLE_BALL.blendMode );
+  ...
+~~~
+
+
+## Atlas creation tips
+
+- Compress the atlas  - \link Texture_Compression Compressing Textures \endlink
+- Avoid adding large images to the Atlas.
+- E.g. don't add background images to it. Medium to large images should be kept seperate.
+  
+![ ](../assets/img/texture-atlas/atlas-size.jpg)
+![ ](atlas-size.jpg)
+  
+
+- Try to ensure the atlas contains only images that are frequently used.  There's no point in having images taking up GPU texture memory if they're not displayed.
+- Avoid very large atlases.   Try to create multiple atlases based on how they are used within your application.
+Alternatively Texture packer has the option to split atlases ( search help for Multipack)
+
+
+
+@class _Guide_TextureAtlases
+
+*
+*/
\ No newline at end of file
@@ -1,8 +1,8 @@
-
 /**
  *
 
-## Texture Compression
+# Texture Compression {#texturecompression}
+
 
 Using compressing the textures will:
 
@@ -11,24 +11,71 @@ Using compressing the textures will:
 - Speed up load times. Smaller files mean quicker load times.
   
 DALi supports the KTX file format.
+  
 You just load the compressed texture like you would any other image.
 
-    var image = new dali.ResourceImage({url:"my_compressed_file.ktx"});
+~~~{.cpp}
+// C++
+ResourceImage image = ResourceImage::New("my_compressed_file.ktx");
+~~~
+~~~{.js}
+// JavaScript
+var image = new dali.ResourceImage( { url:"my_compressed_file.ktx"});
 
-ARMS texture compression tool<br>
-http://malideveloper.arm.com/develop-for-mali/tools/asset-creation/mali-gpu-texture-compression-tool/  <br>
+~~~
+  
+### ARMS texture compression tool
 
+http://malideveloper.arm.com/develop-for-mali/tools/asset-creation/mali-gpu-texture-compression-tool/
+  
 Here is an example of using the ARM compression tool.
+  
+![ ](../assets/img/texture-atlas/compression-options.jpg)
+![ ](compression-options.jpg)
+  
+![ ](../assets/img/texture-atlas/compression-example.jpg)
+![ ](compression-example.jpg)
 
-<img src="../assets/img/shared/texture-atlas/compression-options.jpg">
-
-<img src="../assets/img/shared/texture-atlas/compression-example.jpg">
+  
+As shown above the ETC-1 compression format does not support alpha.
+  
+As a work around the tool will export the alpha as a seperate compressed image.
 
-As shown above the ETC-1 compression format does not support alpha.<br> As a work around the tool will export
-the alpha as a seperate compressed image.
 In order to combine both the images you need to use a custom shader.
 Here is an example shader:
-```
+  
+~~~{.cpp}
+// C++ Code
+  const char* const COMPRESSED_RGB_PLUS_SEPARATE_ALPHA_FRAGMENT_SOURCE =
+    "\n"
+    "void main()\n"
+    "{\n"
+    "    vec4 v4Color  = (texture2D(sTexture, vTexCoord) * uColor);\n"
+    "    v4Color.a =  texture2D(sEffect, vTexCoord ).r;\n"
+    "   gl_FragColor = v4Color;"
+    "}\n";
+
+
+  mShaderEffect = ShaderEffect::New( "", COMPRESSED_RGB_PLUS_SEPARATE_ALPHA_FRAGMENT_SOURCE);
+
+  mAtlasImageRGB = ResourceImage::New( ATLAS_RGB_FILENAME.KTX);
+
+  mAtlasImageAlpha = ResourceImage::New( ATLAS_ALPHA_FILENAME.KTX );
+
+  mShaderEffect.SetEffectImage( mAtlasImageAlpha );
+
+
+
+  // to create Image Actor
+  ImageActor  imageActor = ImageActor::New( mAtlasImageRGB, GetImagePosition( info) );
+
+  imageActor.SetShaderEffect( mShaderEffect );
+
+  imageActor.SetBlendMode(BlendingMode::ON);
+~~~
+  
+~~~{.js}
+// JavaScript code
 var fragSource = "  \
 void main()                                                   \
 {                                                             \
@@ -51,8 +98,11 @@ ImageActor  imageActor = ImageActor::New( mAtlasImageRGB, GetImagePosition( info
 imageActor.setShaderEffect( shaderEffect );
   
 imageActor.setBlendMode( dali.BLENDING_ON );
-```
- @class TextureCompression
+~~~
+
+@class _Guide_Texture_compression
+
+
+*/
 
 
- */
index c682461..addf616 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.40
+Version:    1.0.41
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index b2ea595..e4d433b 100644 (file)
@@ -16,7 +16,7 @@ var camera = new dali.CameraActor();
 var layer = new dali.Layer();
 ```
 
-### Hello world example </h3>
+### Hello world example
 ```
 var myActor = new dali.TextActor("hello-world");
 
@@ -40,7 +40,8 @@ An actor inherits its parent's position.  The relative position between the acto
 
 1) ParentOrigin.  This Vector3 property defines a point within the parent actor's area.
 
-<img src="../assets/img/shared/parent-origin.png">
+![ ](../assets/img/parent-origin.png)
+
 
 The default is "top-left", which can be visualized in 2D as (0, 0), but is actually Vector3(0, 0, 0.5) in the 3D DALi world.  The actor's position is relative to this point.
 ```
@@ -50,7 +51,7 @@ myActor.parentOrigin = [0.5, 0.5, 0.5];
 
 2) AnchorPoint.  This Vector3 property defines a point within the child actor's area.
 
-<img src="../assets/img/shared/anchor-point.png">
+![ ](../assets/img/anchor-point.png)
 
 The default is "center", which can be visualized in 2D as (0.5, 0.5), but is actually Vector3(0.5, 0.5, 0.5) in the 3D DALi world.  The actor's position is also relative to this point.
 ```
@@ -60,7 +61,7 @@ myActor.anchorPoint = [0.5, 0.5, 0.5];
 
 3) Position.  This is the position vector between the parent-origin and anchor-point.
 
-<img src="../assets/img/shared/actor-position.png">
+![ ](../assets/img/actor-position.png)
 
 Therefore by default, an actors position is the distance between its center and the top-left corner of its parent.
 
@@ -119,7 +120,7 @@ function OnPressed( actor, touchEvent )
   
   var anim = new dali.Animation( 4 );
   var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
-  anim.animateBy( actor, "orientation", rotation );
+  anim.animateBy( actor, "rotation", rotation );
   anim.play();
   return true;
 }
@@ -196,8 +197,8 @@ See
  worldPositionX         |FLOAT       | &#10008;     | &#10008;
  worldPositionY         |FLOAT       | &#10008;     | &#10008;
  worldPositionZ         |FLOAT       | &#10008;     | &#10008;
orientation            |ROTATION    | &#10004;     | &#10004;
- worldOrientation       |ROTATION    | &#10008;     | &#10008;
rotation               |ROTATION    | &#10004;     | &#10004;
+ worldRotation          |ROTATION    | &#10008;     | &#10008;
  scale                  |VECTOR3     | &#10004;     | &#10004;
  scaleX                 |FLOAT       | &#10004;     | &#10004;
  scaleY                 |FLOAT       | &#10004;     | &#10004;
@@ -214,7 +215,7 @@ See
  name                   |STRING      | &#10004;     | &#10008;
  sensitive              |BOOLEAN     | &#10004;     | &#10008;
  leaveRequired          |BOOLEAN     | &#10004;     | &#10008;
- inheritOrientation     |BOOLEAN     | &#10004;     | &#10008;
+ inheritRotation        |BOOLEAN     | &#10004;     | &#10008;
  inheritScale           |BOOLEAN     | &#10004;     | &#10008;
  colorMode              |NUMBER      | &#10004;     | &#10008;
  positionInheritance    |NUMBER      | &#10004;     | &#10008;
@@ -381,19 +382,19 @@ WORLD_POSITION_Z
 
 
 /**
- * Actors orientation
- * @property orientation
- * @type dali orientation object
+ * Actors rotation
+ * @property rotation
+ * @type dali Rotation object
  */
-ORIENTATION
+ROTATION
 
 
 /**
- * Actors world-orientation
- * @property worldOrientation
- * @type dali Orientation object ( read only)
+ * Actors world-rotation
+ * @property worldRotation
+ * @type dali Rotation object ( read only)
  */
-WORLD_ORIENTATION
+WORLD_ROTATION
 
 /**
  * Actors scale
@@ -521,10 +522,10 @@ LEAVE_REQUIRED
 /**
  * Set whether a child actor inherits it's parent's orientation.
  * @type Boolean
- * @property inheritOrientation
+ * @property inheritRotation
  * @default true
  */
-INHERIT_ORIENTATION,
+INHERIT_ROTATION,
 
 
 /**
@@ -644,4 +645,4 @@ POSTITION_INHERITANCE
  * @type Vector3
  * @property sizeModeFactor
  */
-SIZE_MODE_FACTOR
+SIZE_MODE_FACTOR
\ No newline at end of file
index 33c64f8..727c139 100644 (file)
@@ -118,7 +118,8 @@ The example below does the following with a single animation object:
  - rotates the image actor
  - magnifies and color shifts the image using a fragment shader
   
-<img src="../assets/img/shader-animation.png">
+![ ](../assets/img/shaders/shader-animation.png)
+
   
 
 ```
index d70d538..e2383d0 100644 (file)
@@ -1,6 +1,6 @@
 /**
  *
-<h3> Dali Constants </h3>
+### Dali Constants
 
 Constants accessible under the dali global object.
   
@@ -148,7 +148,6 @@ Constants accessible under the dali global object.
 | PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC            | integer value  |
 | PIXEL_FORMAT_COMPRESSED_RGB8_ETC1                        | integer value  |
 | PIXEL_FORMAT_COMPRESSED_RGB_PVRTC_4BPPV1                 | integer value  |
-</table>
 
  * @class Constants
  */
index 578f6ae..611d004 100644 (file)
@@ -25,8 +25,7 @@ the OpenGL API from developers and provides a clean cross-platform JavaScript fr
 + Runs all animations in a seperate thread. This helps maintain 60 FPS even if JavaScript is performing a long operation ( e.g. Garbage Collection ).
 + Provides keyboard / touch / mouse handling
   
-  
-<img src="../assets/img/shared/screenshot.png">
+![Screen shots](../assets/img/screen-shot.png)
 
 ## Running JavaScript from DALi C++ API
 ```
@@ -52,7 +51,7 @@ The following example shows how to connect a new actor to the stage:
 The Stage has a 2D size, which matches the size of the application window.  The default coordinate system in DALi has the origin at the top-left corner, with positive X to right, and position Y going
 downwards.  This is intended to be convenient when laying-out 2D views.
 
-<img src="../assets/img/shared/coordinate-system-and-stage.png">
+![Screen shots](../assets/img/coordinate-system-and-stage.png)
 
 
  * @module DALi
index aebe46f..40a6d5f 100644 (file)
@@ -45,7 +45,8 @@ dali.stage.add( imageActor );
 ```
 var imageAtlas = new dali.ResourceImage( {url:"atlas.png"} )
 ```
-<img src="../assets/img/example-javascript-code.png">
+![ ](../assets/img/texture-atlas/example-javascript-code.jpg)
+
 
 ### Image Actor Specific Properties
 
index 5d06d3e..f9ef313 100644 (file)
@@ -58,17 +58,17 @@ var borderNinePatch = new dali.ResourceImage( {url:"border.9.png"} );
 var image = new dali.NinePatchImage( {url:"my_image.png"})
 ```
 The nine patch image will scale automatically with the size of the actor.
-
+  
 Tool for making 9 patches
-
+  
   http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
-
+  
 More information on them:
-
+  
   http://radleymarx.com/blog/simple-guide-to-9-patch/
-
+  
   http://developer.android.com/tools/help/draw9patch.html
-
+  
 
 
  @class Image
index 465e249..2bcae22 100644 (file)
@@ -11,7 +11,7 @@ It also allows you to set an actor that is used to high light the focused actor.
 
 The application is required to help the manager when moving focus.
 
-<img src="../assets/img/focus-manager.png">
+![ Focus Manager ](../assets/img/focus-manager/focus-manager.png)
 
 ### keyboard-pre-focus-change
 
index 36d7986..81aece0 100644 (file)
@@ -4,7 +4,7 @@
 
 Paths can be used to animate position and orientation of actors.
 
-<img src="../assets/img/path.png"/>
+![ ](../assets/img/path/path.png)
   
 Example
 
index add11aa..b2509bf 100644 (file)
@@ -1,15 +1,17 @@
 /**
  *
- * <h2> Renderable Actor ( Extends Actor API )</h2>
- * Renderable actors are actors that can be drawn.
- * These currently are:
- * - {{#crossLink "ImageActor"}}{{/crossLink}}
- * - {{#crossLink "TextActor"}}{{/crossLink}}
- * - {{#crossLink "MeshActor"}}{{/crossLink}}
- *
- * @class RenderableActor
- * @extends Actor
- */
+# Renderable Actor ( Extends Actor API )
+
+Renderable actors are actors that can be drawn.
+These currently are:
+
+- {{#crossLink "ImageActor"}}{{/crossLink}}
+- {{#crossLink "TextActor"}}{{/crossLink}}
+- {{#crossLink "MeshActor"}}{{/crossLink}}
+
+ @class RenderableActor
+ @extends Actor
+*/
 
 
 
index 98e9c17..8c35f3d 100644 (file)
@@ -58,8 +58,9 @@ The API supports functionality such as:
 + {{#crossLink "ShaderEffect/setUniform:method"}}{{/crossLink}}
 
 ### Example of using a custom uniform to brighten an Image (Fragment Shader)
-
-<img src="../assets/img/fragment-shader-color.png">
+  
+![ ](../assets/img/shaders/fragment-shader-color.png)
+  
 ```
 createColorEffect = function()
 {
@@ -118,8 +119,9 @@ Like all animatable properties we can also use keyframes to animate the value.
 ### Example of animating a custom uniform to perform a mask operation (Fragment Shader)
 
 In this example we are using the OpenGL discard function to draw an image with a circular mask.
-
-<img src="../assets/img/fragment-shader-reveal.png">
+  
+![ ](../assets/img/shaders/fragment-shader-reveal.png)
+  
 ```
 createRevealEffect = function()
 {
@@ -177,8 +179,9 @@ shaderAnim.play();
 ```
 * * *
 ### Example of paper twisting in the wind with color (Vertex + Fragment Shader)
-
-<img src="../assets/img/vertex-shader.png"><br>
+  
+![ ](../assets/img/shaders/vertex-shader.png)
+  
 
 The example does the following:
 
@@ -188,9 +191,9 @@ The example does the following:
 
 An ImageActor normally only has 4 vertices ( quad ). To allow the image to twist and bend we need it to have more
 vertices. To do this we can break the image into a grid using the gridX and gridY geometry hints.
-
-<img src="../assets/img/shader-grid-hint.png">
-
+  
+![ ](../assets/img/shaders/shader-grid-hint.png)
+  
 ```
 createTwistEffect = function()
 {
index dcacca6..cfcdb76 100644 (file)
@@ -22,7 +22,8 @@ dali.stage.add( imageActor );
 dali.stage.remove( imageActor );
 ```
 
-<img src="../assets/img/stage.png"/>
+![ ](../assets/img/stage.png)
+
 
 ### Key Events
 
diff --git a/plugins/dali-script-v8/docs/content/texture-atlases.js b/plugins/dali-script-v8/docs/content/texture-atlases.js
deleted file mode 100644 (file)
index 7005fca..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- *
-
-## Using Texture Atlases in DALi
-
-
-### Example demo application
-
-<img src="../assets/img/shared/texture-atlas/image-wall.jpg">
-
-
-### Application above is running slow as there are many small individual images displayed (50)
-
-
-<table>
-  <tr>
-    <td> Launch Time </td>
-    <td> Slow </td>
-    <td> Has to perform: <br>- 50 file open requests and multiple reads for each image</td>
-  </tr>
-  <tr>
-    <td> Memory Usage </td>
-    <td> High </td>
-    <td> Has to create:
-      <br>- 50 Dali::Image objects
-      <br>- 50 OpenGL Textures
-    </td>
-  </tr>
-  <tr>
-    <td>Rendering Performance </td>
-    <td> Slow </td>
-    <td> Has to perform:
-      <br>- 50 glBindTexture calls per frame ( each OpenGL calls takes time)
-      <br>- 50 a frame = 3000 calls per second @60 FPS.
-      <br>- Texture switching is a major state change in the GPU
-    </td>
-  </tr>
-</table>
-<br><br>
-
-
-### Solutions to problem: Use a Texture Atlas
-
-A texture atlas is simply one larger image that contains smaller images.<br>
-A texture atlas is sometimes called a sprite sheet, bitmap sheet or texture pack.
-<br><br>
-<img src="../assets/img/shared/texture-atlas/atlas.jpg">
-<br><br>
-Dali::ImageActor has the ability to display a portion of an image using ImageActor::PixelArea setting.
-For example to display the first 3 image in the atlas
-<br><br>
-```
-var imageAtlas = new dali.ResourceImage( {url:"atlas.png"} )
-```
-<img src="../assets/img/example-javascript-code.png">
-<br>
-### Result of using an Atlas
-<table>
-  <tr>
-    <td> Launch Time </td>
-    <td> Fast </td>
-    <td> Has to perform: <br>- 1 file open request </td>
-  </tr>
-  <tr>
-    <td> Memory Usage </td>
-    <td> Better </td>
-    <td> Has to create:
-      <br>- 1 Dali::Image objects
-      <br>- 1 OpenGL Textures
-    </td>
-  </tr>
-  <tr>
-    <td>Rendering Performance </td>
-    <td> Fast </td>
-    <td> Has to perform:
-      <br>- 1 glBindTexture calls per frame ( each OpenGL calls takes time)
-      <br>- 1 a frame = 6- calls per second @60 FPS.
-    </td>
-  </tr>
-</table>
-<br>
-## Atlas creation guide
-
-Many tools exist for creating texture atlases.<br>
-In the following example we are using a tool called TexturePacker as DALi has an exporter script for it.
-The exporter automatically generates a source file that has the ImageActor::PixelArea pre-defined.
-<br>
-
-+ Download http://www.codeandweb.com/texturepacker
-+ Launch TexturePacker
-+ Go to the menu File -> Preferences
-+ Set the "Exporter directory" to be the location of <b>dali-toolkit/texture-atlas-exporter</b>  <br>
-  
- <img src="../assets/img/shared/texture-atlas/texture-packer-preferences.jpg"> <br>
-+ <b> Restart the application! </b>
-+ Select DALi 3D framework for new project
-  
- <img src="../assets/img/shared/texture-atlas/texture-packer-startup.jpg"><br>
-+ <h3> Create the atlas </h3>
-   <img src="../assets/img/shared/texture-atlas/texture-packer-add-sprites.jpg">
-+ <h3> Click publish to produce the files </h3><br><br>
-   <img src="../assets/img/shared/texture-atlas/texture-packer-publish.jpg">
-  
-## Using the generated cpp file
-
-The generated cpp file contains 3 different ways of describing the atlas.
-2 ways are designed for the DALi C++ API, the 3rd way is for JavaScript.
-Example exported property map from TexturePacker:
-```
-var ATLAS_IMAGE_LIST : [
-    { name: "add_user_usericon_bg", x: 2, y:109, w:105, h:105, dali.BLENDING_ON  },
-    { name: "app_background", x: 180, y:183, w:1, h:1, dali.BLENDING_OFF  },
-    { name: "btn_arrow_left", x: 141, y:183, w:11, h:20, dali.BLENDING_ON  },
-    { name: "btn_arrow_right", x: 154, y:183, w:11, h:20, dali.BLENDING_ON  },
-    { name: "icn_app_foc", x: 194, y:2, w:72, h:72, dali.BLENDING_ON  },
-    { name: "icn_app_nor", x: 109, y:109, w:72, h:72, dali.BLENDING_ON  }
-    ]
-var atlas = new dali.ResourceImage( { url: "atlas_filename.png" });
-
-// display the user icon using the size / position data in the ATLAS_IMAGE_LIST
-var userIconData = ATLAS_IMAGE_LIST[0];
-var userIconRect = [ userIconData.x, userIconData.y,userIconData.w,userIconData.h];
-
-var btnArrowLeft = new dali.ImageActor( atlas, userIconRect );
-```
-
-## Atlas creation tips
-
-
- - Compress the atlas
- - Avoid adding large images to the Atlas.
-    E.g. don't add background images to it. Medium to large images should
-    be kept seperate. <br><br>
-   <img src="../assets/img/shared/texture-atlas/atlas-size.jpg">
-
- - Try to ensure the atlas contains only images that are frequently used. <br>
-    There's no point in having images taking up GPU texture memory if they're not displayed.<br>
-
- - Avoid very large atlases <br>
-    Try to create multiple atlases based on how they are used within your application.<br>
-    <br>
-    Alternatively Texture packer has the option to split atlases ( search help for Multipack)
- -
-
-
-
-  @class TextureAtlases
- */
-
diff --git a/plugins/dali-script-v8/docs/dali-theme/assets/img b/plugins/dali-script-v8/docs/dali-theme/assets/img
new file mode 120000 (symlink)
index 0000000..e8c2249
--- /dev/null
@@ -0,0 +1 @@
+../../../../../docs/content/images/
\ No newline at end of file
diff --git a/plugins/dali-script-v8/docs/dali-theme/assets/img/example-javascript-code.png b/plugins/dali-script-v8/docs/dali-theme/assets/img/example-javascript-code.png
deleted file mode 100644 (file)
index 3888761..0000000
Binary files a/plugins/dali-script-v8/docs/dali-theme/assets/img/example-javascript-code.png and /dev/null differ
diff --git a/plugins/dali-script-v8/docs/dali-theme/assets/img/shared b/plugins/dali-script-v8/docs/dali-theme/assets/img/shared
deleted file mode 120000 (symlink)
index 6eab915..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../docs/content/images/
\ No newline at end of file
index 9378742..653f1d3 100644 (file)
@@ -1030,7 +1030,7 @@ void AnimationApi::AnimateTo( const v8::FunctionCallbackInfo< v8::Value >& args
  *
  *  create some keyframes to move an actor around a square, and return to the start
  * </br >
- *  <img src="../assets/img/keyframe-animation.png">
+ *  <img src="../assets/img/animation/keyframe-animation.png">
  *
  *
  *     var keyframes = [
index 29bfb01..60c5c55 100644 (file)
@@ -724,6 +724,15 @@ Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* i
       }
       break;
     }
+    case Dali::Property::RECTANGLE:
+    {
+      if( array.GetType() == Dali::Property::VECTOR4)
+      {
+        Vector4 vec4( array.Get<Vector4>());
+        daliPropertyValue = Property::Value(Rect<int>( vec4.x,vec4.y, vec4.z, vec4.w ));
+      }
+      break;
+    }
     case Dali::Property::ROTATION:
     {
       if( array.GetType() == Dali::Property::VECTOR4)
index ac505ef..38aa8e8 100755 (executable)
@@ -126,6 +126,6 @@ void LoadAtlasImages()
 //
 
 ATLAS_IMAGE_LIST : [
-{% for sprite in allSprites %} { name: "{{sprite.trimmedName}}", x: {{sprite.frameRect.x}}, y:{{sprite.frameRect.y}}, w:{{sprite.frameRect.width}}, h:{{sprite.frameRect.height}}, {%if sprite.isSolid %}dali.BLENDING_OFF{% else%}dali.BLENDING_ON{% endif %}  }{% if not forloop.last %},{% endif %}
+{% for sprite in allSprites %} { name: "{{sprite.trimmedName}}", x: {{sprite.frameRect.x}}, y:{{sprite.frameRect.y}}, w:{{sprite.frameRect.width}}, h:{{sprite.frameRect.height}}, blendMode:{%if sprite.isSolid %}dali.BLENDING_OFF{% else%}dali.BLENDING_ON{% endif %}  }{% if not forloop.last %},{% endif %}
 {% endfor %}
-]
\ No newline at end of file
+]