Merge "Fix PageTurnView" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 30 Jun 2015 10:25:53 +0000 (03:25 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 30 Jun 2015 10:25:53 +0000 (03:25 -0700)
28 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp
build/tizen/configure.ac
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/controls/control.h
dali-toolkit/public-api/focus-manager/keyboard-focus-manager.cpp
dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h
plugins/dali-script-v8/docs/content/actor.js
plugins/dali-script-v8/docs/content/renderable-actor.js [deleted file]
plugins/dali-script-v8/file.list
plugins/dali-script-v8/src/actors/actor-wrapper.cpp
plugins/dali-script-v8/src/actors/image-actor-api.cpp
plugins/dali-script-v8/src/actors/image-actor-api.h
plugins/dali-script-v8/src/actors/mesh-actor-api.cpp [deleted file]
plugins/dali-script-v8/src/actors/mesh-actor-api.h [deleted file]
plugins/dali-script-v8/src/actors/renderable-actor-api.cpp [deleted file]
plugins/dali-script-v8/src/actors/renderable-actor-api.h [deleted file]
plugins/dali-script-v8/src/constants/constants-wrapper.cpp
plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp

index 20a5041..79668ff 100644 (file)
@@ -112,7 +112,7 @@ DummyControlImplOverride::~DummyControlImplOverride() { }
 
 
 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
-void DummyControlImplOverride::OnActivated() { activatedCalled = true; }
+bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
 {
   themeChangeCalled = change == StyleChange::THEME_CHANGE;
index ddfdcba..6db3f8b 100644 (file)
@@ -102,7 +102,7 @@ private:
 private: // From Internal::Control
 
   virtual void OnInitialize();
-  virtual void OnActivated();
+  virtual bool OnAccessibilityActivated();
   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
   virtual void OnPinch(const PinchGesture& pinch);
   virtual void OnPan(const PanGesture& pan);
index f3aa937..daac903 100644 (file)
@@ -922,7 +922,7 @@ int UtcDaliControlImplOnAccessibilityActivatedP(void)
   DALI_TEST_CHECK( handle );
 
   Property::Map attributes;
-  DALI_TEST_EQUALS( false, handle.DoAction("control-activated", attributes), TEST_LOCATION );
+  DALI_TEST_EQUALS( false, handle.DoAction("accessibility-activated", attributes), TEST_LOCATION );
 
   END_TEST;
 }
index e902ec0..95a6eb5 100644 (file)
@@ -594,7 +594,7 @@ int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
 
   bool focusedActorActivatedSignalVerified = false;
   FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
-  manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
+  manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
 
   Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
 
index 1e8c725..6fb8b47 100644 (file)
@@ -62,7 +62,7 @@ AC_ARG_ENABLE([javascript],
               [AC_HELP_STRING([--enable-javascript],
                [Enable JavaScript plugin])] ,
                [enable_javascript=$enableval],
-               [enable_javascript=no])
+               [enable_javascript=automatic])
 
 
 if test "x$enable_debug" = "xyes"; then
index b2428d9..e37e319 100644 (file)
@@ -485,7 +485,7 @@ private:
   bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped);
 
   /**
-   * Activate the actor. If the actor is control, call OnActivated virtual function.
+   * Activate the actor. If the actor is control, call OnAccessibilityActivated virtual function.
    * This function will emit FocusedActorActivatedSignal.
    * @param actor The actor to activate
    */
index 2877ed3..a1eb3cf 100644 (file)
@@ -905,7 +905,7 @@ Actor& Button::GetDisabledBackgroundImage()
   return mDisabledBackgroundContent;
 }
 
-  bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
 
@@ -917,14 +917,13 @@ Actor& Button::GetDisabledBackgroundImage()
 
   if( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
   {
-    GetImplementation( button ).DoClickAction( attributes );
-    ret = true;
+    ret = GetImplementation( button ).DoClickAction( attributes );
   }
 
   return ret;
 }
 
-  void Button::DoClickAction( const Property::Map& attributes )
+bool Button::DoClickAction( const Property::Map& attributes )
 {
   // Prevents the button signals from doing a recursive loop by sending an action
   // and re-emitting the signals.
@@ -935,7 +934,11 @@ Actor& Button::GetDisabledBackgroundImage()
     mState = ButtonDown;
     OnButtonUp();
     mClickActionPerforming = false;
+
+    return true;
   }
+
+  return false;
 }
 
 void Button::UpdatePaintTransitionState()
@@ -1206,11 +1209,18 @@ void Button::OnInitialize()
   self.SetKeyboardFocusable( true );
 }
 
-void Button::OnActivated()
+bool Button::OnAccessibilityActivated()
+{
+  return OnKeyboardEnter();
+}
+
+bool Button::OnKeyboardEnter()
 {
-  // When the button is activated, it performs the click action
+  // When the enter key is pressed, or button is activated, the click action is performed.
   Property::Map attributes;
-  DoClickAction( attributes );
+  bool ret = DoClickAction( attributes );
+
+  return ret;
 }
 
 void Button::OnControlStageDisconnection()
index 02b1360..e4d49d7 100644 (file)
@@ -279,8 +279,9 @@ private:
   /**
    * Perform the click action to click the button.
    * @param[in] attributes The attributes to perfrom this action.
+   * @return true if this control can perform action.
    */
-  void DoClickAction( const Property::Map& attributes );
+  bool DoClickAction( const Property::Map& attributes );
 
   /**
    * This method is called after the button initialization.
@@ -454,9 +455,14 @@ private: // From Control
   virtual void OnInitialize();
 
   /**
-   * @copydoc Toolkit::Control::OnActivated()
+   * @copydoc Toolkit::Control::OnAccessibilityActivated()
    */
