1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Bug2244: need a distinct cursor for adjustment of split views...

... Adapted from the bandwidth adjustment cursor for spectral selection, with
reversal of white and black, so the new ones are white around black
This commit is contained in:
Paul Licameli 2019-12-30 13:07:32 -05:00
parent 28e19e3e03
commit 0c44d0f7d3
5 changed files with 90 additions and 3 deletions

View File

@ -32,6 +32,7 @@
#include "Cursors32/StretchLeftCursor.xpm"
#include "Cursors32/StretchRightCursor.xpm"
#endif
#include "Cursors32/SubViewsCursor.xpm"
#else
@ -52,6 +53,7 @@
#include "Cursors16/StretchLeftCursor.xpm"
#include "Cursors16/StretchRightCursor.xpm"
#endif
#include "Cursors16/SubViewsCursor.xpm"
#endif

View File

@ -0,0 +1,23 @@
/* XPM */
//Image of a pencil.
static const char * const SubViewsCursorXpm[] = {
"16 16 3 1",
". c #FF0000", // mask color = RGB:255,0,0
"# c #000000",
"+ c #FFFFFF",
"........+.......",
".......+#+......",
"......+###+.....",
"......+++++.....",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"................",
"......+++++.....",
"......+###+.....",
".......+#+......",
"........+.......",};

View File

@ -0,0 +1,38 @@
/* XPM */
static const char * const SubViewsCursorXpm[] = {
"32 32 3 1",
". c #FF0000", // mask color = RGB:255,0,0
"# c #000000",
"+ c #FFFFFF",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................+...............",
"...............+#+..............",
"..............+###+.............",
".............+#####+............",
"............+#######+...........",
"............+++++++++...........",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"............+++++++++...........",
"............+#######+...........",
".............+#####+............",
"..............+###+.............",
"...............+#+..............",
"................+...............",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................"};

View File

@ -228,7 +228,8 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_IMAGE( bmpBottomFrequencyCursor, wxImage( 32, 32 ), wxT("BottomFrequencyCursor"));
DEFINE_IMAGE( bmpTopFrequencyCursor, wxImage( 32, 32 ), wxT("TopFrequencyCursor"));
DEFINE_IMAGE( bmpBandWidthCursor, wxImage(32, 32), wxT("BandWidthCursor"));
DEFINE_IMAGE( bmpSubViewsCursor, wxImage(32, 32), wxT("SubViewsCursor"));
//SET_THEME_FLAGS( resFlagNewLine );
// DA: The logo with name xpm has a different width.

View File

@ -18,6 +18,9 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../WaveClip.h"
#include "../../../../WaveTrack.h"
#include "../../../../../images/Cursors.h"
#include "../../../../AllThemeResources.h"
#include "../../../../HitTestResult.h"
#include "../../../../ProjectHistory.h"
#include "../../../../RefreshCode.h"
@ -33,6 +36,25 @@ Paul Licameli split from TrackPanel.cpp
namespace {
/// Makes a cursor from an XPM, uses CursorId as a fallback.
/// TODO: Move this function to some other source file for reuse elsewhere.
std::unique_ptr<wxCursor> MakeCursor( int WXUNUSED(CursorId), const char * const pXpm[36], int HotX, int HotY )
{
#ifdef CURSORS_SIZE32
const int HotAdjust =0;
#else
const int HotAdjust =8;
#endif
wxImage Image = wxImage(wxBitmap(pXpm).ConvertToImage());
Image.SetMaskColour(255,0,0);
Image.SetMask();// Enable mask.
Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, HotX-HotAdjust );
Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, HotY-HotAdjust );
return std::make_unique<wxCursor>( Image );
}
using WaveTrackSubViewPtrs = std::vector< std::shared_ptr< WaveTrackSubView > >;
// Structure that collects and modifies information on sub-view positions
@ -321,10 +343,11 @@ public:
HitTestPreview Preview(
const TrackPanelMouseState &state, const AudacityProject * ) override
{
static wxCursor resizeCursor{ wxCURSOR_SIZENS };
static auto resizeCursor =
::MakeCursor(wxCURSOR_ARROW, SubViewsCursorXpm, 16, 16);
return {
XO("Click and drag to adjust sizes of sub-views."),
&resizeCursor
&*resizeCursor
};
}