StickyNoteActor::~StickyNoteActor() { bool prevHasExceededMaxNumStickyNotes = StickyNoteMenuActionCustomizer::hasExceededMaxNumStickyNotes(); if ((GLOBAL(settings).curNumStickyNotes > 0)) --GLOBAL(settings).curNumStickyNotes; // change the sticky note pad texture to reflect the sticky note pad state if (prevHasExceededMaxNumStickyNotes && !StickyNoteMenuActionCustomizer::hasExceededMaxNumStickyNotes()) { CustomActor * actor = scnManager->getCustomActor<StickyNotePadActorImpl>(); if (actor) actor->setTextureID("icon.custom.stickyNotePad"); } // disable theme event notifications if (shared_ptr<ThemeManager> tm = themeManagerRef.lock()) tm->unregisterThemeEventHandler(this); // destroy the temporary actor SAFE_DELETE(_tmpAnimationActor); // dismiss the edit dialog dismissEditDialog(); // destroy the dialog SAFE_DELETE(_editDialog); // free the sticky note texture #ifdef DXRENDER onRelease(); #endif }
void ShadowView::SetShaderConstants() { CustomActor self = Self(); mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); mShadowRenderShader.SetUniform( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor ); Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME); Property::Index lightCameraViewMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME); Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraProjectionMatrixPropertyIndex, Source( mCameraActor, CameraActor::PROJECTION_MATRIX ), EqualToConstraintMatrix()); Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraViewMatrixPropertyIndex, Source( mCameraActor, CameraActor::VIEW_MATRIX ), EqualToConstraintMatrix()); mShadowRenderShader.ApplyConstraint(projectionMatrixConstraint); mShadowRenderShader.ApplyConstraint(viewMatrixConstraint); // Register a property that the user can use to control the blur in the internal object mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT); mBlurFilter.GetHandleForAnimateBlurStrength().ApplyConstraint( Constraint::New<float>( mBlurFilter.GetBlurStrengthPropertyIndex() , Source( self, mBlurStrengthPropertyIndex), EqualToConstraint()) ); // Register a property that the user can use to control the color of the shadow. Property::Index index = mShadowRenderShader.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME); mShadowColorPropertyIndex = self.RegisterProperty(SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor); mShadowRenderShader.ApplyConstraint(Constraint::New<Dali::Vector4>( index, Source( self, mShadowColorPropertyIndex ), EqualToConstraint()) ); }
StickyNoteActor::StickyNoteActor() : FileSystemActor() , themeManagerRef(themeManager) , _stickyNoteTextureId(0) , _tmpAnimationActor(NULL) , _selectExistingText(false) { // populate the predefined strings if necessary if (_predefinedPhrases.isEmpty()) { //const QString doubleClickMsg("\n(Double click it later to edit)"); _predefinedPhrases.append(QT_TR_NOOP("- Open another sticky note to read these")); if (winOS->GetLocaleLanguage().startsWith("en")) { _predefinedPhrases.append(QT_TR_NOOP("- Do something nice")); _predefinedPhrases.append(QT_TR_NOOP("- Bump around")); _predefinedPhrases.append(QT_TR_NOOP("- Do one thing everyday that scares you")); _predefinedPhrases.append(QT_TR_NOOP("- Buy a pen")); _predefinedPhrases.append(QT_TR_NOOP("- Take a nap")); _predefinedPhrases.append(QT_TR_NOOP("- Take a deep breath")); _predefinedPhrases.append(QT_TR_NOOP("- Buy a goldfish")); _predefinedPhrases.append(QT_TR_NOOP("- Pick up groceries")); _predefinedPhrases.append(QT_TR_NOOP("- Call Mom")); #ifndef DISABLE_PHONING _predefinedPhrases.append(QT_TR_NOOP("- Visit BumpTop.com")); #endif _predefinedPhrases.append(QT_TR_NOOP("- Think about life")); _predefinedPhrases.append(QT_TR_NOOP("- Reflect")); _predefinedPhrases.append(QT_TR_NOOP("- Read a book")); _predefinedPhrases.append(QT_TR_NOOP("- Take up Yoga")); _predefinedPhrases.append(QT_TR_NOOP("- Walk the dog")); _predefinedPhrases.append(QT_TR_NOOP("- Bake some bread")); _predefinedPhrases.append(QT_TR_NOOP("- Say something nice about someone")); _predefinedPhrases.append(QT_TR_NOOP("- Mow the lawn")); _predefinedPhrases.append(QT_TR_NOOP("- Plant a tree")); _predefinedPhrases.append(QT_TR_NOOP("- Save the planet")); _predefinedPhrases.append(QT_TR_NOOP("- Change the world")); _predefinedPhrases.append(QT_TR_NOOP("- Make a difference")); _predefinedPhrases.append(QT_TR_NOOP("- Fix global warming")); _predefinedPhrases.append(QT_TR_NOOP("- Do the dishes")); _predefinedPhrases.append(QT_TR_NOOP("- Write a blog entry")); _predefinedPhrases.append(QT_TR_NOOP("- Donate to a good cause")); _predefinedPhrases.append(QT_TR_NOOP("- Clean up my desktop")); _predefinedPhrases.append(QT_TR_NOOP("- Tell a friend about BumpTop")); _predefinedPhrases.append(QT_TR_NOOP("- Get some exercise")); _predefinedPhrases.append(QT_TR_NOOP("- Go for a bike ride")); } } pushFileSystemType(StickyNote); setText(QT_NT("")); hideText(true); ++GLOBAL(settings).curNumStickyNotes; // change the sticky note pad texture to reflect the sticky note pad state if (StickyNoteMenuActionCustomizer::hasExceededMaxNumStickyNotes()) { CustomActor * actor = scnManager->getCustomActor<StickyNotePadActorImpl>(); if (actor) actor->setTextureID("icon.custom.stickyNotePadDisabled"); } // enable theme event notifications themeManager->registerThemeEventHandler(this); }
void ShadowView::OnInitialize() { // root actor to parent all user added actors. Used as source actor for shadow render task. mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mChildrenRoot.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Vector2 stageSize = Stage::GetCurrent().GetSize(); mCameraActor = CameraActor::New(stageSize); mCameraActor.SetParentOrigin( ParentOrigin::CENTER ); // Target is constrained to point at the shadow plane origin mCameraActor.SetNearClippingPlane( 1.0f ); mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS); mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION); Property::Map customShader; customShader[ "vertex-shader" ] = RENDER_SHADOW_VERTEX_SOURCE; customShader[ "fragment-shader" ] = RENDER_SHADOW_FRAGMENT_SOURCE; customShader[ "subdivide-grid-x" ] = 20; customShader[ "subdivide-grid-y" ] = 20; customShader[ "hints" ] = "output-is-transparent"; mShadowRenderShader[ "shader" ] = customShader; // Create render targets needed for rendering from light's point of view mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ); mOutputImage = FrameBufferImage::New( stageSize.width * 0.5f, stageSize.height * 0.5f, Pixel::RGBA8888 ); ////////////////////////////////////////////////////// // Connect to actor tree Self().Add( mChildrenRoot ); Stage::GetCurrent().Add( mCameraActor ); mBlurFilter.SetRefreshOnDemand(false); mBlurFilter.SetInputImage(mSceneFromLightRenderTarget); mBlurFilter.SetOutputImage(mOutputImage); mBlurFilter.SetSize(stageSize * 0.5f); mBlurFilter.SetPixelFormat(Pixel::RGBA8888); mBlurRootActor = Actor::New(); mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" ); // Turn off inheritance to ensure filter renders properly mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION); mBlurRootActor.SetInheritOrientation(false); mBlurRootActor.SetInheritScale(false); mBlurRootActor.SetColorMode(USE_OWN_COLOR); Self().Add(mBlurRootActor); mBlurFilter.SetRootActor(mBlurRootActor); mBlurFilter.SetBackgroundColor(Vector4::ZERO); CustomActor self = Self(); // Register a property that the user can use to control the blur in the internal object mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT); Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() ); blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) ); blurStrengthConstraint.Apply(); }