1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-10 22:56:26 +01:00

Rename TrackPanel::HandleCursor as HandleMotion...

Call HitTest in just one place

Can now preserve repeatedly hit UIHandle objects during pre-click motion

Fields of HitTestResult besides the handle pointer are now unused

The need to repaint a track during mouse movement can be indicated when
constructing a UIHandle or when updating it for move; HitPreview no longer
does this

And the last allows simplifications of LabelTrack glyph highlighting

Also move the temporary state for label glyph dragging out of LabelTrack
This commit is contained in:
Paul Licameli
2017-06-17 21:37:41 -04:00
parent 2c1a16f593
commit f5b0afc2fc
10 changed files with 336 additions and 210 deletions

View File

@@ -18,6 +18,8 @@
#include "Experimental.h"
#include "HitTestResult.h"
#include "SelectedRegion.h"
#include "widgets/OverlayPanel.h"
@@ -373,8 +375,8 @@ protected:
};
FoundCell FindCell(int mouseX, int mouseY);
void HandleCursor( wxMouseState *pState );
void HandleCursor( const TrackPanelMouseState &tpmState );
void HandleMotion( wxMouseState *pState );
void HandleMotion( const TrackPanelMouseState &tpmState );
// If label, rectangle includes track control panel only.
// If !label, rectangle includes all of that, and the vertical ruler, and
@@ -528,6 +530,31 @@ protected:
wxSize vrulerSize;
protected:
std::weak_ptr<TrackPanelCell> mLastCell;
HitTestResult mLastHitTest{};
bool mLastHitTestValid{};
unsigned mMouseOverUpdateFlags{};
public:
HitTestResult *Target()
{
if ( mLastHitTestValid )
return &mLastHitTest;
else
return nullptr;
}
protected:
void ClearTargets()
{
// Forget the rotation of hit test candidates when the mouse moves from
// cell to cell or outside of the TrackPanel entirely.
mLastCell.reset();
mLastHitTestValid = false;
mLastHitTest = {};
mMouseOverUpdateFlags = 0;
}
std::weak_ptr<Track> mpClickedTrack;
UIHandlePtr mUIHandle;