mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 16:39:30 +02:00
MakeCursor returns smart pointer; TrackPanel stores smart pointers to cursors
This commit is contained in:
parent
414d0faa65
commit
def8b7fa9b
@ -57,4 +57,4 @@
|
||||
|
||||
#endif
|
||||
|
||||
wxCursor * MakeCursor(int WXUNUSED(CursorId), const char * pXpm[36], int HotX, int HotY);
|
||||
std::unique_ptr<wxCursor> MakeCursor(int WXUNUSED(CursorId), const char * pXpm[36], int HotX, int HotY);
|
||||
|
@ -418,10 +418,8 @@ END_EVENT_TABLE()
|
||||
|
||||
/// Makes a cursor from an XPM, uses CursorId as a fallback.
|
||||
/// TODO: Move this function to some other source file for reuse elsewhere.
|
||||
wxCursor * MakeCursor( int WXUNUSED(CursorId), const char * pXpm[36], int HotX, int HotY )
|
||||
std::unique_ptr<wxCursor> MakeCursor( int WXUNUSED(CursorId), const char * pXpm[36], int HotX, int HotY )
|
||||
{
|
||||
wxCursor * pCursor;
|
||||
|
||||
#ifdef CURSORS_SIZE32
|
||||
const int HotAdjust =0;
|
||||
#else
|
||||
@ -434,9 +432,7 @@ wxCursor * MakeCursor( int WXUNUSED(CursorId), const char * pXpm[36], int HotX,
|
||||
|
||||
Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, HotX-HotAdjust );
|
||||
Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, HotY-HotAdjust );
|
||||
pCursor = new wxCursor( Image );
|
||||
|
||||
return pCursor;
|
||||
return std::make_unique<wxCursor>( Image );
|
||||
}
|
||||
|
||||
|
||||
@ -523,12 +519,12 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
StretchRightCursorXpm, 16, 16);
|
||||
#endif
|
||||
|
||||
mArrowCursor = new wxCursor(wxCURSOR_ARROW);
|
||||
mSmoothCursor = new wxCursor(wxCURSOR_SPRAYCAN);
|
||||
mResizeCursor = new wxCursor(wxCURSOR_SIZENS);
|
||||
mRearrangeCursor = new wxCursor(wxCURSOR_HAND);
|
||||
mAdjustLeftSelectionCursor = new wxCursor(wxCURSOR_POINT_LEFT);
|
||||
mAdjustRightSelectionCursor = new wxCursor(wxCURSOR_POINT_RIGHT);
|
||||
mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
|
||||
mSmoothCursor = std::make_unique<wxCursor>(wxCURSOR_SPRAYCAN);
|
||||
mResizeCursor = std::make_unique<wxCursor>(wxCURSOR_SIZENS);
|
||||
mRearrangeCursor = std::make_unique<wxCursor>(wxCURSOR_HAND);
|
||||
mAdjustLeftSelectionCursor = std::make_unique<wxCursor>(wxCURSOR_POINT_LEFT);
|
||||
mAdjustRightSelectionCursor = std::make_unique<wxCursor>(wxCURSOR_POINT_RIGHT);
|
||||
|
||||
mWaveTrackMenu = NULL;
|
||||
mChannelItemsInsertionPoint = 0;
|
||||
@ -651,31 +647,6 @@ TrackPanel::~TrackPanel()
|
||||
}
|
||||
delete mTrackArtist;
|
||||
|
||||
delete mArrowCursor;
|
||||
delete mPencilCursor;
|
||||
delete mSelectCursor;
|
||||
delete mEnvelopeCursor;
|
||||
delete mDisabledCursor;
|
||||
delete mSlideCursor;
|
||||
delete mResizeCursor;
|
||||
delete mSmoothCursor;
|
||||
delete mZoomInCursor;
|
||||
delete mZoomOutCursor;
|
||||
delete mLabelCursorLeft;
|
||||
delete mLabelCursorRight;
|
||||
delete mRearrangeCursor;
|
||||
delete mAdjustLeftSelectionCursor;
|
||||
delete mAdjustRightSelectionCursor;
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
delete mBottomFrequencyCursor;
|
||||
delete mTopFrequencyCursor;
|
||||
delete mBandWidthCursor;
|
||||
#endif
|
||||
#if USE_MIDI
|
||||
delete mStretchCursor;
|
||||
delete mStretchLeftCursor;
|
||||
delete mStretchRightCursor;
|
||||
#endif
|
||||
|
||||
delete mSnapManager;
|
||||
|
||||
@ -1796,7 +1767,7 @@ void TrackPanel::HandleCenterFrequencyCursor
|
||||
|
||||
#endif
|
||||
|
||||
*ppCursor = mEnvelopeCursor;
|
||||
*ppCursor = mEnvelopeCursor.get();
|
||||
}
|
||||
|
||||
void TrackPanel::HandleCenterFrequencyClick
|
||||
@ -1832,7 +1803,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
|
||||
{
|
||||
// Do not set the default cursor here and re-set later, that causes
|
||||
// flashing.
|
||||
*ppCursor = mSelectCursor;
|
||||
*ppCursor = mSelectCursor.get();
|
||||
|
||||
//In Multi-tool mode, give multitool prompt if no-special-hit.
|
||||
if( bMultiToolMode ) {
|
||||
@ -1880,7 +1851,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
|
||||
isSpectralSelectionTrack(t)) {
|
||||
// Not shift-down, but center frequency snapping toggle is on
|
||||
tip = _("Click and drag to set frequency bandwidth.");
|
||||
*ppCursor = mEnvelopeCursor;
|
||||
*ppCursor = mEnvelopeCursor.get();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -1906,7 +1877,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
|
||||
case SBRight:
|
||||
if ( HitTestStretch(t, rect, event)) {
|
||||
tip = _("Click and drag to stretch within selected region.");
|
||||
*ppCursor = mStretchCursor;
|
||||
*ppCursor = mStretchCursor.get();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -1927,27 +1898,27 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
|
||||
break;
|
||||
case SBLeft:
|
||||
tip = _("Click and drag to move left selection boundary.");
|
||||
*ppCursor = mAdjustLeftSelectionCursor;
|
||||
*ppCursor = mAdjustLeftSelectionCursor.get();
|
||||
return;
|
||||
case SBRight:
|
||||
tip = _("Click and drag to move right selection boundary.");
|
||||
*ppCursor = mAdjustRightSelectionCursor;
|
||||
*ppCursor = mAdjustRightSelectionCursor.get();
|
||||
return;
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
case SBBottom:
|
||||
tip = _("Click and drag to move bottom selection frequency.");
|
||||
*ppCursor = mBottomFrequencyCursor;
|
||||
*ppCursor = mBottomFrequencyCursor.get();
|
||||
return;
|
||||
case SBTop:
|
||||
tip = _("Click and drag to move top selection frequency.");
|
||||
*ppCursor = mTopFrequencyCursor;
|
||||
*ppCursor = mTopFrequencyCursor.get();
|
||||
return;
|
||||
case SBCenter:
|
||||
HandleCenterFrequencyCursor(bShiftDown, tip, ppCursor);
|
||||
return;
|
||||
case SBWidth:
|
||||
tip = _("Click and drag to adjust frequency bandwidth.");
|
||||
*ppCursor = mBandWidthCursor;
|
||||
*ppCursor = mBandWidthCursor.get();
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
|
@ -819,31 +819,20 @@ protected:
|
||||
int mLogMaxScrubSpeed;
|
||||
#endif
|
||||
|
||||
wxCursor *mArrowCursor;
|
||||
wxCursor *mPencilCursor;
|
||||
wxCursor *mSelectCursor;
|
||||
wxCursor *mResizeCursor;
|
||||
wxCursor *mSlideCursor;
|
||||
wxCursor *mEnvelopeCursor; // doubles as the center frequency cursor
|
||||
std::unique_ptr<wxCursor>
|
||||
mArrowCursor, mPencilCursor, mSelectCursor,
|
||||
mResizeCursor, mSlideCursor, mEnvelopeCursor, // doubles as the center frequency cursor
|
||||
// for spectral selection
|
||||
wxCursor *mSmoothCursor;
|
||||
wxCursor *mZoomInCursor;
|
||||
wxCursor *mZoomOutCursor;
|
||||
wxCursor *mLabelCursorLeft;
|
||||
wxCursor *mLabelCursorRight;
|
||||
wxCursor *mRearrangeCursor;
|
||||
wxCursor *mDisabledCursor;
|
||||
wxCursor *mAdjustLeftSelectionCursor;
|
||||
wxCursor *mAdjustRightSelectionCursor;
|
||||
mSmoothCursor, mZoomInCursor, mZoomOutCursor,
|
||||
mLabelCursorLeft, mLabelCursorRight, mRearrangeCursor,
|
||||
mDisabledCursor, mAdjustLeftSelectionCursor, mAdjustRightSelectionCursor;
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
wxCursor *mBottomFrequencyCursor;
|
||||
wxCursor *mTopFrequencyCursor;
|
||||
wxCursor *mBandWidthCursor;
|
||||
std::unique_ptr<wxCursor>
|
||||
mBottomFrequencyCursor, mTopFrequencyCursor, mBandWidthCursor;
|
||||
#endif
|
||||
#if USE_MIDI
|
||||
wxCursor *mStretchCursor;
|
||||
wxCursor *mStretchLeftCursor;
|
||||
wxCursor *mStretchRightCursor;
|
||||
std::unique_ptr<wxCursor>
|
||||
mStretchCursor, mStretchLeftCursor, mStretchRightCursor;
|
||||
#endif
|
||||
|
||||
wxMenu *mWaveTrackMenu;
|
||||
|
Loading…
x
Reference in New Issue
Block a user