-  virtual void OnActivated();
+  virtual bool OnAccessibilityActivated();
+
+  /**
+   * @copydoc Toolkit::Control::OnKeyboardEnter()
+   */
+  virtual bool OnKeyboardEnter();
 
   /**
    * Callback received when the button is disconnected from the stage.
index e1693ad..0c37f7c 100644 (file)
@@ -81,7 +81,7 @@ DALI_TYPE_REGISTRATION_BEGIN_CREATE( Toolkit::KeyboardFocusManager, Dali::BaseHa
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-pre-focus-change",        SIGNAL_PRE_FOCUS_CHANGE        )
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-changed",           SIGNAL_FOCUS_CHANGED           )
 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-group-changed",     SIGNAL_FOCUS_GROUP_CHANGED     )
-DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-activated", SIGNAL_FOCUSED_ACTOR_ACTIVATED )
+DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-enter-key", SIGNAL_FOCUSED_ACTOR_ENTER_KEY )
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -339,21 +339,21 @@ bool KeyboardFocusManager::DoMoveFocusToNextFocusGroup(bool forward)
   return succeed;
 }
 
-void KeyboardFocusManager::DoActivate(Actor actor)
+void KeyboardFocusManager::DoKeyboardEnter(Actor actor)
 {
-  if(actor)
+  if( actor )
   {
-    Toolkit::Control control = Toolkit::Control::DownCast(actor);
-    if(control)
+    Toolkit::Control control = Toolkit::Control::DownCast( actor );
+    if( control )
     {
-      // Notify the control that it is activated
-      GetImplementation( control ).AccessibilityActivate();
+      // Notify the control that enter has been pressed on it.
+      GetImplementation( control ).KeyboardEnter();
     }
 
-    // Send notification for the activation of focused actor
-    if( !mFocusedActorActivatedSignal.Empty() )
+    // Send a notification for the actor.
+    if( !mFocusedActorEnterKeySignal.Empty() )
     {
-      mFocusedActorActivatedSignal.Emit(actor);
+      mFocusedActorEnterKeySignal.Emit( actor );
     }
   }
 }
@@ -655,9 +655,9 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
       }
       else
       {
-        // Activate the focused actor
+        // The focused actor has enter pressed on it
         Actor actor;
-        if(!isAccessibilityEnabled)
+        if( !isAccessibilityEnabled )
         {
           actor = GetCurrentFocusActor();
         }
@@ -666,9 +666,9 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
           actor = accessibilityManager.GetCurrentFocusActor();
         }
 
-        if(actor)
+        if( actor )
         {
-          DoActivate(actor);
+          DoKeyboardEnter( actor );
         }
       }
 
@@ -714,9 +714,9 @@ Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& KeyboardFocusManager
   return mFocusGroupChangedSignal;
 }
 
-Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
 {
-  return mFocusedActorActivatedSignal;
+  return mFocusedActorEnterKeySignal;
 }
 
 bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
@@ -738,9 +738,9 @@ bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTracke
   {
     manager->FocusGroupChangedSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+  else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ENTER_KEY ) )
   {
-    manager->FocusedActorActivatedSignal().Connect( tracker, functor );
+    manager->FocusedActorEnterKeySignal().Connect( tracker, functor );
   }
   else
   {
index bc456c2..de3770f 100644 (file)
@@ -125,9 +125,9 @@ public:
   Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& FocusGroupChangedSignal();
 
   /**
-   * @copydoc Toolkit::KeyboardFocusManager::FocusedActorActivatedSignal()
+   * @copydoc Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignal()
    */
-  Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+  Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -183,11 +183,11 @@ private:
   bool DoMoveFocusToNextFocusGroup(bool forward);
 
   /**
-   * Activate the actor. If the actor is control, call OnActivated virtual function.
-   * This function will emit FocusedActorActivatedSignal.
-   * @param actor The actor to activate
+   * Enter has been pressed on the actor. If the actor is control, call the OnKeybaordEnter virtual function.
+   * This function will emit FocusedActorEnterKeySignal.
+   * @param actor The actor to notify
    */
-  void DoActivate(Actor actor);
+  void DoKeyboardEnter( Actor actor );
 
   /**
    * Create the default indicator actor to highlight the focused actor.
@@ -243,7 +243,7 @@ private:
   Toolkit::KeyboardFocusManager::PreFocusChangeSignalType mPreFocusChangeSignal; ///< The signal to notify the focus will be changed
   Toolkit::KeyboardFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
   Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType mFocusGroupChangedSignal; ///< The signal to notify the focus group change
-  Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
+  Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType mFocusedActorEnterKeySignal; ///< The signal to notify that enter has been pressed on the focused actor
 
   unsigned int mCurrentFocusActor; ///< The actor ID of current focused actor
 
index e8df944..814c4fe 100644 (file)
@@ -1152,6 +1152,11 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
     {
       textChanged = BackspaceKeyEvent();
     }
+    else if ( IsKey( keyEvent,  Dali::DALI_KEY_POWER ) || IsKey( keyEvent, Dali::DALI_KEY_MENU ) )
+    {
+      // Do nothing when the Power or Menu Key is pressed.
+      // It avoids call the InsertText() method and delete the selected text.
+    }
     else
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
index bbc98b4..271a5ce 100644 (file)
@@ -64,12 +64,12 @@ BaseHandle Create()
  * @param[in] attributes The attributes with which to perfrom this action.
  * @return true if action has been accepted by this control
  */
-const char* ACTION_CONTROL_ACTIVATED = "control-activated";
+const char* ACTION_ACCESSIBILITY_ACTIVATED = "accessibility-activated";
 static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
 {
   bool ret = false;
 
-  if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) )
+  if( object && ( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ) )
   {
     Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
     if( control )
@@ -158,7 +158,7 @@ SignalConnectorType registerSignal5( typeRegistration, SIGNAL_PANNED, &DoConnect
 SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal );
 SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal );
 
