tdf#98034 - SIDEBAR: Add delay spinbox to Custom Animation tab

Change-Id: Ie13a5e04207475794fef75c568786f37eb2c406f
Reviewed-on: https://gerrit.libreoffice.org/33230
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Heiko Tietze <tietze.heiko@googlemail.com>
Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com>
This commit is contained in:
Akshay Deep
2017-01-17 23:03:02 +05:30
parent b12823aa81
commit 76acb8ab5f
3 changed files with 96 additions and 7 deletions

View File

@@ -177,6 +177,9 @@ void CustomAnimationPane::initialize()
get(mpLBCategory, "categorylb");
get(mpFTAnimation, "effectlabel");
get(mpLBAnimation, "effect_list");
get(mpFTStartDelay, "delay_label");
get(mpMFStartDelay, "delay_value");
mpLBAnimation->SetSelectHdl(LINK(this, CustomAnimationPane, AnimationSelectHdl));
get(mpCustomAnimationList, "custom_animation_list");
mpCustomAnimationList->setController( dynamic_cast<ICustomAnimationListController*> ( this ) );
@@ -212,6 +215,9 @@ void CustomAnimationPane::initialize()
mpPBPlay->SetClickHdl( LINK( this, CustomAnimationPane, implClickHdl ) );
mpCBAutoPreview->SetClickHdl( LINK( this, CustomAnimationPane, implClickHdl ) );
mpLBCategory->SetSelectHdl( LINK(this, CustomAnimationPane, UpdateAnimationLB) );
mpMFStartDelay->SetModifyHdl( LINK(this, CustomAnimationPane, DelayModifiedHdl) );
mpMFStartDelay->SetLoseFocusHdl(LINK( this, CustomAnimationPane, DelayLoseFocusHdl));
if(!mbHorizontal)
maStrModify = mpFTEffect->GetText();
@@ -267,6 +273,8 @@ void CustomAnimationPane::dispose()
mpPBPropertyMore.clear();
mpFTDuration.clear();
mpCBXDuration.clear();
mpFTStartDelay.clear();
mpMFStartDelay.clear();
mpCustomAnimationList.clear();
mpPBMoveUp.clear();
mpPBMoveDown.clear();
@@ -506,6 +514,8 @@ void CustomAnimationPane::updateControls()
mpLBCategory->Disable();
mpFTAnimation->Disable();
mpLBAnimation->Disable();
mpFTStartDelay->Disable();
mpMFStartDelay->Disable();
mpLBAnimation->Clear();
mpCustomAnimationList->clear();
return;
@@ -536,6 +546,8 @@ void CustomAnimationPane::updateControls()
mpLBStart->Enable(nSelectionCount > 0);
mpLBProperty->Enable(nSelectionCount > 0);
mpPBPropertyMore->Enable(nSelectionCount > 0);
mpFTStartDelay->Enable(nSelectionCount > 0);
mpMFStartDelay->Enable(nSelectionCount > 0);
mpFTProperty->SetText( maStrProperty );
@@ -600,6 +612,8 @@ void CustomAnimationPane::updateControls()
mpFTProperty->Enable( false );
mpLBProperty->Enable( false );
mpPBPropertyMore->Enable( false );
mpFTStartDelay->Enable( false );
mpMFStartDelay->Enable( false );
}
sal_uInt32 nCategoryPos = LISTBOX_ENTRY_NOTFOUND;
switch(pEffect->getPresetClass())
@@ -662,12 +676,19 @@ void CustomAnimationPane::updateControls()
}
mpPBPropertyMore->Enable();
mpFTStartDelay->Enable();
mpMFStartDelay->Enable();
double fBegin = pEffect->getBegin();
mpMFStartDelay->SetValue(fBegin*10.0);
}
else
{
mpLBProperty->setSubControl( nullptr );
mpFTProperty->Enable( false );
mpLBProperty->Enable( false );
mpFTStartDelay->Enable( false );
mpMFStartDelay->Enable( false );
mpPBPropertyMore->Enable( false );
mpFTDuration->Enable(false);
mpCBXDuration->Enable(false);
@@ -1288,15 +1309,17 @@ void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLProper
}
}
double fBegin = 0.0;
if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState::Direct )
{
double fBegin = 0.0;
pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin;
if( pEffect->getBegin() != fBegin )
{
pEffect->setBegin( fBegin );
bChanged = true;
}
else
fBegin = pEffect->getBegin();
if( pEffect->getBegin() != fBegin && pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState::Direct)
{
pEffect->setBegin( fBegin );
bChanged = true;
}
if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState::Direct )
@@ -2011,6 +2034,32 @@ IMPL_LINK_NOARG(CustomAnimationPane, implPropertyHdl, LinkParamNone*, void)
}
}
IMPL_LINK_NOARG(CustomAnimationPane, DelayModifiedHdl, Edit&, void)
{
addUndo();
}
IMPL_LINK_NOARG(CustomAnimationPane, DelayLoseFocusHdl, Control&, void)
{
double fBegin = mpMFStartDelay->GetValue();
//sequence rebuild only when the control loses focus
MainSequenceRebuildGuard aGuard( mpMainSequence );
// change selected effect
EffectSequence::iterator aIter( maListSelection.begin() );
const EffectSequence::iterator aEnd( maListSelection.end() );
while( aIter != aEnd )
{
CustomAnimationEffectPtr pEffect = (*aIter++);
pEffect->setBegin( fBegin/10.0 );
}
mpMainSequence->rebuild();
updateControls();
mrBase.GetDocShell()->SetModified();
}
IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
{
if( maListSelection.size() == 1 )

View File

@@ -125,6 +125,8 @@ private:
DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void );
DECL_LINK( lateInitCallback, Timer *, void );
DECL_LINK( DurationModifiedHdl, Edit&, void );
DECL_LINK( DelayModifiedHdl, Edit&, void );
DECL_LINK( DelayLoseFocusHdl, Control&, void );
DECL_LINK( UpdateAnimationLB, ListBox&, void );
DECL_LINK( AnimationSelectHdl, ListBox&, void );
void implControlHdl(Control*);
@@ -145,6 +147,8 @@ private:
VclPtr<PushButton> mpPBPropertyMore;
VclPtr<FixedText> mpFTDuration;
VclPtr<MetricBox> mpCBXDuration;
VclPtr<FixedText> mpFTStartDelay;
VclPtr<MetricField> mpMFStartDelay;
VclPtr<CustomAnimationList> mpCustomAnimationList;
VclPtr<PushButton> mpPBMoveUp;
VclPtr<PushButton> mpPBMoveDown;

View File

@@ -3,6 +3,11 @@
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">999.99000000000001</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -337,6 +342,37 @@
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="delay_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">_Delay:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="delay_value:0.0sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="text" translatable="yes">0.0</property>
<property name="adjustment">adjustment1</property>
<property name="digits">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>