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

Spectral selection cursor and mode selection changes from Paul Licameli.

This also now shows a new green 'play cursor' when ctrl is held down on wave track, and shift being held down is signalled by a cursor change to finger-pointer too.

I also accidentally enabled EXPERIMENTAL_MIDI_OUT.  We may disable that in December for release.  Leaving it in for now.
This commit is contained in:
james.k.crook@gmail.com 2014-11-08 14:30:19 +00:00
parent a4b3ece538
commit 6112a2a8c1
6 changed files with 173 additions and 56 deletions

View File

@ -26,6 +26,10 @@
#include "Cursors32/ZoomOutCursor.xpm" #include "Cursors32/ZoomOutCursor.xpm"
#include "Cursors32/LabelCursorLeft.xpm" #include "Cursors32/LabelCursorLeft.xpm"
#include "Cursors32/LabelCursorRight.xpm" #include "Cursors32/LabelCursorRight.xpm"
#include "Cursors32/BottomFrequencyCursor.xpm"
#include "Cursors32/TopFrequencyCursor.xpm"
#include "Cursors32/BandWidthCursor.xpm"
#include "Cursors32/PlaybackCursor.xpm"
#ifdef USE_MIDI #ifdef USE_MIDI
#include "Cursors32/StretchCursor.xpm" #include "Cursors32/StretchCursor.xpm"
#include "Cursors32/StretchLeftCursor.xpm" #include "Cursors32/StretchLeftCursor.xpm"
@ -43,6 +47,10 @@
#include "Cursors16/ZoomOutCursor.xpm" #include "Cursors16/ZoomOutCursor.xpm"
#include "Cursors16/LabelCursorLeft.xpm" #include "Cursors16/LabelCursorLeft.xpm"
#include "Cursors16/LabelCursorRight.xpm" #include "Cursors16/LabelCursorRight.xpm"
#include "Cursors16/BottomFrequencyCursor.xpm"
#include "Cursors16/TopFrequencyCursor.xpm"
#include "Cursors16/BandWidthCursor.xpm"
#include "Cursors16/PlaybackCursor.xpm"
#ifdef USE_MIDI #ifdef USE_MIDI
#include "Cursors16/StretchCursor.xpm" #include "Cursors16/StretchCursor.xpm"
#include "Cursors16/StretchLeftCursor.xpm" #include "Cursors16/StretchLeftCursor.xpm"

View File

@ -107,6 +107,7 @@ int SCRIPT_PIPE_DLL_API RegScriptServerFunc( tpExecScriptServerFunc pFn )
pScriptServerFn = pFn; pScriptServerFn = pFn;
PipeServer(); PipeServer();
} }
return 4; return 4;
} }

View File

@ -102,6 +102,10 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_IMAGE( bmpLabelCursorLeft, wxImage( 32, 32 ), wxT("LabelCursorLeft")); DEFINE_IMAGE( bmpLabelCursorLeft, wxImage( 32, 32 ), wxT("LabelCursorLeft"));
DEFINE_IMAGE( bmpLabelCursorRight, wxImage( 32, 32 ), wxT("LabelCursorRight")); DEFINE_IMAGE( bmpLabelCursorRight, wxImage( 32, 32 ), wxT("LabelCursorRight"));
DEFINE_IMAGE( bmpDisabledCursor, wxImage( 32, 32 ), wxT("DisabledCursor")); DEFINE_IMAGE( bmpDisabledCursor, wxImage( 32, 32 ), wxT("DisabledCursor"));
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( bmpPlaybackCursor, wxImage(32, 32), wxT("PlaybackCursor"));
SET_THEME_FLAGS( resFlagNone ); SET_THEME_FLAGS( resFlagNone );
DEFINE_IMAGE( bmpIBeam, wxImage( 27, 27 ), wxT("IBeam")); DEFINE_IMAGE( bmpIBeam, wxImage( 27, 27 ), wxT("IBeam"));

View File

@ -113,7 +113,7 @@
// Enables MIDI Output of NoteTrack (MIDI) data during playback // Enables MIDI Output of NoteTrack (MIDI) data during playback
// USE_MIDI must be defined in order for EXPERIMENTAL_MIDI_OUT to work // USE_MIDI must be defined in order for EXPERIMENTAL_MIDI_OUT to work
#ifdef USE_MIDI #ifdef USE_MIDI
//#define EXPERIMENTAL_MIDI_OUT #define EXPERIMENTAL_MIDI_OUT
#endif #endif
// USE_MIDI must be defined in order for EXPERIMENTAL_SCOREALIGN to work // USE_MIDI must be defined in order for EXPERIMENTAL_SCOREALIGN to work

