From a95838a3e8431572ff71288e9a35d15f81f003e5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 15 Jan 2020 21:55:24 -0500 Subject: [PATCH] Better cursors for sub-view rearrangement --- images/Cursors.h | 1 + images/Cursors32/RearrangingCursor.xpm | 38 +++++++++++++++++++ .../wavetrack/ui/WaveTrackView.cpp | 9 ++++- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 images/Cursors32/RearrangingCursor.xpm diff --git a/images/Cursors.h b/images/Cursors.h index 02f7f0b26..dc4b5f173 100644 --- a/images/Cursors.h +++ b/images/Cursors.h @@ -16,6 +16,7 @@ #include "Cursors32/DisabledCursor.xpm" #include "Cursors32/RearrangeCursor.xpm" +#include "Cursors32/RearrangingCursor.xpm" #include "Cursors32/EnvCursor.xpm" #include "Cursors32/TimeCursor.xpm" #include "Cursors32/IBeamCursor.xpm" diff --git a/images/Cursors32/RearrangingCursor.xpm b/images/Cursors32/RearrangingCursor.xpm new file mode 100644 index 000000000..7e04eee81 --- /dev/null +++ b/images/Cursors32/RearrangingCursor.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static const char * const RearrangingCursorXpm[] = { +"32 32 3 1", +" c #FF0000", // mask color = RGB:255,0,0 +". c #000000", +"+ c #FFFFFF", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" .. .. .. ", +" .++.++.++.. ", +" .++++++++++. ", +" ..++++++++++. ", +" .+.+++++++++++. ", +" .+.+++++++++++. ", +" .+++++++++++++. ", +" .+++++++++++++. ", +" .+++++++++++++. ", +" .+++++++++++++. ", +" .+++++++++++. ", +" .++++++++++. ", +" .++++++++. ", +" ..++++.. ", +" .... ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp index 89d393fea..8c82540fe 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackView.cpp @@ -488,6 +488,8 @@ public: return RefreshNone; } + bool Clicked() const { return !mHeights.empty(); } + enum DragChoice_t{ Upward, Downward, Neutral }; DragChoice_t DragChoice( const TrackPanelMouseEvent &event ) const @@ -561,10 +563,13 @@ public: HitTestPreview Preview( const TrackPanelMouseState &state, AudacityProject * ) override { - static wxCursor cursor{ wxCURSOR_HAND }; + static auto hoverCursor = + ::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16); + static auto clickedCursor = + ::MakeCursor(wxCURSOR_HAND, RearrangingCursorXpm, 16, 16); return { XO("Click and drag to rearrange sub-views"), - &cursor + Clicked() ? &*clickedCursor : &*hoverCursor }; }