X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpage-turn-view%2Fpage-turn-view-impl.cpp;h=2f4ba6c037106849e13c488934223956ffe701db;hp=078be1cacf5310dfe8e9879dcf2b1fb8a9e95911;hb=6b7d48695715c6f2292338fccbeeb02873d1f89d;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 078be1c..2f4ba6c 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -1,31 +1,43 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +/* + * Copyright (c) 2014 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 +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + // INTERNAL INCLUDES #include using namespace Dali; -namespace //unnamed namespace +namespace //Unnamed namespace { // To register type -TypeRegistration mType( typeid(Toolkit::PageTurnView), typeid(Toolkit::Control), NULL ); + +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::PageTurnView, Toolkit::Control, NULL ) +DALI_TYPE_REGISTRATION_END() // default grid density for page turn effect, 10 pixels by 10 pixels const float DEFAULT_GRID_DENSITY(10.0f); @@ -250,16 +262,22 @@ const int PageTurnView::NUMBER_OF_CACHED_PAGES = NUMBER_OF_CACHED_PAGES_EACH_SID const float PageTurnView::STATIC_PAGE_INTERVAL_DISTANCE = 1.0f; PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize ) -: ControlImpl( true ), +: Control( REQUIRES_TOUCH_EVENTS ), mPageFactory( pageFactory ), mPageSize( pageSize ), + mTotalPageCount( 0 ), mIsEditMode( false ), + mNeedOffscreenRendering( false ), mPanning( false ), mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ), mCurrentPageIndex( 0 ), mIndex( 0 ), mPress( false ), mPageUpdated( true ), + mDistanceUpCorner( 0.f ), + mDistanceBottomCorner( 0.f ), + mPanDisplacement( 0.f ), + mConstraints( false ), mPageTurnStartedSignal(), mPageTurnFinishedSignal(), mPagePanStartedSignal(), @@ -296,7 +314,7 @@ void PageTurnView::OnInitialize() for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ ) { mTurnEffect[i] = Toolkit::PageTurnEffect::New( false ); - mTurnEffect[i].SetProperty( ShaderEffect::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) ); + mTurnEffect[i].SetProperty( ShaderEffect::Property::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) ); mTurnEffect[i].SetPageSize( mPageSize ); mTurnEffect[i].SetShadowWidth(0.f); mTurnEffect[i].SetSpineShadowParameter( mSpineShadowParameter ); @@ -350,7 +368,6 @@ void PageTurnView::SetupRenderTasks() mCameraActor.SetParentOrigin(ParentOrigin::CENTER); mCameraActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); mCameraActor.SetInheritScale( false ); - mCameraActor.SetInvertYAxis(false); Self().Add(mCameraActor); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); @@ -364,7 +381,7 @@ void PageTurnView::SetupRenderTasks() Self().Add( mPageSourceActor[i] ); mPageSourceActor[i].SetSensitive( false ); - mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::Unused ); + mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::UNUSED ); mOffscreenTask[i] = taskList.CreateTask(); mOffscreenTask[i].SetRefreshRate( RenderTask::REFRESH_ONCE ); mOffscreenTask[i].SetCameraActor(mCameraActor); @@ -654,7 +671,7 @@ void PageTurnView::RefreshCurrentPage() RenderPage( mCurrentPageIndex ); } -void PageTurnView::OnPan( PanGesture gesture ) +void PageTurnView::OnPan( const PanGesture& gesture ) { if( mIsEditMode ) { @@ -875,7 +892,7 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition ) GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint(); float distance = offset.Length(); - Constraint rotationConstraint = Constraint::New( Actor::ROTATION, + Constraint rotationConstraint = Constraint::New( Actor::Property::ORIENTATION, Source( self, mPropertyPanDisplacement[mIndex] ), RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor])); mPanActor.ApplyConstraint( rotationConstraint ); @@ -917,7 +934,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe mPagePanFinishedSignal.Emit( handle ); - Actor actor = mPanActor; + ImageActor actor = mPanActor; if(mPress) { if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over @@ -977,7 +994,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe void PageTurnView::TurnedOver( Animation& animation ) { - Actor actor = mAnimationActorPair[animation]; + ImageActor actor = mAnimationActorPair[animation]; mIsTurnBack[actor] = !mIsTurnBack[actor]; actor.RemoveConstraints(); mRootOnScreen.Add(actor); @@ -996,7 +1013,7 @@ void PageTurnView::TurnedOver( Animation& animation ) void PageTurnView::SliddenBack( Animation& animation ) { - Actor actor = mAnimationActorPair[animation]; + ImageActor actor = mAnimationActorPair[animation]; mRootOnScreen.Add(actor); int index = mAnimationIndexPair[animation]; mIsSliding[index] = false; @@ -1026,14 +1043,9 @@ void PageTurnView::OrganizePageDepth() } } -void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect ) +void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect ) { - actor.SetShaderEffect( shaderEffect ); - - if( actor.GetChildCount() > 0 ) - { - actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect); - } + SetShaderEffectRecursively( actor, shaderEffect ); } Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()