diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-03-03 19:33:53 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-04-28 07:50:37 +0000 |
commit | d3d546a8e15c96a97dbad986e73665201b02a85c (patch) | |
tree | 481624fbdd1a81196c767676cb397e19c239f12b /sd | |
parent | b94d753ac9e3894da055d31bbb7bb20e11b97b5a (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sd')
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/animations/SlideTransitionPane.cxx | 65 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/animations/SlideTransitionPane.hxx | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/uiconfig/simpress/ui/slidetransitionspanel.ui | 15 |
3 files changed, 49 insertions, 38 deletions
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index fb6057cfc4e0..1778f13a72ed 100644..100755 --- 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<double>(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<double>(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 index f8b8f438b7ef..9407ad14a1df 100644..100755 --- 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<ValueSet> mpVS_TRANSITION_ICONS; VclPtr<FixedText> mpFT_VARIANT; VclPtr<ListBox> mpLB_VARIANT; - VclPtr<FixedText> mpFT_SPEED; - VclPtr<ListBox> mpLB_SPEED; + VclPtr<FixedText> mpFT_duration; + VclPtr<MetricBox> mpCBX_duration; VclPtr<FixedText> mpFT_SOUND; VclPtr<ListBox> mpLB_SOUND; VclPtr<CheckBox> mpCB_LOOP_SOUND; diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui index 2496c501127e..a1b861cf0d36 100644..100755 --- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui +++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui @@ -64,11 +64,11 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkLabel" id="speed_label"> + <object class="GtkLabel" id="duration_label"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> - <property name="label" translatable="yes">Speed:</property> + <property name="label" translatable="yes">Duration:</property> <property name="xalign">0</property> </object> <packing> @@ -77,15 +77,14 @@ </packing> </child> <child> - <object class="GtkComboBoxText" id="speed_list"> + <object class="VclComboBoxNumeric" id="transition_duration:0.00sec"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Select the speed of Slide Transition.</property> + <property name="tooltip_text" translatable="yes">Select the speed of Slide Transition.</property> <property name="hexpand">True</property> - <items> - <item translatable="yes">Slow</item> - <item translatable="yes">Medium</item> - <item translatable="yes">Fast</item> - </items> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="left_attach">1</property> |