View File

@ -165,6 +165,7 @@ is time to refresh some aspect of the screen.
#include <stdlib.h> #include <stdlib.h>
//#define DEBUG_DRAW_TIMING 1 //#define DEBUG_DRAW_TIMING 1
// #define SPECTRAL_EDITING_ESC_KEY
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/dcclient.h> #include <wx/dcclient.h>
@ -495,6 +496,17 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mZoomOutCursor = MakeCursor( wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15); mZoomOutCursor = MakeCursor( wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
mLabelCursorLeft = MakeCursor( wxCURSOR_ARROW, LabelCursorLeftXpm, 19, 15); mLabelCursorLeft = MakeCursor( wxCURSOR_ARROW, LabelCursorLeftXpm, 19, 15);
mLabelCursorRight = MakeCursor( wxCURSOR_ARROW, LabelCursorRightXpm, 16, 16); mLabelCursorRight = MakeCursor( wxCURSOR_ARROW, LabelCursorRightXpm, 16, 16);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
mBottomFrequencyCursor =
MakeCursor( wxCURSOR_ARROW, BottomFrequencyCursorXpm, 16, 16);
mTopFrequencyCursor =
MakeCursor( wxCURSOR_ARROW, TopFrequencyCursorXpm, 16, 16);
mBandWidthCursor = MakeCursor( wxCURSOR_ARROW, BandWidthCursorXpm, 16, 16);
#endif
mPlaybackCursor = MakeCursor(wxCURSOR_ARROW, PlaybackCursorXpm, 8, 16);
#if USE_MIDI #if USE_MIDI
mStretchMode = stretchCenter; mStretchMode = stretchCenter;
mStretching = false; mStretching = false;
@ -612,6 +624,12 @@ TrackPanel::~TrackPanel()
delete mRearrangeCursor; delete mRearrangeCursor;
delete mAdjustLeftSelectionCursor; delete mAdjustLeftSelectionCursor;
delete mAdjustRightSelectionCursor; delete mAdjustRightSelectionCursor;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
delete mBottomFrequencyCursor;
delete mTopFrequencyCursor;
delete mBandWidthCursor;
#endif
delete mPlaybackCursor;
#if USE_MIDI #if USE_MIDI
delete mStretchCursor; delete mStretchCursor;
delete mStretchLeftCursor; delete mStretchLeftCursor;
@ -656,7 +674,7 @@ void TrackPanel::BuildMenus(void)
/* build the pop-down menu used on wave (sampled audio) tracks */ /* build the pop-down menu used on wave (sampled audio) tracks */
mWaveTrackMenu = new wxMenu(); mWaveTrackMenu = new wxMenu();
BuildCommonDropMenuItems(mWaveTrackMenu); // does name, up/down etc BuildCommonDropMenuItems(mWaveTrackMenu); // does name, up/down etc
mWaveTrackMenu->Append(OnWaveformID, _("Wa&veform")); mWaveTrackMenu->Append(OnWaveformID, _("Wa&veform"));
mWaveTrackMenu->Append(OnWaveformDBID, _("&Waveform (dB)")); mWaveTrackMenu->Append(OnWaveformDBID, _("&Waveform (dB)"));
mWaveTrackMenu->Append(OnSpectrumID, _("&Spectrogram")); mWaveTrackMenu->Append(OnSpectrumID, _("&Spectrogram"));
@ -678,18 +696,18 @@ void TrackPanel::BuildMenus(void)
/* build the pop-down menu used on note (MIDI) tracks */ /* build the pop-down menu used on note (MIDI) tracks */
mNoteTrackMenu = new wxMenu(); mNoteTrackMenu = new wxMenu();
BuildCommonDropMenuItems(mNoteTrackMenu); // does name, up/down etc BuildCommonDropMenuItems(mNoteTrackMenu); // does name, up/down etc
mNoteTrackMenu->Append(OnUpOctaveID, _("Up &Octave")); mNoteTrackMenu->Append(OnUpOctaveID, _("Up &Octave"));
mNoteTrackMenu->Append(OnDownOctaveID, _("Down Octa&ve")); mNoteTrackMenu->Append(OnDownOctaveID, _("Down Octa&ve"));
/* build the pop-down menu used on label tracks */ /* build the pop-down menu used on label tracks */
mLabelTrackMenu = new wxMenu(); mLabelTrackMenu = new wxMenu();
BuildCommonDropMenuItems(mLabelTrackMenu); // does name, up/down etc BuildCommonDropMenuItems(mLabelTrackMenu); // does name, up/down etc
mLabelTrackMenu->Append(OnSetFontID, _("&Font...")); mLabelTrackMenu->Append(OnSetFontID, _("&Font..."));
/* build the pop-down menu used on time warping tracks */ /* build the pop-down menu used on time warping tracks */
mTimeTrackMenu = new wxMenu(); mTimeTrackMenu = new wxMenu();
BuildCommonDropMenuItems(mTimeTrackMenu); // does name, up/down etc BuildCommonDropMenuItems(mTimeTrackMenu); // does name, up/down etc
mTimeTrackMenu->Append(OnTimeTrackLinID, _("&Linear")); mTimeTrackMenu->Append(OnTimeTrackLinID, _("&Linear"));
mTimeTrackMenu->Append(OnTimeTrackLogID, _("L&ogarithmic")); mTimeTrackMenu->Append(OnTimeTrackLogID, _("L&ogarithmic"));
mTimeTrackMenu->AppendSeparator(); mTimeTrackMenu->AppendSeparator();
@ -1641,13 +1659,61 @@ void TrackPanel::MaySetOnDemandTip( Track * t, const wxChar ** ppTip )
return; return;
} }
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
void TrackPanel::HandleCenterFrequencyCursor
(bool shiftDown, const wxChar ** ppTip, const wxCursor ** ppCursor)
{
#ifndef SPECTRAL_EDITING_ESC_KEY
*ppTip =
shiftDown ?
_("Click and drag to move center selection frequency.") :
_("Click and drag to move center selection frequency to a spectral peak.");
#else
shiftDown;
*ppTip =
_("Click and drag to move center selection frequency.");
#endif
*ppCursor = mEnvelopeCursor;
}
void TrackPanel::HandleCenterFrequencyClick
(bool shiftDown, Track *pTrack, double value)
{
if (shiftDown) {
// Disable time selection
mSelStart = -1;
mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
mFreqSelPin = value;
mFreqSelMode = FREQ_SEL_DRAG_CENTER;
}
else {
#ifndef SPECTRAL_EDITING_ESC_KEY
// Start center snapping
WaveTrack *wt = static_cast<WaveTrack*>(pTrack);
// Turn center snapping on (the only way to do this)
mFreqSelMode = FREQ_SEL_SNAPPING_CENTER;
// Disable time selection
mSelStart = -1;
StartSnappingFreqSelection(wt);
#endif
}
}
#endif
// The select tool can have different cursors and prompts depending on what // The select tool can have different cursors and prompts depending on what
// we hover over, most notably when hovering over the selction boundaries. // we hover over, most notably when hovering over the selction boundaries.
// Determine and set the cursor and tip accordingly. // Determine and set the cursor and tip accordingly.
void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t, void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
wxMouseEvent & event, wxRect &r, bool bMultiToolMode, const wxChar ** ppTip ) wxMouseEvent & event, wxRect &r, bool bMultiToolMode,
const wxChar ** ppTip, const wxCursor ** ppCursor )
{ {
SetCursor(*mSelectCursor); // Do not set the default cursor here and re-set later, that causes
// flashing.
*ppCursor = mSelectCursor;
//In Multi-tool mode, give multitool prompt if no-special-hit. //In Multi-tool mode, give multitool prompt if no-special-hit.
if( bMultiToolMode ) { if( bMultiToolMode ) {
@ -1694,18 +1760,18 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
) { ) {
*ppTip = _("Click to start or resume playback at the chosen time."); *ppTip = _("Click to start or resume playback at the chosen time.");
// cursor? // cursor?
*ppCursor = mPlaybackCursor;
return; return;
} }
#endif #endif
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
bool logF; bool logF;
if ( !bShiftDown && if ( (mFreqSelMode == FREQ_SEL_SNAPPING_CENTER) &&
(mFreqSelMode == FREQ_SEL_SNAPPING_CENTER) &&
isSpectrogramTrack(t, &logF) ) { isSpectrogramTrack(t, &logF) ) {
// Not shift-down, but center frequency snapping toggle is on // Not shift-down, but center frequency snapping toggle is on
*ppTip = _("Click and drag to set frequency band width."); *ppTip = _("Click and drag to set frequency bandwidth.");
// need new distinct cursor? *ppCursor = mEnvelopeCursor;
return; return;
} }
#endif #endif
@ -1724,7 +1790,7 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
case SBRight: case SBRight:
if ( HitTestStretch(t, r, event)) { if ( HitTestStretch(t, r, event)) {
*ppTip = _("Click and drag to stretch within selected region."); *ppTip = _("Click and drag to stretch within selected region.");
SetCursor(*mStretchCursor); *ppCursor = mStretchCursor;
return; return;
} }
break; break;
@ -1745,32 +1811,33 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
break; break;
case SBLeft: case SBLeft:
*ppTip = _("Click and drag to move left selection boundary."); *ppTip = _("Click and drag to move left selection boundary.");
SetCursor(*mAdjustLeftSelectionCursor); *ppCursor = mAdjustLeftSelectionCursor;
return; return;
case SBRight: case SBRight:
*ppTip = _("Click and drag to move right selection boundary."); *ppTip = _("Click and drag to move right selection boundary.");
SetCursor(*mAdjustRightSelectionCursor); *ppCursor = mAdjustRightSelectionCursor;
return; return;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
case SBBottom: case SBBottom:
*ppTip = bShiftDown ? *ppTip = bShiftDown ?
_("Click and drag to move bottom selection frequency.") : _("Click and drag to move bottom selection frequency.") :
_("Click and drag to adjust frequency band width."); _("Click and drag to adjust frequency bandwidth.");
SetCursor(*mEnvelopeCursor); // For want of a better... *ppCursor = bShiftDown
? mBottomFrequencyCursor
: mBandWidthCursor;
return; return;
case SBTop: case SBTop:
// With Shift NOT down, this is no different from dragging // With Shift NOT down, this is no different from dragging
// the bottom. // the bottom.
*ppTip = bShiftDown ? *ppTip = bShiftDown ?
_("Click and drag to move top selection frequency.") : _("Click and drag to move top selection frequency.") :
_("Click and drag to adjust frequency band width."); _("Click and drag to adjust frequency bandwidth.");
SetCursor(*mEnvelopeCursor); // For want of a better... *ppCursor = bShiftDown
? mTopFrequencyCursor
: mBandWidthCursor;
return; return;
case SBCenter: case SBCenter:
// Don't need to assert, can just ignore shift down HandleCenterFrequencyCursor(bShiftDown, ppTip, ppCursor);
// wxASSERT( !bShiftDown );
*ppTip = _("Click and drag to move center selection frequency.");
SetCursor(*mEnvelopeCursor); // For want of a better...
return; return;
#endif #endif
default: default:
@ -1892,7 +1959,12 @@ void TrackPanel::HandleCursor(wxMouseEvent & event)
else else
{ {
bool bMultiToolMode = ttb->IsDown(multiTool); bool bMultiToolMode = ttb->IsDown(multiTool);
SetCursorAndTipWhenSelectTool( t, event, r, bMultiToolMode, &tip ); const wxCursor *pSelection = 0;
SetCursorAndTipWhenSelectTool
( t, event, r, bMultiToolMode, &tip, &pSelection );
if (pSelection)
// Set cursor once only here, to avoid flashing during drags
SetCursor(*pSelection);
} }
} }
@ -1980,10 +2052,12 @@ void TrackPanel::HandleSelect(wxMouseEvent & event)
MakeParentModifyState(false); MakeParentModifyState(false);
} }
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
#ifdef SPECTRAL_EDITING_ESC_KEY
else if (!event.IsButton() && else if (!event.IsButton() &&
mFreqSelMode == FREQ_SEL_SNAPPING_CENTER && mFreqSelMode == FREQ_SEL_SNAPPING_CENTER &&
!mViewInfo->selectedRegion.isPoint()) !mViewInfo->selectedRegion.isPoint())
MoveSnappingFreqSelection(event.m_y, r.y, r.height, t); MoveSnappingFreqSelection(event.m_y, r.y, r.height, t);
#endif
#endif #endif
done: done:
SelectionHandleDrag(event, t); SelectionHandleDrag(event, t);
@ -2092,6 +2166,9 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
ExtendFreqSelection(event.m_y, r.y, r.height); ExtendFreqSelection(event.m_y, r.y, r.height);
break; break;
} }
case SBCenter:
HandleCenterFrequencyClick(true, pTrack, value);
break;
#endif #endif
default: default:
wxASSERT(false); wxASSERT(false);
@ -2194,14 +2271,16 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
case SBBottom: case SBBottom:
case SBTop: case SBTop:
case SBCenter:
startNewSelection = false; startNewSelection = false;
// Disable time selection // Disable time selection
mSelStart = -1; mSelStart = -1;
mFreqSelTrack = static_cast<WaveTrack*>(pTrack); mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
mFreqSelPin = value; mFreqSelPin = value;
mFreqSelMode = (boundary == SBCenter) mFreqSelMode = FREQ_SEL_PINNED_CENTER;
? FREQ_SEL_DRAG_CENTER : FREQ_SEL_PINNED_CENTER; break;
case SBCenter:
HandleCenterFrequencyClick(false, pTrack, value);
startNewSelection = false;
break; break;
#endif #endif
default: default:
@ -2499,7 +2578,7 @@ void TrackPanel::MoveSnappingFreqSelection (int mouseYCoordinate,
isSpectrogramTrack(pTrack, &logF)) { isSpectrogramTrack(pTrack, &logF)) {
WaveTrack *const wt = static_cast<WaveTrack*>(pTrack); WaveTrack *const wt = static_cast<WaveTrack*>(pTrack);
// PRL: // PRL:
// What happens if ESC then move began in one spectrogram track, // What happens if center snapping selection began in one spectrogram track,
// then continues inside another? We do not then recalculate // then continues inside another? We do not then recalculate
// the spectrum (as was done in StartSnappingFreqSelection) // the spectrum (as was done in StartSnappingFreqSelection)
// but snap according to the peaks in the old track. // but snap according to the peaks in the old track.
@ -2889,6 +2968,12 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack)
#endif #endif
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
#ifndef SPECTRAL_EDITING_ESC_KEY
if (mFreqSelMode == FREQ_SEL_SNAPPING_CENTER &&
!mViewInfo->selectedRegion.isPoint())
MoveSnappingFreqSelection(y, r.y, r.height, pTrack);
else
#endif
if (mFreqSelTrack == pTrack) if (mFreqSelTrack == pTrack)
ExtendFreqSelection(y, r.y, r.height); ExtendFreqSelection(y, r.y, r.height);
#endif #endif
@ -3008,7 +3093,7 @@ void SetIfNotNull( double * pValue, const double Value )
TrackPanel::SelectionBoundary TrackPanel::ChooseBoundary TrackPanel::SelectionBoundary TrackPanel::ChooseBoundary
(wxMouseEvent & event, const Track *pTrack, const wxRect &rect, (wxMouseEvent & event, const Track *pTrack, const wxRect &rect,
bool mayChooseCenter, bool onlyWithinSnapDistance, bool mayDragWidth, bool onlyWithinSnapDistance,
double *pPinValue) const double *pPinValue) const
{ {
// Choose one of four boundaries to adjust, or the center frequency. // Choose one of four boundaries to adjust, or the center frequency.
@ -3022,7 +3107,7 @@ TrackPanel::SelectionBoundary TrackPanel::ChooseBoundary
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
const double f0 = mViewInfo->selectedRegion.f0(); const double f0 = mViewInfo->selectedRegion.f0();
const double f1 = mViewInfo->selectedRegion.f1(); const double f1 = mViewInfo->selectedRegion.f1();
double fc = SelectedRegion::UndefinedFrequency; const double fc = mViewInfo->selectedRegion.fc();
double ratio = 0; double ratio = 0;
#endif #endif
wxInt64 pixelDist = mViewInfo->zoom * fabs(selend - t0); wxInt64 pixelDist = mViewInfo->zoom * fabs(selend - t0);
@ -3055,24 +3140,25 @@ TrackPanel::SelectionBoundary TrackPanel::ChooseBoundary
const wxInt64 topDist = abs(int(event.m_y - topSel)); const wxInt64 topDist = abs(int(event.m_y - topSel));
if (topDist < verticalDist) if (topDist < verticalDist)
chooseBottom = false, verticalDist = topDist; chooseBottom = false, verticalDist = topDist;
if (mayChooseCenter) { if (fc > 0
fc = mViewInfo->selectedRegion.fc(); #ifdef SPECTRAL_EDITING_ESC_KEY
if (fc > 0) { && mayDragWidth
const wxInt64 centerSel = #endif
FrequencyToPosition(fc, rect.y, rect.height, ) {
wt->GetRate(), logF); const wxInt64 centerSel =
const wxInt64 centerDist = abs(int(event.m_y - centerSel)); FrequencyToPosition(fc, rect.y, rect.height,
if (centerDist < verticalDist) wt->GetRate(), logF);
chooseCenter = true, verticalDist = centerDist, const wxInt64 centerDist = abs(int(event.m_y - centerSel));
ratio = f1 / fc; if (centerDist < verticalDist)
} chooseCenter = true, verticalDist = centerDist,
ratio = f1 / fc;
} }
if (verticalDist >= 0 && if (verticalDist >= 0 &&
verticalDist < pixelDist && verticalDist < pixelDist &&
// If center choice is possible, do not choose any frequency, // If dragging width is possible, do not choose any frequency,
// unless center is defined (i.e. top and bottom are both // unless center is defined (i.e. top and bottom are both
// defined). // defined).
(!mayChooseCenter || fc > 0)) { (!mayDragWidth || fc > 0)) {
pixelDist = verticalDist; pixelDist = verticalDist;
chooseTime = false; chooseTime = false;
} }
@ -3093,11 +3179,11 @@ TrackPanel::SelectionBoundary TrackPanel::ChooseBoundary
return SBCenter; return SBCenter;
} }
else if (chooseBottom) { else if (chooseBottom) {
SetIfNotNull( pPinValue, mayChooseCenter ? fc : f1 ); SetIfNotNull( pPinValue, mayDragWidth ? fc : f1 );
return SBBottom; return SBBottom;
} }
else { else {
SetIfNotNull( pPinValue, mayChooseCenter ? fc : f0 ); SetIfNotNull(pPinValue, mayDragWidth ? fc : f0);
return SBTop; return SBTop;
} }
} }
@ -4156,10 +4242,10 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
// zoom out. // zoom out.
if(spectrum) { if(spectrum) {
if (event.ShiftDown() && event.RightUp()) { if (event.ShiftDown() && event.RightUp()) {
// Zoom out full // Zoom out full
min = 0.0; min = 0.0;
max = rate/2.; max = rate/2.;
} }
else { else {
// Zoom out // Zoom out
c = 0.5*(min+max); c = 0.5*(min+max);
@ -4196,10 +4282,10 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
} }
else { else {
if (event.ShiftDown() && event.RightUp()) { if (event.ShiftDown() && event.RightUp()) {
// Zoom out full // Zoom out full
min = -1.0; min = -1.0;
max = 1.0; max = 1.0;
} }
else { else {
// Zoom out // Zoom out
if (min <= -1.0 && max >= 1.0) { if (min <= -1.0 && max >= 1.0) {
@ -5682,10 +5768,11 @@ void TrackPanel::OnKeyDown(wxKeyEvent & event)
Track *t = GetFocusedTrack(); Track *t = GetFocusedTrack();
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
#ifdef SPECTRAL_EDITING_ESC_KEY
// Test for pinning and unpinning of the center frequency // Test for pinning and unpinning of the center frequency
bool logF; bool logF;
if (mAdjustSelectionEdges && if (mAdjustSelectionEdges &&
event.GetKeyCode() == WXK_ESCAPE){ event.GetKeyCode() == WXK_ESCAPE) {
if (mFreqSelMode == FREQ_SEL_SNAPPING_CENTER) { if (mFreqSelMode == FREQ_SEL_SNAPPING_CENTER) {
// Toggle center snapping off // Toggle center snapping off
// (left click can also turn it off) // (left click can also turn it off)
@ -5726,6 +5813,7 @@ void TrackPanel::OnKeyDown(wxKeyEvent & event)
// And don't skip event, yet // And don't skip event, yet
} }
} }
#endif
#endif #endif
// Only deal with LabelTracks // Only deal with LabelTracks

View File

@ -341,7 +341,8 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
virtual void SetCursorAndTipWhenInLabel( Track * t, wxMouseEvent &event, const wxChar ** ppTip ); virtual void SetCursorAndTipWhenInLabel( Track * t, wxMouseEvent &event, const wxChar ** ppTip );
virtual void SetCursorAndTipWhenInVResizeArea( Track * label, bool blinked, const wxChar ** ppTip ); virtual void SetCursorAndTipWhenInVResizeArea( Track * label, bool blinked, const wxChar ** ppTip );
virtual void SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, wxMouseEvent & event, const wxChar ** ppTip ); virtual void SetCursorAndTipWhenInLabelTrack( LabelTrack * pLT, wxMouseEvent & event, const wxChar ** ppTip );
virtual void SetCursorAndTipWhenSelectTool( Track * t, wxMouseEvent & event, wxRect &r, bool bMultiToolMode, const wxChar ** ppTip ); virtual void SetCursorAndTipWhenSelectTool
( Track * t, wxMouseEvent & event, wxRect &r, bool bMultiToolMode, const wxChar ** ppTip, const wxCursor ** ppCursor );
virtual void SetCursorAndTipByTool( int tool, wxMouseEvent & event, const wxChar **ppTip ); virtual void SetCursorAndTipByTool( int tool, wxMouseEvent & event, const wxChar **ppTip );
virtual void HandleCursor(wxMouseEvent & event); virtual void HandleCursor(wxMouseEvent & event);
virtual void MaySetOnDemandTip( Track * t, const wxChar ** ppTip ); virtual void MaySetOnDemandTip( Track * t, const wxChar ** ppTip );
@ -643,6 +644,14 @@ protected:
sampleCount mDrawingLastDragSample; // sample of last drag-over sampleCount mDrawingLastDragSample; // sample of last drag-over
float mDrawingLastDragSampleValue; // value of last drag-over float mDrawingLastDragSampleValue; // value of last drag-over
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
void HandleCenterFrequencyCursor
(bool shiftDown, const wxChar ** ppTip, const wxCursor ** ppCursor);
void HandleCenterFrequencyClick
(bool shiftDown, Track *pTrack, double value);
#endif
double PositionToTime(wxInt64 mouseXCoordinate, double PositionToTime(wxInt64 mouseXCoordinate,
wxInt64 trackLeftEdge) const; wxInt64 trackLeftEdge) const;
wxInt64 TimeToPosition(double time, wxInt64 TimeToPosition(double time,
@ -672,7 +681,7 @@ protected:
SelectionBoundary ChooseBoundary SelectionBoundary ChooseBoundary
(wxMouseEvent & event, const Track *pTrack, (wxMouseEvent & event, const Track *pTrack,
const wxRect &rect, const wxRect &rect,
bool mayChooseCenter, bool mayDragWidth,
bool onlyWithinSnapDistance, bool onlyWithinSnapDistance,
double *pPinValue = NULL) const; double *pPinValue = NULL) const;
@ -725,7 +734,8 @@ protected:
wxCursor *mSelectCursor; wxCursor *mSelectCursor;
wxCursor *mResizeCursor; wxCursor *mResizeCursor;
wxCursor *mSlideCursor; wxCursor *mSlideCursor;
wxCursor *mEnvelopeCursor; wxCursor *mEnvelopeCursor; // doubles as the center frequency cursor
// for spectral selection
wxCursor *mSmoothCursor; wxCursor *mSmoothCursor;
wxCursor *mZoomInCursor; wxCursor *mZoomInCursor;
wxCursor *mZoomOutCursor; wxCursor *mZoomOutCursor;
@ -735,6 +745,12 @@ protected:
wxCursor *mDisabledCursor; wxCursor *mDisabledCursor;
wxCursor *mAdjustLeftSelectionCursor; wxCursor *mAdjustLeftSelectionCursor;
wxCursor *mAdjustRightSelectionCursor; wxCursor *mAdjustRightSelectionCursor;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
wxCursor *mBottomFrequencyCursor;
wxCursor *mTopFrequencyCursor;
wxCursor *mBandWidthCursor;
#endif
wxCursor *mPlaybackCursor;
#if USE_MIDI #if USE_MIDI
wxCursor *mStretchCursor; wxCursor *mStretchCursor;
wxCursor *mStretchLeftCursor; wxCursor *mStretchLeftCursor;