-TypeAction registerAction( typeRegistration, ACTION_CONTROL_ACTIVATED, &DoAction );
+TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction );
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -767,11 +767,22 @@ void Control::AccessibilityActivate()
   OnAccessibilityActivated();
 }
 
+void Control::KeyboardEnter()
+{
+  // Inform deriving classes
+  OnKeyboardEnter();
+}
+
 bool Control::OnAccessibilityActivated()
 {
   return false; // Accessibility activation is not handled by default
 }
 
+bool Control::OnKeyboardEnter()
+{
+  return false; // Keyboard enter is not handled by default
+}
+
 bool Control::OnAccessibilityPan(PanGesture gesture)
 {
   return false; // Accessibility pan gesture is not handled by default
index ce793f3..1c3c35d 100644 (file)
@@ -222,13 +222,16 @@ public:
    */
   bool IsKeyboardFocusGroup();
 
-  // Called by Focus Manager
-
   /**
-   * @brief Called by the accessibility focus manager and keyboard focus manager to activate the Control
+   * @brief Called by the AccessibilityManager to activate the Control.
    */
   DALI_INTERNAL void AccessibilityActivate();
 
+  /**
+   * @brief Called by the KeyboardFocusManager.
+   */
+  DALI_INTERNAL void KeyboardEnter();
+
   // Signals
 
   /**
@@ -510,6 +513,14 @@ public: // API for derived classes to override
    */
   virtual void OnKeyboardFocusChangeCommitted( Actor commitedFocusableActor );
 
+  /**
+   * @brief This method is called when the control has enter pressed on it.
+   *
+   * Derived classes should override this to perform custom actions.
+   * @return true if this control supported this action.
+   */
+  virtual bool OnKeyboardEnter();
+
   // Gestures
 
   /**
index e7511a1..1e4d74d 100644 (file)
@@ -59,9 +59,9 @@ class Control;
  * | long-pressed           | @ref GetLongPressGestureDetector().DetectedSignal() |
  *
  * Actions
- * | %Action Name      | %Control method called                              |
- * |-------------------|-----------------------------------------------------|
- * | control-activated | %OnActivated()                                      |
+ * | %Action Name            | %Control method called                             |
+ * |-------------------------|----------------------------------------------------|
+ * | accessibility-activated | %OnAccessibilityActivated()                        |
  */
 class DALI_IMPORT_API Control : public CustomActor
 {
index 2e0ffbe..a816ca2 100644 (file)
@@ -122,9 +122,9 @@ KeyboardFocusManager::FocusGroupChangedSignalType& KeyboardFocusManager::FocusGr
   return GetImpl(*this).FocusGroupChangedSignal();
 }
 
-KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
 {
-  return GetImpl(*this).FocusedActorActivatedSignal();
+  return GetImpl(*this).FocusedActorEnterKeySignal();
 }
 
 } // namespace Toolkit
index 6afcd6b..3383a47 100644 (file)
@@ -47,7 +47,7 @@ class KeyboardFocusManager;
  * | keyboard-pre-focus-change        | @ref PreFocusChangeSignal()        |
  * | keyboard-focus-changed           | @ref FocusChangedSignal()          |
  * | keyboard-focus-group-changed     | @ref FocusGroupChangedSignal()     |
