From 0ec47906c488d20b4ce43a4df78bbed9ae7cd6b8 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 2 Jul 2024 12:55:53 +0200 Subject: tdf#161853 icon choice ctrl: Drop unused async select handler `SvtIconChoiceCtrl` and its implementation class, `SvxIconChoiceCtrl_Impl`, is only used in `VerticalTabControl`. That one sets the `WB_HIGHLIGHTFRAME` bit, so the code path using the asynchronous handling in `SvxIconChoiceCtrl_Impl::CallSelectHandler` never gets used. The comment in there also explains that this should happen synchronously in case of single-select mode, which is by now the only implemented mode. Therefore, drop the asynchronous handling altogether. Change-Id: I238f3bb26b590df32f6dc7e67c402b2fb1762a62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169879 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/control/imivctl.hxx | 4 ---- vcl/source/control/imivctl1.cxx | 41 +++-------------------------------------- 2 files changed, 3 insertions(+), 42 deletions(-) (limited to 'vcl/source/control') diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx index ecbb3020dd56..712599364304 100644 --- a/vcl/source/control/imivctl.hxx +++ b/vcl/source/control/imivctl.hxx @@ -119,7 +119,6 @@ class SvxIconChoiceCtrl_Impl Idle aAutoArrangeIdle; Idle aDocRectChangedIdle; Idle aVisRectChangedIdle; - Idle aCallSelectHdlIdle; Size aVirtOutputSize; Size aImageSize; Size aDefaultTextSize; @@ -139,7 +138,6 @@ class SvxIconChoiceCtrl_Impl bool bHighlightFramePressed; SvxIconChoiceCtrlEntry* pHead = nullptr; // top left entry SvxIconChoiceCtrlEntry* pCursor; - SvxIconChoiceCtrlEntry* pHdlEntry; LocalFocus aFocus; // Data for focusrect ::vcl::AccessibleFactoryAccess aAccFactory; @@ -161,7 +159,6 @@ class SvxIconChoiceCtrl_Impl DECL_LINK( AutoArrangeHdl, Timer*, void ); DECL_LINK( DocRectChangedHdl, Timer*, void ); DECL_LINK( VisRectChangedHdl, Timer*, void ); - DECL_LINK( CallSelectHdlHdl, Timer*, void ); void AdjustScrollBars(); void PositionScrollBars( tools::Long nRealWidth, tools::Long nRealHeight ); @@ -182,7 +179,6 @@ class SvxIconChoiceCtrl_Impl void ToggleSelection( SvxIconChoiceCtrlEntry* ); void DeselectAllBut( SvxIconChoiceCtrlEntry const * ); void Center( SvxIconChoiceCtrlEntry* pEntry ) const; - void CallSelectHandler(); tools::Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 5082e298fa15..ac384b34d167 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -59,12 +59,10 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aAutoArrangeIdle( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" ), aDocRectChangedIdle( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" ), aVisRectChangedIdle( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" ), - aCallSelectHdlIdle( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" ), aImageSize( 32 * pCurView->GetDPIScaleFactor(), 32 * pCurView->GetDPIScaleFactor()), pView(pCurView), nMaxVirtWidth(DEFAULT_MAX_VIRT_WIDTH), nMaxVirtHeight(DEFAULT_MAX_VIRT_HEIGHT), nFlags(IconChoiceFlags::NONE), nUserEventAdjustScrBars(nullptr), pCurHighlightFrame(nullptr), bHighlightFramePressed(false), pHead(nullptr), pCursor(nullptr), - pHdlEntry(nullptr), ePositionMode(SvxIconChoiceCtrlPositionMode::Free), bUpdateMode(true) { @@ -81,9 +79,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aAutoArrangeIdle.SetPriority( TaskPriority::HIGH_IDLE ); aAutoArrangeIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl)); - aCallSelectHdlIdle.SetPriority( TaskPriority::LOWEST ); - aCallSelectHdlIdle.SetInvokeHandler( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl)); - aDocRectChangedIdle.SetPriority( TaskPriority::HIGH_IDLE ); aDocRectChangedIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl)); @@ -256,21 +251,20 @@ void SvxIconChoiceCtrl_Impl::SelectEntry( SvxIconChoiceCtrlEntry* pEntry, bool b if( pEntry->IsSelected() == bSelect ) return; - pHdlEntry = pEntry; SvxIconViewFlags nEntryFlags = pEntry->GetFlags(); if( bSelect ) { nEntryFlags |= SvxIconViewFlags::SELECTED; pEntry->AssignFlags( nEntryFlags ); nSelectionCount++; - CallSelectHandler(); + pView->ClickIcon(); } else { nEntryFlags &= ~SvxIconViewFlags::SELECTED; pEntry->AssignFlags( nEntryFlags ); nSelectionCount--; - CallSelectHandler(); + pView->ClickIcon(); } EntrySelected( pEntry, bSelect ); } @@ -606,7 +600,6 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) { DeselectAllBut( pEntry ); SelectEntry( pEntry, true, false ); - pHdlEntry = pEntry; pView->ClickIcon(); } else @@ -664,13 +657,10 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonUp( const MouseEvent& rMEvt ) bHighlightFramePressed = false; SetEntryHighlightFrame( pEntry, true ); - pHdlEntry = pCurHighlightFrame; pView->ClickIcon(); // set focus on Icon - SetCursor_Impl(pHdlEntry); - - pHdlEntry = nullptr; + SetCursor_Impl(pCurHighlightFrame); } return bHandled; } @@ -2431,31 +2421,6 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn } } -void SvxIconChoiceCtrl_Impl::CallSelectHandler() -{ - // When single-click mode is active, the selection handler should be called - // synchronously, as the selection is automatically taken away once the - // mouse cursor doesn't touch the object any more. Else, we might run into - // missing calls to Select if the object is selected from a mouse movement, - // because when starting the timer, the mouse cursor might have already left - // the object. - if( nWinBits & WB_HIGHLIGHTFRAME ) - { - pHdlEntry = nullptr; - pView->ClickIcon(); - //pView->Select(); - } - else - aCallSelectHdlIdle.Start(); -} - -IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, CallSelectHdlHdl, Timer *, void) -{ - pHdlEntry = nullptr; - pView->ClickIcon(); - //pView->Select(); -} - void SvxIconChoiceCtrl_Impl::SetOrigin( const Point& rPos ) { MapMode aMapMode( pView->GetMapMode() ); -- cgit