From d3d546a8e15c96a97dbad986e73665201b02a85c Mon Sep 17 00:00:00 2001 From: Akshay Deep Date: Thu, 3 Mar 2016 19:33:53 +0530 Subject: tdf#98037 - SIDEBAR: Replacing 'Speed' drop downs with comboboxes Changed speed dropdown in SlideTransitionPanel to Duration combobox. Used Custom Widget VclComboBoxNumeric with MetricBox class. Unit set in seconds. Change-Id: Id295b0ecbd62c60e434d8c65f74d50cdc39c9ecc Reviewed-on: https://gerrit.libreoffice.org/22865 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- sd/source/ui/animations/SlideTransitionPane.cxx | 65 ++++++++++++++---------- sd/source/ui/animations/SlideTransitionPane.hxx | 7 +-- sd/uiconfig/simpress/ui/slidetransitionspanel.ui | 15 +++--- 3 files changed, 49 insertions(+), 38 deletions(-) mode change 100644 => 100755 sd/source/ui/animations/SlideTransitionPane.cxx mode change 100644 => 100755 sd/source/ui/animations/SlideTransitionPane.hxx mode change 100644 => 100755 sd/uiconfig/simpress/ui/slidetransitionspanel.ui diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx old mode 100644 new mode 100755 index fb6057cfc4e0..1778f13a72ed --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -408,8 +408,8 @@ SlideTransitionPane::SlideTransitionPane( { get(mpFT_VARIANT, "variant_label"); get(mpLB_VARIANT, "variant_list"); - get(mpFT_SPEED, "speed_label"); - get(mpLB_SPEED, "speed_list"); + get(mpFT_duration, "duration_label"); + get(mpCBX_duration, "transition_duration"); get(mpFT_SOUND, "sound_label"); get(mpLB_SOUND, "sound_list"); get(mpCB_LOOP_SOUND, "loop_sound" ); @@ -441,6 +441,11 @@ SlideTransitionPane::SlideTransitionPane( VALUESET_APPEND, /* show legend */ true ); mpVS_TRANSITION_ICONS->RecalculateItemSizes(); + mpCBX_duration->InsertValue(100, FUNIT_CUSTOM); + mpCBX_duration->InsertValue(200, FUNIT_CUSTOM); + mpCBX_duration->InsertValue(300, FUNIT_CUSTOM); + mpCBX_duration->AdaptDropDownLineCountToMaximum(); + // set defaults mpCB_AUTO_PREVIEW->Check(); // automatic preview on @@ -454,7 +459,8 @@ SlideTransitionPane::SlideTransitionPane( mpVS_TRANSITION_ICONS->SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected )); mpLB_VARIANT->SetSelectHdl( LINK( this, SlideTransitionPane, VariantListBoxSelected )); - mpLB_SPEED->SetSelectHdl( LINK( this, SlideTransitionPane, SpeedListBoxSelected )); + mpCBX_duration->SetModifyHdl(LINK( this, SlideTransitionPane, DurationModifiedHdl)); + mpCBX_duration->SetLoseFocusHdl(LINK( this, SlideTransitionPane, DurationLoseFocusHdl)); mpLB_SOUND->SetSelectHdl( LINK( this, SlideTransitionPane, SoundListBoxSelected )); mpCB_LOOP_SOUND->SetClickHdl( LINK( this, SlideTransitionPane, LoopSoundBoxChecked )); @@ -483,8 +489,8 @@ void SlideTransitionPane::dispose() mpVS_TRANSITION_ICONS.disposeAndClear(); mpFT_VARIANT.clear(); mpLB_VARIANT.clear(); - mpFT_SPEED.clear(); - mpLB_SPEED.clear(); + mpFT_duration.clear(); + mpCBX_duration.clear(); mpFT_SOUND.clear(); mpLB_SOUND.clear(); mpCB_LOOP_SOUND.clear(); @@ -506,7 +512,7 @@ void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent) void SlideTransitionPane::UpdateLook() { SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); - mpFT_SPEED->SetBackground(Wallpaper()); + mpFT_duration->SetBackground(Wallpaper()); mpFT_SOUND->SetBackground(Wallpaper()); } @@ -593,12 +599,14 @@ void SlideTransitionPane::updateControls() } if( aEffect.mbDurationAmbiguous ) - mpLB_SPEED->SetNoSelection(); + { + mpCBX_duration->SetText(""); + mpCBX_duration->SetNoSelection(); + } else - mpLB_SPEED->SelectEntryPos( - (aEffect.mfDuration > 2.0 ) - ? 0 : (aEffect.mfDuration < 2.0) - ? 2 : 1 ); // else FADE_SPEED_FAST + { + mpCBX_duration->SetValue( (aEffect.mfDuration)*100.0 ); + } if( aEffect.mbSoundAmbiguous ) { @@ -617,7 +625,6 @@ void SlideTransitionPane::updateControls() tSoundListType::size_type nPos = 0; if( lcl_findSoundInList( maSoundList, aEffect.maSound, nPos )) { - // skip first three entries mpLB_SOUND->SelectEntryPos( nPos + 3 ); maCurrentSoundFile = aEffect.maSound; } @@ -661,7 +668,7 @@ void SlideTransitionPane::updateControlState() { mpVS_TRANSITION_ICONS->Enable( mbHasSelection ); mpLB_VARIANT->Enable( mbHasSelection && mpLB_VARIANT->GetEntryCount() > 0 ); - mpLB_SPEED->Enable( mbHasSelection ); + mpCBX_duration->Enable( mbHasSelection ); mpLB_SOUND->Enable( mbHasSelection ); mpCB_LOOP_SOUND->Enable( mbHasSelection && (mpLB_SOUND->GetSelectEntryPos() > 2)); mpRB_ADVANCE_ON_MOUSE->Enable( mbHasSelection ); @@ -801,22 +808,17 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co } } aResult.mbEffectAmbiguous = false; - - } else if (mpVS_TRANSITION_ICONS->IsNoSelection()) + } + else if (mpVS_TRANSITION_ICONS->IsNoSelection()) + { aResult.mbEffectAmbiguous = false; + } - // speed - if( mpLB_SPEED->IsEnabled() && - mpLB_SPEED->GetSelectEntryCount() > 0 ) - { - sal_Int32 nPos = mpLB_SPEED->GetSelectEntryPos(); - aResult.mfDuration = (nPos == 0) - ? 3.0 - : (nPos == 1) - ? 2.0 - : 1.0; // nPos == 2 - DBG_ASSERT( aResult.mfDuration != 1.0 || nPos == 2, "Invalid Listbox Entry" ); + //duration + if( mpCBX_duration->IsEnabled() && (!(mpCBX_duration->GetText()).isEmpty()) ) + { + aResult.mfDuration = static_cast(mpCBX_duration->GetValue())/100.0; aResult.mbDurationAmbiguous = false; } @@ -1079,7 +1081,16 @@ IMPL_LINK_NOARG_TYPED(SlideTransitionPane, VariantListBoxSelected, ListBox&, voi applyToSelectedPages(); } -IMPL_LINK_NOARG_TYPED(SlideTransitionPane, SpeedListBoxSelected, ListBox&, void) +IMPL_LINK_NOARG_TYPED(SlideTransitionPane, DurationModifiedHdl, Edit&, void) +{ + double duration_value = static_cast(mpCBX_duration->GetValue()); + if(duration_value <= 0.0) + mpCBX_duration->SetValue(0); + else + mpCBX_duration->SetValue(duration_value); +} + +IMPL_LINK_NOARG_TYPED(SlideTransitionPane, DurationLoseFocusHdl, Control&, void) { applyToSelectedPages(); } diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx old mode 100644 new mode 100755 index f8b8f438b7ef..9407ad14a1df --- a/sd/source/ui/animations/SlideTransitionPane.hxx +++ b/sd/source/ui/animations/SlideTransitionPane.hxx @@ -96,7 +96,8 @@ private: DECL_LINK_TYPED( AdvanceSlideRadioButtonToggled, RadioButton&, void ); DECL_LINK_TYPED( AdvanceTimeModified, Edit&, void ); DECL_LINK_TYPED( VariantListBoxSelected, ListBox&, void ); - DECL_LINK_TYPED( SpeedListBoxSelected, ListBox&, void ); + DECL_LINK_TYPED( DurationModifiedHdl, Edit&, void ); + DECL_LINK_TYPED( DurationLoseFocusHdl, Control&, void ); DECL_LINK_TYPED( SoundListBoxSelected, ListBox&, void ); DECL_LINK_TYPED( LoopSoundBoxChecked, Button*, void ); DECL_LINK_TYPED( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); @@ -108,8 +109,8 @@ private: VclPtr mpVS_TRANSITION_ICONS; VclPtr mpFT_VARIANT; VclPtr mpLB_VARIANT; - VclPtr mpFT_SPEED; - VclPtr mpLB_SPEED; + VclPtr mpFT_duration; + VclPtr mpCBX_duration; VclPtr mpFT_SOUND; VclPtr mpLB_SOUND; VclPtr mpCB_LOOP_SOUND; diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui old mode 100644 new mode 100755 index 2496c501127e..a1b861cf0d36 --- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui +++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui @@ -64,11 +64,11 @@ 6 12 - + True False end - Speed: + Duration: 0 @@ -77,15 +77,14 @@ - + True False + True + Select the speed of Slide Transition. + Select the speed of Slide Transition. True - - Slow - Medium - Fast - + adjustment1 1 -- cgit