- * | keyboard-focused-actor-activated | @ref FocusedActorActivatedSignal() |
+ * | keyboard-focused-actor-enter-key | @ref FocusedActorEnterKeySignal()  |
  */
 class DALI_IMPORT_API KeyboardFocusManager : public BaseHandle
 {
@@ -63,8 +63,8 @@ public:
   /// @brief Focus group changed signal
   typedef Signal< void ( Actor, bool ) > FocusGroupChangedSignalType;
 
-  /// @brief Focused actor activated signal
-  typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType;
+  /// @brief Focused actor has the enter key pressed signal
+  typedef Signal< void ( Actor ) > FocusedActorEnterKeySignalType;
 
   /**
    * @brief Create a KeyboardFocusManager handle; this can be initialised with KeyboardFocusManager::New().
@@ -251,16 +251,16 @@ public: // Signals
   FocusGroupChangedSignalType& FocusGroupChangedSignal();
 
   /**
-   * @brief This signal is emitted when the current focused actor is activated.
+   * @brief This signal is emitted when the current focused actor has the enter key pressed on it.
    *
    * A callback of the following type may be connected:
    * @code
-   *   void YourCallbackName(Actor activatedActor);
+   *   void YourCallbackName(Actor enterPressedActor);
    * @endcode
    * @pre The Object has been initialized.
    * @return The signal to connect to.
    */
-  FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+  FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
 
   // Not intended for application developers
 
index e4d433b..4938c01 100644 (file)
@@ -11,7 +11,6 @@
 var actor = new dali.Actor();
 var imageActor = new dali.ImageActor();
 var textActor = new dali.TextActor("hello world");
-var meshActor = new dali.MeshActor();
 var camera = new dali.CameraActor();
 var layer = new dali.Layer();
 ```
@@ -645,4 +644,4 @@ POSTITION_INHERITANCE
  * @type Vector3
  * @property sizeModeFactor
  */
-SIZE_MODE_FACTOR
\ No newline at end of file
+SIZE_MODE_FACTOR
diff --git a/plugins/dali-script-v8/docs/content/renderable-actor.js b/plugins/dali-script-v8/docs/content/renderable-actor.js
deleted file mode 100644 (file)
index b2509bf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- *
-# 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 9914d3a..d995aa1 100644 (file)
@@ -14,8 +14,6 @@ script_v8_plugin_src_files = \
    $(v8_plugin_dir)/actors/layer-api.cpp \
    $(v8_plugin_dir)/actors/image-actor-api.cpp \
    $(v8_plugin_dir)/actors/camera-actor-api.cpp \
-   $(v8_plugin_dir)/actors/mesh-actor-api.cpp \
-   $(v8_plugin_dir)/actors/renderable-actor-api.cpp \
    $(v8_plugin_dir)/constants/constants-wrapper.cpp \
    $(v8_plugin_dir)/animation/animation-api.cpp \
    $(v8_plugin_dir)/animation/animation-wrapper.cpp \
index 1686958..704c2d1 100644 (file)
@@ -25,9 +25,7 @@
 #include <actors/layer-api.h>
 #include <actors/actor-api.h>
 #include <actors/image-actor-api.h>
-#include <actors/mesh-actor-api.h>
 #include <actors/camera-actor-api.h>
-#include <actors/renderable-actor-api.h>
 #include <v8-utils.h>
 #include <dali-wrapper.h>
 
@@ -39,7 +37,6 @@ namespace V8Plugin
 
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mImageActorTemplate;
-v8::Persistent<v8::ObjectTemplate> ActorWrapper::mMeshActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mCameraActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mLayerActorTemplate;
 v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextLabelTemplate;
@@ -63,7 +60,6 @@ const ActorTemplate ActorTemplateLookup[]=
 {
     { &ActorWrapper::mActorTemplate },        // ACTOR
     { &ActorWrapper::mImageActorTemplate },   // IMAGE_ACTOR
-    { &ActorWrapper::mMeshActorTemplate  },   // MESH_ACTOR
     { &ActorWrapper::mLayerActorTemplate },   // LAYER_ACTOR
     { &ActorWrapper::mCameraActorTemplate},   // CAMERA_ACTOR
     { &ActorWrapper::mTextLabelTemplate }
@@ -75,11 +71,9 @@ const ActorTemplate ActorTemplateLookup[]=
 enum ActorApiBitMask
 {
   ACTOR_API              = 1 << 0,
-  RENDERABLE_ACTOR_API   = 1 << 1,
-  IMAGE_ACTOR_API        = 1 << 2,
-  MESH_ACTOR_API         = 1 << 3,
-  LAYER_API              = 1 << 4,
-  CAMERA_ACTOR_API       = 1 << 5,
+  IMAGE_ACTOR_API        = 1 << 1,
+  LAYER_API              = 1 << 2,
+  CAMERA_ACTOR_API       = 1 << 3,
 };
 
 /**
@@ -99,8 +93,7 @@ struct ActorApiStruct
 const ActorApiStruct ActorApiLookup[]=
 {
   {"Actor",      ActorWrapper::ACTOR,        ActorApi::New,       ACTOR_API },
-  {"ImageActor", ActorWrapper::IMAGE_ACTOR,  ImageActorApi::New,  ACTOR_API | RENDERABLE_ACTOR_API | IMAGE_ACTOR_API   },
-  {"MeshActor",  ActorWrapper::MESH_ACTOR,   MeshActorApi::New,   ACTOR_API | RENDERABLE_ACTOR_API | MESH_ACTOR_API    },
+  {"ImageActor", ActorWrapper::IMAGE_ACTOR,  ImageActorApi::New,  ACTOR_API | IMAGE_ACTOR_API   },
   {"Layer",      ActorWrapper::LAYER_ACTOR,  LayerApi::New,       ACTOR_API | LAYER_API                                },
   {"CameraActor",ActorWrapper::CAMERA_ACTOR, CameraActorApi::New, ACTOR_API | CAMERA_ACTOR_API                         },
   {"TextLabel",  ActorWrapper::TEXT_LABEL,   TextLabelApi::New,   ACTOR_API },
@@ -172,7 +165,7 @@ struct ActorFunctions
 
 /**
  * Contains a list of all functions that can be called an
- * actor / image-actor / mesh-actor/ layer / camera-actor
+ * actor / image-actor / layer / camera-actor
  */
 const ActorFunctions ActorFunctionTable[]=
 {
@@ -246,24 +239,6 @@ const ActorFunctions ActorFunctionTable[]=
     { "IsKeyboardFocusable" , ActorApi::IsKeyboardFocusable,   ACTOR_API }, //-- should this be a property???
 
     /**************************************
-     * Renderable Actor API (in order of renderable-actor.h)
-     **************************************/
-    { "SetSortModifier",    RenderableActorApi::SetSortModifier,   RENDERABLE_ACTOR_API  },
-    { "GetSortModifier",    RenderableActorApi::GetSortModifier,   RENDERABLE_ACTOR_API  },
-    { "SetCullFace",        RenderableActorApi::SetCullFace,       RENDERABLE_ACTOR_API  },
-    { "GetCullFace",        RenderableActorApi::GetCullFace,       RENDERABLE_ACTOR_API  },
-    { "SetBlendMode",       RenderableActorApi::SetBlendMode,      RENDERABLE_ACTOR_API  },
-    { "GetBlendMode",       RenderableActorApi::GetBlendMode,      RENDERABLE_ACTOR_API  },
-    { "SetBlendFunc",       RenderableActorApi::SetBlendFunc,      RENDERABLE_ACTOR_API  },
-    { "GetBlendFunc",       RenderableActorApi::GetBlendFunc,      RENDERABLE_ACTOR_API  },
-    { "SetShaderEffect",    RenderableActorApi::SetShaderEffect,   RENDERABLE_ACTOR_API  },
-    { "GetShaderEffect",    RenderableActorApi::GetShaderEffect,   RENDERABLE_ACTOR_API  },
-    { "RemoveShaderEffect", RenderableActorApi::RemoveShaderEffect,RENDERABLE_ACTOR_API  },
-
-
-
-
-    /**************************************
      * Layer  API (in order of layer.h)
      **************************************/
     { "GetDepth",           LayerApi::GetDepth,                 LAYER_API  },
@@ -294,6 +269,17 @@ const ActorFunctions ActorFunctionTable[]=
     // ignore GetStyle, use imageActor.style
     // ignore SetNinePatchBorder use imageActor.border
     // ignore GetNinePatchBorder use imageActor.border
+    { "SetSortModifier",    ImageActorApi::SetSortModifier,   IMAGE_ACTOR_API  },
+    { "GetSortModifier",    ImageActorApi::GetSortModifier,   IMAGE_ACTOR_API  },
+    { "SetCullFace",        ImageActorApi::SetCullFace,       IMAGE_ACTOR_API  },
+    { "GetCullFace",        ImageActorApi::GetCullFace,       IMAGE_ACTOR_API  },
+    { "SetBlendMode",       ImageActorApi::SetBlendMode,      IMAGE_ACTOR_API  },
+    { "GetBlendMode",       ImageActorApi::GetBlendMode,      IMAGE_ACTOR_API  },
+    { "SetBlendFunc",       ImageActorApi::SetBlendFunc,      IMAGE_ACTOR_API  },
+    { "GetBlendFunc",       ImageActorApi::GetBlendFunc,      IMAGE_ACTOR_API  },
+    { "SetShaderEffect",    ImageActorApi::SetShaderEffect,   IMAGE_ACTOR_API  },
+    { "GetShaderEffect",    ImageActorApi::GetShaderEffect,   IMAGE_ACTOR_API  },
+    { "RemoveShaderEffect", ImageActorApi::RemoveShaderEffect,IMAGE_ACTOR_API  },
     // ignore SetFadeIn use imageActor.fadeIn
     // ignore GetFadeIn use imageActor.fadeIn
     // ignore SetFadeInDuration use imageActor.fadeInDuration
index d8644a5..7394fa0 100644 (file)
@@ -24,7 +24,8 @@
 #include <object/property-value-wrapper.h>
 #include <image/image-api.h>
 #include <image/image-wrapper.h>
-
+#include <shader-effects/shader-effect-api.h>
+#include <shader-effects/shader-effect-wrapper.h>
 
 namespace Dali
 {
@@ -150,6 +151,313 @@ void ImageActorApi::GetImage( const v8::FunctionCallbackInfo<v8::Value>& args )
   args.GetReturnValue().Set( localObject );
 }
 
+/**
+ * Allows modification of an actors position in the depth sort algorithm.
+ *
+ * The offset can be altered for each coplanar actor hence allowing an order of painting.
+ * @param { Number }  depthOffset the offset to be given to the actor. Positive values pushing it further back.
+ * @for ImageActor
+ * @method setSortModifier
+ */
+void ImageActorApi::SetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  float value = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
+    return;
+  }
+  imageActor.SetSortModifier( value );
+}
+
+/**
+ * Retrieves the offset used to modify an actors position in the depth sort algorithm.
+ * @for ImageActor
+ * @method getSortModifier .
+ * @return { Number} the offset that has been given to the actor. Positive values pushing it further back
+ */
+void ImageActorApi::GetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Number::New( isolate, imageActor.GetSortModifier() ) );
+
+}
+
+/**
+ * Set the face-culling mode for this actor.
+ * @for ImageActor
+ * @method setCullFace
+ * @param {Number} cullMode
+ * @example
+ *      // cull mode should be one of the following constants
+ *      dali.CULL_FACE_DISABLE        // Face culling disabled
+ *      dali.CULL_FRONT_FACE          // Cull front facing polygons
+ *      dali.CULL_BACK_FACE           // Cull back facing polygons
+ *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygons
+ *      actor.SetCullFace( dali.CULL_FRONT_FACE );
+ */
+void ImageActorApi::SetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  int cullMode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
+    return;
+  }
+
+  imageActor.SetCullFace(  static_cast<Dali::CullFaceMode>( cullMode ) );
+
+}
+
+/**
+ * Retrieve the face-culling mode for this actor.
+ * @for ImageActor
+ * @method getCullFace
+ * @return {Number} cullMode
+ * @example
+ *      // cull mode is one of the following
+ *      dali.CULL_FACE_DISABLE        // Face culling disabled
+ *      dali.CULL_FRONT_FACE          // Cull front facing polygons
+ *      dali.CULL_BACK_FACE           // Cull back facing polygons
+ *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygon
+ */
+void ImageActorApi::GetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Integer::New( isolate, imageActor.GetCullFace() ) );
+
+}
+
+/**
+ * Sets the blending mode.
+ *
+ * If blending is disabled (BLENDING_OFF) fade in and fade out animations do not work.
+ *
+ * @example
+ *      // blend mode is one of the following
+ *      dali.BLENDING_OFF       // Blending is disabled.
+ *      dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
+ *      dali.BLENDING_ON        // Blending is enabled.
+ *      actor.SetBlendMode( dali.BLENDING_AUTO );
+ *
+ * @for ImageActor
+ * @method setBlendMode
+ * @param { Number } blendMode
+ */
+void ImageActorApi::SetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+  if( !found )
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter" );
+    return;
+  }
+  imageActor.SetBlendMode( static_cast<Dali::BlendingMode::Type>( mode ) );
+
+}
+
+/**
+ * @for ImageActor
+ * @method getBlendMode
+ * @return { Number } blendMode
+ * @example returns one of the following:
+ *
+ *        dali.BLENDING_OFF       // Blending is disabled.
+ *        dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
+ *        dali.BLENDING_ON        // Blending is enabled.
+ *
+ */
+void ImageActorApi::GetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  args.GetReturnValue().Set( v8::Integer::New( isolate, imageActor.GetBlendMode() ) );
+
+}
+
+/**
+ * @for ImageActor
+ * @method setBlendFunc
+ * @param {Number} SourceBlending RGB
+ * @param {Number} DestinationBlending RGB
+ * @param {Number} SourceBlending Alpha
+ * @param {Number} DestinatinoBlending Alpha
+ * @example
+ *      //blending constants
+      dali.BLEND_FACTOR_ZERO
+      dali.BLEND_FACTOR_ONE
+      dali.BLEND_FACTOR_SRC_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
+      dali.BLEND_FACTOR_SRC_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
+      dali.BLEND_FACTOR_DST_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
+      dali.BLEND_FACTOR_DST_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
+      dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
+      dali.BLEND_FACTOR_CONSTANT_COLOR
+      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
+      dali.BLEND_FACTOR_CONSTANT_ALPHA
+      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
+
+      actor.setBlendFunc(  dali.BLEND_FACTOR_CONSTANT_COLOR, BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
+                                dali.BLEND_FACTOR_CONSTANT_ALPHA, BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA);
+
+      );
+ */
+void ImageActorApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  int params[4];
+  bool foundAllParams(false);
+  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args,0 );
+  if( foundAllParams )
+  {
+    imageActor.SetBlendFunc(  static_cast< Dali::BlendingFactor::Type>(params[0]),
+                         static_cast< Dali::BlendingFactor::Type>(params[1]),
+                         static_cast< Dali::BlendingFactor::Type>(params[2]),
+                         static_cast< Dali::BlendingFactor::Type>(params[3]));
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter");
+    return;
+  }
+}
+
+/**
+ * @for ImageActor
+ * @method GetBlendFunc
+ * @return {Object} BlendProperties
+ * @example Blend properties object has 4 fields
+ *
+ *      blendProperties.sourceRgb // source rgb enum
+ *      blendProperties.destinationRgb  // destination rgb enum
+ *      blendProperties.sourceAlpha source // alpha enum
+ *      blendProperties.destinationAlpha // destination alpha enum
+ */
+void ImageActorApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  // @todo pass by reference doesn't work in Javascript so need to decide what to return
+  // for now just return a vector 4...
+
+  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  imageActor.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+
+  v8::Local<v8::Object> blendInfo = v8::Object::New( isolate );
+
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
+  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
+
+  args.GetReturnValue().Set( blendInfo );
+
+}
+
+/**
+ * @for ImageActor
+ * @method getShaderEffect
+ * @return {Object} ShaderEffect object
+ *
+ * Retrieve the shader effect for the Actor.
+ *
+ * @example
+ *    var shaderEffect = actor.getShaderEffect();
+ *
+ */
+void ImageActorApi::GetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  v8::Local < v8::Object > object = ShaderEffectWrapper::WrapShaderEffect( isolate, imageActor.GetShaderEffect() );
+  args.GetReturnValue().Set( object );
+
+}
+
+/**
+ * @for ImageActor
+ * @method setShaderEffect
+ * @param {Object} shaderEffect The shader effect.
+ *
+ * Sets the shader effect for the Actor.
+ *
+ * Shader effects provide special effects like rippling and bending.
+ * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
+ * @example
+ *      // first create the shaderOptions, then the shaderEffect
+ *      var shader = new dali.ShaderEffect( shaderOptions );
+ *      actor.setShaderEffect( shader );
+ *
+ */
+void ImageActorApi::SetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+
+  bool found( false );
+  ShaderEffect effect = ShaderEffectApi::GetShaderEffectFromParams( 0, found, isolate, args );
+  if( found )
+  {
+    imageActor.SetShaderEffect( effect );
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "shader effect parameter missing" );
+  }
+}
+
+/**
+ *
+ * Removes the current shader effect
+ *
+ * @example
+ *    actor.removeShaderEffect();
+ *
+ * @for ImageActor
+ * @method removeShaderEffect
+ */
+void ImageActorApi::RemoveShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+  ImageActor imageActor = GetImageActor( isolate, args );
+  imageActor.RemoveShaderEffect();
+}
+
 } // namespace V8Plugin
 
 } // namespace Dali
index 4bdbe76..2d00599 100644 (file)
@@ -42,6 +42,17 @@ namespace ImageActorApi
    */
   void SetImage( const v8::FunctionCallbackInfo< v8::Value >& args );
   void GetImage( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void GetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void SetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
+  void RemoveShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
 }; // namespace ImageActorApi
 
 } // namespace V8Plugin
diff --git a/plugins/dali-script-v8/src/actors/mesh-actor-api.cpp b/plugins/dali-script-v8/src/actors/mesh-actor-api.cpp
deleted file mode 100644 (file)
index a22ccae..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "mesh-actor-api.h"
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-#include <v8-utils.h>
-
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace //unnamed name space
-{
-
-MeshActor GetMeshActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
-  return MeshActor::DownCast( handleWrapper->mHandle );
-}
-
-} //unnamed name space
-
-/***************************************
- * MESH ACTOR FUNCTIONS
- ****************************************/
-/**
- * @constructor
- * @for MeshActor
- * @method MeshActor
- * @return {Object} MeshActor
- */
-Actor MeshActorApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  return MeshActor::New();
-}
-
-} // namespace V8Plugin
-
-} // namespace Dali
diff --git a/plugins/dali-script-v8/src/actors/mesh-actor-api.h b/plugins/dali-script-v8/src/actors/mesh-actor-api.h
deleted file mode 100644 (file)
index 5058039..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __DALI_V8PLUGIN_MESH_ACTOR_API_H__
-#define __DALI_V8PLUGIN_MESH_ACTOR_API_H__
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/devel-api/actors/mesh-actor.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace MeshActorApi
-{
-  /**
-   * constructor
-   */
-  Actor New( const v8::FunctionCallbackInfo< v8::Value >& args );
-}; // namespace MeshActorApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_MESH_ACTOR_API_H__
diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp b/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp
deleted file mode 100644 (file)
index 14b2baf..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "renderable-actor-api.h"
-
-// INTERNAL INCLUDES
-#include <object/handle-wrapper.h>
-#include <v8-utils.h>
-#include <object/property-value-wrapper.h>
-#include <shader-effects/shader-effect-api.h>
-#include <shader-effects/shader-effect-wrapper.h>
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace //unnamed name space
-{
-RenderableActor GetRenderableActor( v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
-  return RenderableActor::DownCast( handleWrapper->mHandle );
-}
-}
-/***************************************
- * RENDERABLE ACTOR FUNCTIONS
- *
- ****************************************/
-/**
- * Allows modification of an actors position in the depth sort algorithm.
- *
- * The offset can be altered for each coplanar actor hence allowing an order of painting.
- * @param { Number }  depthOffset the offset to be given to the actor. Positive values pushing it further back.
- * @for RenderableActor
- * @method setSortModifier
- */
-void RenderableActorApi::SetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  float value = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
-    return;
-  }
-  actor.SetSortModifier( value );
-}
-
-/**
- * Retrieves the offset used to modify an actors position in the depth sort algorithm.
- * @for RenderableActor
- * @method getSortModifier .
- * @return { Number} the offset that has been given to the actor. Positive values pushing it further back
- */
-void RenderableActorApi::GetSortModifier( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Number::New( isolate, actor.GetSortModifier() ) );
-
-}
-
-/**
- * Set the face-culling mode for this actor.
- * @for RenderableActor
- * @method setCullFace
- * @param {Number} cullMode
- * @example
- *      // cull mode should be one of the following constants
- *      dali.CULL_FACE_DISABLE        // Face culling disabled
- *      dali.CULL_FRONT_FACE          // Cull front facing polygons
- *      dali.CULL_BACK_FACE           // Cull back facing polygons
- *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygons
- *      actor.SetCullFace( dali.CULL_FRONT_FACE );
- */
-void RenderableActorApi::SetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  int cullMode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
-    return;
-  }
-
-  actor.SetCullFace(  static_cast<Dali::CullFaceMode>( cullMode ) );
-
-}
-
-/**
- * Retrieve the face-culling mode for this actor.
- * @for RenderableActor
- * @method getCullFace
- * @return {Number} cullMode
- * @example
- *      // cull mode is one of the following
- *      dali.CULL_FACE_DISABLE        // Face culling disabled
- *      dali.CULL_FRONT_FACE          // Cull front facing polygons
- *      dali.CULL_BACK_FACE           // Cull back facing polygons
- *      dali.CULL_FRONT_AND_BACK_FACE // Cull front and back facing polygon
- */
-void RenderableActorApi::GetCullFace( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, actor.GetCullFace() ) );
-
-}
-
-/**
- * Sets the blending mode.
- *
- * If blending is disabled (BLENDING_OFF) fade in and fade out animations do not work.
- *
- * @example
- *      // blend mode is one of the following
- *      dali.BLENDING_OFF       // Blending is disabled.
- *      dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *      dali.BLENDING_ON        // Blending is enabled.
- *      actor.SetBlendMode( dali.BLENDING_AUTO );
- *
- * @for RenderableActor
- * @method setBlendMode
- * @param { Number } blendMode
- */
-void RenderableActorApi::SetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter" );
-    return;
-  }
-  actor.SetBlendMode( static_cast<Dali::BlendingMode::Type>( mode ) );
-
-}
-
-/**
- * @for RenderableActor
- * @method getBlendMode
- * @return { Number } blendMode
- * @example returns one of the following:
- *
- *        dali.BLENDING_OFF       // Blending is disabled.
- *        dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *        dali.BLENDING_ON        // Blending is enabled.
- *
- */
-void RenderableActorApi::GetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, actor.GetBlendMode() ) );
-
-}
-
-/**
- * @for RenderableActor
- * @method setBlendFunc
- * @param {Number} SourceBlending RGB
- * @param {Number} DestinationBlending RGB
- * @param {Number} SourceBlending Alpha
- * @param {Number} DestinatinoBlending Alpha
- * @example
- *      //blending constants
-      dali.BLEND_FACTOR_ZERO
-      dali.BLEND_FACTOR_ONE
-      dali.BLEND_FACTOR_SRC_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
-      dali.BLEND_FACTOR_SRC_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
-      dali.BLEND_FACTOR_DST_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
-      dali.BLEND_FACTOR_DST_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
-      dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
-      dali.BLEND_FACTOR_CONSTANT_COLOR
-      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
-      dali.BLEND_FACTOR_CONSTANT_ALPHA
-      dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
-
-      actor.setBlendFunc(  dali.BLEND_FACTOR_CONSTANT_COLOR, BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
-                                dali.BLEND_FACTOR_CONSTANT_ALPHA, BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA);
-
-      );
- */
-void RenderableActorApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor =  GetRenderableActor( isolate, args );
-
-  int params[4];
-  bool foundAllParams(false);
-  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args,0 );
-  if( foundAllParams )
-  {
-    actor.SetBlendFunc(  static_cast< Dali::BlendingFactor::Type>(params[0]),
-                         static_cast< Dali::BlendingFactor::Type>(params[1]),
-                         static_cast< Dali::BlendingFactor::Type>(params[2]),
-                         static_cast< Dali::BlendingFactor::Type>(params[3]));
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter");
-    return;
-  }
-}
-
-/**
- * @for RenderableActor
- * @method GetBlendFunc
- * @return {Object} BlendProperties
- * @example Blend properties object has 4 fields
- *
- *      blendProperties.sourceRgb // source rgb enum
- *      blendProperties.destinationRgb  // destination rgb enum
- *      blendProperties.sourceAlpha source // alpha enum
- *      blendProperties.destinationAlpha // destination alpha enum
- */
-void RenderableActorApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  // @todo pass by reference doesn't work in Javascript so need to decide what to return
-  // for now just return a vector 4...
-
-  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  actor.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
-  v8::Local<v8::Object> blendInfo = v8::Object::New( isolate );
-
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
-  blendInfo->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
-
-  args.GetReturnValue().Set( blendInfo );
-
-}
-
-/**
- * @for RenderableActor
- * @method getShaderEffect
- * @return {Object} ShaderEffect object
- *
- * Retrieve the shader effect for the Actor.
- *
- * @example
- *    var shaderEffect = actor.getShaderEffect();
- *
- */
-void RenderableActorApi::GetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  v8::Local < v8::Object > object = ShaderEffectWrapper::WrapShaderEffect( isolate, actor.GetShaderEffect() );
-  args.GetReturnValue().Set( object );
-
-}
-
-/**
- * @for RenderableActor
- * @method setShaderEffect
- * @param {Object} shaderEffect The shader effect.
- *
- * Sets the shader effect for the Actor.
- *
- * Shader effects provide special effects like rippling and bending.
- * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
- * @example
- *      // first create the shaderOptions, then the shaderEffect
- *      var shader = new dali.ShaderEffect( shaderOptions );
- *      actor.setShaderEffect( shader );
- *
- */
-void RenderableActorApi::SetShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-
-  bool found( false );
-  ShaderEffect effect = ShaderEffectApi::GetShaderEffectFromParams( 0, found, isolate, args );
-  if( found )
-  {
-    actor.SetShaderEffect( effect );
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "shader effect parameter missing" );
-  }
-}
-
-/**
- *
- * Removes the current shader effect
- *
- * @example
- *    actor.removeShaderEffect();
- *
- * @for RenderableActor
- * @method removeShaderEffect
- */
-void RenderableActorApi::RemoveShaderEffect( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-  RenderableActor actor = GetRenderableActor( isolate, args );
-  actor.RemoveShaderEffect();
-}
-
-
-
-} // namespace V8Plugin
-
-} // namespace Dali
diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.h b/plugins/dali-script-v8/src/actors/renderable-actor-api.h
deleted file mode 100644 (file)
index 79716a1..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
-#define __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
-
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// EXTERNAL INCLUDES
-#include <v8.h>
-#include <dali/public-api/actors/renderable-actor.h>
-
-
-namespace Dali
-{
-
-namespace V8Plugin
-{
-
-namespace RenderableActorApi
-{
-   /**
-   * RenderableActor API see renderable-actor.h for a description
-   * Unfortunately none of the functions are covered by the property system
-   */
-  void SetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetSortModifier( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetCullFace( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void GetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void SetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-  void RemoveShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );
-
-
-}; // namespace RenderableActorApi
-
-} // namespace V8Plugin
-
-} // namespace Dali
-
-#endif // header __DALI_V8PLUGIN_RENDERABLE_ACTOR_API_H__
index 4217d98..c3b2043 100644 (file)
@@ -29,7 +29,6 @@
 #include <dali/public-api/actors/draw-mode.h>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/blending.h>
-#include <dali/public-api/actors/renderable-actor.h>
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/common/loading-state.h>
index 4d65e64..5143d49 100644 (file)
@@ -37,22 +37,6 @@ namespace // un named namespace
 
 typedef  std::vector< std::string > HintsArray;
 
-
-struct GeometryTypePair
-{
-  const char* name;
-  GeometryType type;
-};
-
-const GeometryTypePair GeometryTypeTable[]=
-{
-    {"image",         GEOMETRY_TYPE_IMAGE },
-    {"mesh",          GEOMETRY_TYPE_UNTEXTURED_MESH  },
-    {"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH },
-};
-
-const unsigned int GeometryTypeTableCount = sizeof(GeometryTypeTable)/sizeof(GeometryTypeTable[0]);
-
 struct GeometryHintPair
 {
   const char* name;
@@ -77,24 +61,10 @@ const unsigned int GeometryHintTableCount = sizeof(GeometryHintTable)/sizeof(Geo
 struct ShaderParameters
 {
   ShaderParameters()
-      : mType( GEOMETRY_TYPE_IMAGE),
-        mHints( ShaderEffect::HINT_NONE )
+      : mHints( ShaderEffect::HINT_NONE )
   {
   }
 
-  void SetGeometryType( v8::Isolate* isolate, const std::string& typeName )
-  {
-     for( unsigned int i = 0; i < GeometryTypeTableCount; ++i )
-     {
-       if( typeName == GeometryTypeTable[i].name )
-       {
-         mType = GeometryTypeTable[i].type;
-         return;
-       }
-     }
-     DALI_SCRIPT_EXCEPTION( isolate, "Geometry type not found\n");
-  }
-
   ShaderEffect::GeometryHints GetGeometryHint( const std::string& hint )
   {
     for( unsigned int i = 0 ; i < GeometryHintTableCount; ++i )
@@ -115,22 +85,18 @@ struct ShaderParameters
     }
   }
 
-
-
   ShaderEffect NewShader()
   {
     return ShaderEffect::NewWithPrefix( mVertexPrefix ,
                               mVertex,
                               mFragmentPrefix,
                               mFragment,
-                              mType,
                               mHints);
   }
   std::string mVertexPrefix;
   std::string mVertex;
   std::string mFragmentPrefix;
   std::string mFragment;
-  GeometryType mType;
   ShaderEffect::GeometryHints mHints;
 };
 
@@ -197,14 +163,6 @@ ShaderEffect ShaderEffectApi::New(  v8::Isolate* isolate, const v8::FunctionCall
 
     v8::Local<v8::Object > obj = args[0]->ToObject();
 
-    v8::Local<v8::Value> geometryTypeValue = obj->Get(v8::String::NewFromUtf8( isolate, "geometryType"));
-    if( geometryTypeValue->IsString() )
-    {
-      std::string geometryTypeName = V8Utils::v8StringToStdString( geometryTypeValue );
-     // printf(" geometry type found %s \n", geometryTypeName.c_str() );
-      shaderParams.SetGeometryType( isolate, geometryTypeName );
-    }
-
     v8::Local<v8::Value> vertexPrefixValue = obj->Get(v8::String::NewFromUtf8( isolate, "vertexShaderPrefix"));
     if( vertexPrefixValue->IsString() )
     {