From 9c3f6174a98102d63b807892a9d13c3e07e72de5 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Wed, 30 Dec 2020 16:06:20 +0100 Subject: Revert "Stop modifying size values in sidebar when user still editing" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2dea8fd43fa4080b3d048415bbbf9a9f7e93b70a. Change-Id: I76ec8aaf51eb6c3813445e3a42dbe77f4a90f491 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108514 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai --- .../sidebar/possize/PosSizePropertyPanel.cxx | 105 ++------------------- .../sidebar/possize/PosSizePropertyPanel.hxx | 13 +-- 2 files changed, 12 insertions(+), 106 deletions(-) (limited to 'svx') diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index a85d44422499..e5cc427a0f2a 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -190,27 +190,12 @@ namespace void PosSizePropertyPanel::Initialize() { //Position : Horizontal / Vertical - mpMtrPosX->SetLoseFocusHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); - mpMtrPosX->SetEnterHdl(LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); - mpMtrPosX->SetUpHdl( LINK( this, PosSizePropertyPanel, ChangePosXUpDownHdl ) ); - mpMtrPosX->SetDownHdl( LINK( this, PosSizePropertyPanel, ChangePosXUpDownHdl ) ); - - mpMtrPosY->SetLoseFocusHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); - mpMtrPosY->SetEnterHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); - mpMtrPosY->SetUpHdl( LINK( this, PosSizePropertyPanel, ChangePosYUpDownHdl ) ); - mpMtrPosY->SetDownHdl( LINK( this, PosSizePropertyPanel, ChangePosYUpDownHdl ) ); - + mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); + mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); //Size : Width / Height - mpMtrWidth->SetLoseFocusHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); - mpMtrWidth->SetEnterHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); - mpMtrWidth->SetUpHdl( LINK( this, PosSizePropertyPanel, ChangeWidthUpDownHdl ) ); - mpMtrWidth->SetDownHdl( LINK( this, PosSizePropertyPanel, ChangeWidthUpDownHdl ) ); - - mpMtrHeight->SetLoseFocusHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); - mpMtrHeight->SetEnterHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); - mpMtrHeight->SetUpHdl( LINK( this, PosSizePropertyPanel, ChangeHeightUpDownHdl ) ); - mpMtrHeight->SetDownHdl( LINK( this, PosSizePropertyPanel, ChangeHeightUpDownHdl ) ); + mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); + mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); //Size : Keep ratio mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) ); @@ -368,7 +353,7 @@ void PosSizePropertyPanel::HandleContextChange( } -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, Control&, void ) +IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, Edit&, void ) { if( mpCbxScale->IsChecked() && mpCbxScale->IsEnabled() ) @@ -389,29 +374,8 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, Control&, void ) executeSize(); } -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthUpDownHdl, SpinField&, void ) -{ - if( mpCbxScale->IsChecked() && - mpCbxScale->IsEnabled() ) - { - long nHeight = static_cast( (static_cast(mlOldHeight) * static_cast(mpMtrWidth->GetValue())) / static_cast(mlOldWidth) ); - if( nHeight <= mpMtrHeight->GetMax( FieldUnit::NONE ) ) - { - mpMtrHeight->SetUserValue( nHeight, FieldUnit::NONE ); - } - else - { - nHeight = static_cast(mpMtrHeight->GetMax( FieldUnit::NONE )); - mpMtrHeight->SetUserValue( nHeight ); - const long nWidth = static_cast( (static_cast(mlOldWidth) * static_cast(nHeight)) / static_cast(mlOldHeight) ); - mpMtrWidth->SetUserValue( nWidth, FieldUnit::NONE ); - } - } - executeSize(); -} - -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, Control&, void ) +IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, Edit&, void ) { if( mpCbxScale->IsChecked() && mpCbxScale->IsEnabled() ) @@ -432,45 +396,8 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, Control&, void ) executeSize(); } -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightUpDownHdl, SpinField&, void ) -{ - if( mpCbxScale->IsChecked() && - mpCbxScale->IsEnabled() ) - { - long nWidth = static_cast( (static_cast(mlOldWidth) * static_cast(mpMtrHeight->GetValue())) / static_cast(mlOldHeight) ); - if( nWidth <= mpMtrWidth->GetMax( FieldUnit::NONE ) ) - { - mpMtrWidth->SetUserValue( nWidth, FieldUnit::NONE ); - } - else - { - nWidth = static_cast(mpMtrWidth->GetMax( FieldUnit::NONE )); - mpMtrWidth->SetUserValue( nWidth ); - const long nHeight = static_cast( (static_cast(mlOldHeight) * static_cast(nWidth)) / static_cast(mlOldWidth) ); - mpMtrHeight->SetUserValue( nHeight, FieldUnit::NONE ); - } - } - executeSize(); -} - - -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Control&, void ) -{ - if ( mpMtrPosX->IsValueModified()) - { - long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); - - Fraction aUIScale = mpView->GetModel()->GetUIScale(); - lX = long( lX * aUIScale ); - - SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,static_cast(lX)); - - GetBindings()->GetDispatcher()->ExecuteList( - SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosXItem }); - } -} -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXUpDownHdl, SpinField&, void ) +IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void ) { if ( mpMtrPosX->IsValueModified()) { @@ -487,23 +414,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXUpDownHdl, SpinField&, void ) } -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Control&, void ) -{ - if ( mpMtrPosY->IsValueModified() ) - { - long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); - - Fraction aUIScale = mpView->GetModel()->GetUIScale(); - lY = long( lY * aUIScale ); - - SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,static_cast(lY)); - - GetBindings()->GetDispatcher()->ExecuteList( - SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosYItem }); - } -} - -IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYUpDownHdl, SpinField&, void ) +IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void ) { if ( mpMtrPosY->IsValueModified() ) { diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index becbcef6da0d..26854fa4873c 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -20,7 +20,6 @@ #define INCLUDED_SVX_SOURCE_SIDEBAR_POSSIZE_POSSIZEPROPERTYPANEL_HXX #include -#include #include #include #include @@ -158,14 +157,10 @@ private: css::uno::Reference mxSidebar; - DECL_LINK( ChangePosXHdl, Control&, void ); - DECL_LINK( ChangePosYHdl, Control&, void ); - DECL_LINK( ChangePosXUpDownHdl, SpinField&, void ); - DECL_LINK( ChangePosYUpDownHdl, SpinField&, void ); - DECL_LINK( ChangeWidthHdl, Control&, void ); - DECL_LINK( ChangeHeightHdl, Control&, void ); - DECL_LINK( ChangeWidthUpDownHdl, SpinField&, void ); - DECL_LINK( ChangeHeightUpDownHdl, SpinField&, void ); + DECL_LINK( ChangePosXHdl, Edit&, void ); + DECL_LINK( ChangePosYHdl, Edit&, void ); + DECL_LINK( ChangeWidthHdl, Edit&, void ); + DECL_LINK( ChangeHeightHdl, Edit&, void ); DECL_LINK( ClickAutoHdl, Button*, void ); DECL_LINK( AngleModifiedHdl, Edit&, void ); DECL_LINK( RotationHdl, svx::DialControl*, void ); -- cgit