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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user