mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-18 17:10:05 +02:00
... Rather, construct them during hit tests (also capturing more state sooner rather than at Click time, and adding some accessors for later use) This also fixes bug 1677 by other means and avoids similar problems. A cell may be implemented to re-use a previously hit handle object, not yet clicked, in a later hit test, by remembering a weak pointer, but TrackPanel holds the strong pointers that determine when the object is destroyed. And the objects will surely be destroyed after drag-release, or ESC key. For now they are also destroyed whenever not dragging, and hit-testing is re-invoked; that will be changed later, so that the re-use mentioned above becomes effective, but still they will be destroyed when the pointer moves from one cell to another.
39 lines
961 B
C++
39 lines
961 B
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
TrackPanelResizeHandle.cpp
|
|
|
|
Paul Licameli split from TrackPanel.cpp
|
|
|
|
**********************************************************************/
|
|
|
|
#include "Audacity.h"
|
|
#include "TrackPanelResizerCell.h"
|
|
|
|
#include "TrackPanelResizeHandle.h"
|
|
#include "TrackPanelMouseEvent.h"
|
|
#include "HitTestResult.h"
|
|
|
|
#include <wx/mousestate.h>
|
|
|
|
TrackPanelResizerCell::TrackPanelResizerCell( std::shared_ptr<Track> pTrack )
|
|
: mpTrack{ pTrack }
|
|
{}
|
|
|
|
HitTestResult TrackPanelResizerCell::HitTest
|
|
(const TrackPanelMouseState &st, const AudacityProject *pProject)
|
|
{
|
|
auto pTrack = mpTrack.lock();
|
|
if (pTrack) {
|
|
auto result = std::make_shared<TrackPanelResizeHandle>(
|
|
pTrack, st.state.m_y, pProject );
|
|
result = AssignUIHandlePtr(mResizeHandle, result);
|
|
return {
|
|
result->Preview(st, pProject),
|
|
result
|
|
};
|
|
}
|
|
return {};
|
|
}
|