mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-07 23:32:53 +02:00
Toolbar related changes, and 6 files freed from big s.c.c. leaving 64
This commit is contained in:
commit
ee32c77f81
@ -570,7 +570,8 @@ public:
|
|||||||
static std::shared_ptr<PlayheadHandle>
|
static std::shared_ptr<PlayheadHandle>
|
||||||
HitTest( const AudacityProject *pProject, wxCoord xx )
|
HitTest( const AudacityProject *pProject, wxCoord xx )
|
||||||
{
|
{
|
||||||
if( ControlToolBar::IsTransportingPinned() &&
|
if( ControlToolBar::Get( *pProject )
|
||||||
|
.IsTransportingPinned() &&
|
||||||
ProjectAudioIO::Get( *pProject ).IsAudioActive() )
|
ProjectAudioIO::Get( *pProject ).IsAudioActive() )
|
||||||
{
|
{
|
||||||
const auto targetX = GetPlayHeadX( pProject );
|
const auto targetX = GetPlayHeadX( pProject );
|
||||||
@ -1671,7 +1672,7 @@ void AdornedRulerPanel::UpdateButtonStates()
|
|||||||
auto common = [this]
|
auto common = [this]
|
||||||
(AButton &button, const CommandID &commandName, const wxString &label) {
|
(AButton &button, const CommandID &commandName, const wxString &label) {
|
||||||
TranslatedInternalString command{ commandName, label };
|
TranslatedInternalString command{ commandName, label };
|
||||||
ToolBar::SetButtonToolTip( button, &command, 1u );
|
ToolBar::SetButtonToolTip( *mProject, button, &command, 1u );
|
||||||
button.SetLabel(button.GetToolTipText());
|
button.SetLabel(button.GetToolTipText());
|
||||||
|
|
||||||
button.UpdateStatus();
|
button.UpdateStatus();
|
||||||
@ -2068,7 +2069,7 @@ void AdornedRulerPanel::DoDrawIndicator
|
|||||||
dc->DrawPolygon( 3, tri );
|
dc->DrawPolygon( 3, tri );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bool pinned = ControlToolBar::IsTransportingPinned();
|
bool pinned = ControlToolBar::Get( *mProject ).IsTransportingPinned();
|
||||||
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
||||||
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
||||||
(playing ? bmpPlayPointer : bmpRecordPointer)
|
(playing ? bmpPlayPointer : bmpRecordPointer)
|
||||||
|
@ -26,8 +26,6 @@ Paul Licameli split from AudacityProject.cpp
|
|||||||
#include "prefs/ThemePrefs.h"
|
#include "prefs/ThemePrefs.h"
|
||||||
#include "prefs/TracksPrefs.h"
|
#include "prefs/TracksPrefs.h"
|
||||||
#include "toolbars/ControlToolBar.h"
|
#include "toolbars/ControlToolBar.h"
|
||||||
#include "toolbars/SelectionBar.h"
|
|
||||||
#include "toolbars/SpectralSelectionBar.h"
|
|
||||||
#include "toolbars/ToolManager.h"
|
#include "toolbars/ToolManager.h"
|
||||||
#include "tracks/ui/Scrubbing.h"
|
#include "tracks/ui/Scrubbing.h"
|
||||||
#include "widgets/wxPanelWrapper.h"
|
#include "widgets/wxPanelWrapper.h"
|
||||||
@ -1696,7 +1694,6 @@ void ProjectWindow::TP_DisplaySelection()
|
|||||||
auto &ruler = AdornedRulerPanel::Get(project);
|
auto &ruler = AdornedRulerPanel::Get(project);
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||||
double audioTime;
|
|
||||||
auto &playRegion = ViewInfo::Get( project ).playRegion;
|
auto &playRegion = ViewInfo::Get( project ).playRegion;
|
||||||
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
@ -1705,18 +1702,6 @@ void ProjectWindow::TP_DisplaySelection()
|
|||||||
else
|
else
|
||||||
// Cause ruler redraw anyway, because we may be zooming or scrolling
|
// Cause ruler redraw anyway, because we may be zooming or scrolling
|
||||||
ruler.Refresh();
|
ruler.Refresh();
|
||||||
|
|
||||||
if (gAudioIO->IsBusy())
|
|
||||||
audioTime = gAudioIO->GetStreamTime();
|
|
||||||
else
|
|
||||||
audioTime = playRegion.GetStart();
|
|
||||||
|
|
||||||
SelectionBar::Get( project ).SetTimes(selectedRegion.t0(),
|
|
||||||
selectedRegion.t1(), audioTime);
|
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
|
||||||
SpectralSelectionBar::Get( project ).SetFrequencies(
|
|
||||||
selectedRegion.f0(), selectedRegion.f1());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@
|
|||||||
#include <wx/tooltip.h>
|
#include <wx/tooltip.h>
|
||||||
#include <wx/datetime.h>
|
#include <wx/datetime.h>
|
||||||
|
|
||||||
#include "TranscriptionToolBar.h"
|
|
||||||
|
|
||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../AdornedRulerPanel.h"
|
#include "../AdornedRulerPanel.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
@ -106,8 +104,8 @@ END_EVENT_TABLE()
|
|||||||
// Note that we use the legacy "Control" string as the section because this
|
// Note that we use the legacy "Control" string as the section because this
|
||||||
// gets written to prefs and cannot be changed in prefs to maintain backwards
|
// gets written to prefs and cannot be changed in prefs to maintain backwards
|
||||||
// compatibility
|
// compatibility
|
||||||
ControlToolBar::ControlToolBar()
|
ControlToolBar::ControlToolBar( AudacityProject &project )
|
||||||
: ToolBar(TransportBarID, _("Transport"), wxT("Control"))
|
: ToolBar(project, TransportBarID, _("Transport"), wxT("Control"))
|
||||||
{
|
{
|
||||||
mPaused = false;
|
mPaused = false;
|
||||||
|
|
||||||
@ -314,7 +312,8 @@ void ControlToolBar::RegenerateTooltips()
|
|||||||
wxT("SelStart"), _("Select to Start") } );
|
wxT("SelStart"), _("Select to Start") } );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ToolBar::SetButtonToolTip(*pCtrl, commands.data(), commands.size());
|
ToolBar::SetButtonToolTip(
|
||||||
|
mProject, *pCtrl, commands.data(), commands.size());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -476,7 +475,7 @@ void ControlToolBar::Repaint( wxDC *dc )
|
|||||||
|
|
||||||
void ControlToolBar::EnableDisableButtons()
|
void ControlToolBar::EnableDisableButtons()
|
||||||
{
|
{
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
bool paused = mPause->IsDown();
|
bool paused = mPause->IsDown();
|
||||||
bool playing = mPlay->IsDown();
|
bool playing = mPlay->IsDown();
|
||||||
@ -487,12 +486,6 @@ void ControlToolBar::EnableDisableButtons()
|
|||||||
// Only interested in audio type tracks
|
// Only interested in audio type tracks
|
||||||
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
|
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
|
||||||
|
|
||||||
if (p) {
|
|
||||||
const auto playAtSpeedTB = &TranscriptionToolBar::Get( *p );
|
|
||||||
if (playAtSpeedTB)
|
|
||||||
playAtSpeedTB->SetEnabled(CanStopAudioStream() && tracks && !recording);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
|
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
|
||||||
mRecord->SetEnabled(
|
mRecord->SetEnabled(
|
||||||
CanStopAudioStream() &&
|
CanStopAudioStream() &&
|
||||||
@ -503,7 +496,6 @@ void ControlToolBar::EnableDisableButtons()
|
|||||||
mRewind->SetEnabled(IsPauseDown() || (!playing && !recording));
|
mRewind->SetEnabled(IsPauseDown() || (!playing && !recording));
|
||||||
mFF->SetEnabled(tracks && (IsPauseDown() || (!playing && !recording)));
|
mFF->SetEnabled(tracks && (IsPauseDown() || (!playing && !recording)));
|
||||||
|
|
||||||
//auto pProject = GetActiveProject();
|
|
||||||
mPause->SetEnabled(CanStopAudioStream());
|
mPause->SetEnabled(CanStopAudioStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +512,7 @@ void ControlToolBar::SetPlay(bool down, PlayAppearance appearance)
|
|||||||
mPlay->SetAlternateIdx(0);
|
mPlay->SetAlternateIdx(0);
|
||||||
}
|
}
|
||||||
EnableDisableButtons();
|
EnableDisableButtons();
|
||||||
UpdateStatusBar(GetActiveProject());
|
UpdateStatusBar( &mProject );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::SetStop(bool down)
|
void ControlToolBar::SetStop(bool down)
|
||||||
@ -618,9 +610,7 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||||||
if (cutpreview && t0==t1)
|
if (cutpreview && t0==t1)
|
||||||
return -1; /* msmeyer: makes no sense */
|
return -1; /* msmeyer: makes no sense */
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p)
|
|
||||||
return -1; // Should never happen, but...
|
|
||||||
|
|
||||||
auto &tracks = TrackList::Get( *p );
|
auto &tracks = TrackList::Get( *p );
|
||||||
|
|
||||||
@ -761,9 +751,8 @@ void ControlToolBar::PlayCurrentRegion(bool looped /* = false */,
|
|||||||
if (!CanStopAudioStream())
|
if (!CanStopAudioStream())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
if (p)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
const auto &playRegion = ViewInfo::Get( *p ).playRegion;
|
const auto &playRegion = ViewInfo::Get( *p ).playRegion;
|
||||||
@ -795,7 +784,7 @@ void ControlToolBar::OnKeyEvent(wxKeyEvent & event)
|
|||||||
// If so, "!CanStopAudioStream()" should probably apply.
|
// If so, "!CanStopAudioStream()" should probably apply.
|
||||||
if (event.GetKeyCode() == WXK_SPACE) {
|
if (event.GetKeyCode() == WXK_SPACE) {
|
||||||
if (gAudioIO->IsStreamActive(
|
if (gAudioIO->IsStreamActive(
|
||||||
ProjectAudioIO::Get( *GetActiveProject() ).GetAudioIOToken()
|
ProjectAudioIO::Get( mProject ).GetAudioIOToken()
|
||||||
)) {
|
)) {
|
||||||
SetPlay(false);
|
SetPlay(false);
|
||||||
SetStop(true);
|
SetStop(true);
|
||||||
@ -813,7 +802,7 @@ void ControlToolBar::OnKeyEvent(wxKeyEvent & event)
|
|||||||
|
|
||||||
void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
auto p = GetActiveProject();
|
auto p = &mProject;
|
||||||
|
|
||||||
if (!CanStopAudioStream())
|
if (!CanStopAudioStream())
|
||||||
return;
|
return;
|
||||||
@ -831,7 +820,7 @@ void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
|
|||||||
{
|
{
|
||||||
if (CanStopAudioStream()) {
|
if (CanStopAudioStream()) {
|
||||||
StopPlaying();
|
StopPlaying();
|
||||||
UpdateStatusBar(GetActiveProject());
|
UpdateStatusBar( &mProject );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,7 +829,7 @@ bool ControlToolBar::CanStopAudioStream()
|
|||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
return (!gAudioIO->IsStreamActive() ||
|
return (!gAudioIO->IsStreamActive() ||
|
||||||
gAudioIO->IsMonitoring() ||
|
gAudioIO->IsMonitoring() ||
|
||||||
gAudioIO->GetOwningProject() == GetActiveProject());
|
gAudioIO->GetOwningProject() == &mProject );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::PlayDefault()
|
void ControlToolBar::PlayDefault()
|
||||||
@ -856,7 +845,7 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
|
|||||||
{
|
{
|
||||||
StopScrolling();
|
StopScrolling();
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
|
|
||||||
if(project) {
|
if(project) {
|
||||||
// Let scrubbing code do some appearance change
|
// Let scrubbing code do some appearance change
|
||||||
@ -1001,10 +990,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
// normally used for buttons.
|
// normally used for buttons.
|
||||||
|
|
||||||
// Code from CommandHandler start...
|
// Code from CommandHandler start...
|
||||||
AudacityProject * p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
wxASSERT(p);
|
|
||||||
if (!p)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool altAppearance = mRecord->WasShiftDown();
|
bool altAppearance = mRecord->WasShiftDown();
|
||||||
if (evt.GetInt() == 1) // used when called by keyboard shortcut. Default (0) ignored.
|
if (evt.GetInt() == 1) // used when called by keyboard shortcut. Default (0) ignored.
|
||||||
@ -1123,7 +1109,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Success or not:
|
// Success or not:
|
||||||
UpdateStatusBar(GetActiveProject());
|
UpdateStatusBar( &mProject );
|
||||||
});
|
});
|
||||||
|
|
||||||
auto transportTracks = tracks;
|
auto transportTracks = tracks;
|
||||||
@ -1314,7 +1300,7 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
|
|||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
|
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
|
||||||
|
|
||||||
auto project = GetActiveProject();
|
auto project = &mProject;
|
||||||
auto &scrubber = Scrubber::Get( *project );
|
auto &scrubber = Scrubber::Get( *project );
|
||||||
|
|
||||||
// Bug 1494 - Pausing a seek or scrub should just STOP as
|
// Bug 1494 - Pausing a seek or scrub should just STOP as
|
||||||
@ -1337,7 +1323,7 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
|
|||||||
gAudioIO->SetPaused(mPaused);
|
gAudioIO->SetPaused(mPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar(GetActiveProject());
|
UpdateStatusBar( &mProject );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
||||||
@ -1345,8 +1331,8 @@ void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
|||||||
mRewind->PushDown();
|
mRewind->PushDown();
|
||||||
mRewind->PopUp();
|
mRewind->PopUp();
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (p) {
|
{
|
||||||
TransportActions::StopIfPaused( *p );
|
TransportActions::StopIfPaused( *p );
|
||||||
ProjectWindow::Get( *p ).Rewind(mRewind->WasShiftDown());
|
ProjectWindow::Get( *p ).Rewind(mRewind->WasShiftDown());
|
||||||
}
|
}
|
||||||
@ -1357,9 +1343,9 @@ void ControlToolBar::OnFF(wxCommandEvent & WXUNUSED(evt))
|
|||||||
mFF->PushDown();
|
mFF->PushDown();
|
||||||
mFF->PopUp();
|
mFF->PopUp();
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
if (p) {
|
{
|
||||||
TransportActions::StopIfPaused( *p );
|
TransportActions::StopIfPaused( *p );
|
||||||
ProjectWindow::Get( *p ).SkipEnd(mFF->WasShiftDown());
|
ProjectWindow::Get( *p ).SkipEnd(mFF->WasShiftDown());
|
||||||
}
|
}
|
||||||
@ -1371,8 +1357,8 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
|
|||||||
// STRONG-GUARANTEE (for state of mCutPreviewTracks)
|
// STRONG-GUARANTEE (for state of mCutPreviewTracks)
|
||||||
{
|
{
|
||||||
ClearCutPreviewTracks();
|
ClearCutPreviewTracks();
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (p) {
|
{
|
||||||
auto trackRange = TrackList::Get( *p ).Selected< const PlayableTrack >();
|
auto trackRange = TrackList::Get( *p ).Selected< const PlayableTrack >();
|
||||||
if( !trackRange.empty() ) {
|
if( !trackRange.empty() ) {
|
||||||
auto cutPreviewTracks = TrackList::Create();
|
auto cutPreviewTracks = TrackList::Create();
|
||||||
@ -1427,7 +1413,7 @@ wxString ControlToolBar::StateForStatusBar()
|
|||||||
{
|
{
|
||||||
wxString state;
|
wxString state;
|
||||||
|
|
||||||
auto pProject = GetActiveProject();
|
auto pProject = &mProject;
|
||||||
auto scrubState = pProject
|
auto scrubState = pProject
|
||||||
? Scrubber::Get( *pProject ).GetUntranslatedStateString()
|
? Scrubber::Get( *pProject ).GetUntranslatedStateString()
|
||||||
: wxString();
|
: wxString();
|
||||||
@ -1457,11 +1443,11 @@ void ControlToolBar::UpdateStatusBar(AudacityProject *pProject)
|
|||||||
.GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
.GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ControlToolBar::IsTransportingPinned()
|
bool ControlToolBar::IsTransportingPinned() const
|
||||||
{
|
{
|
||||||
if (!TracksPrefs::GetPinnedHeadPreference())
|
if (!TracksPrefs::GetPinnedHeadPreference())
|
||||||
return false;
|
return false;
|
||||||
const auto &scrubber = Scrubber::Get( *::GetActiveProject() );
|
const auto &scrubber = Scrubber::Get( mProject );
|
||||||
return
|
return
|
||||||
!(scrubber.HasMark() &&
|
!(scrubber.HasMark() &&
|
||||||
!scrubber.WasSpeedPlaying() &&
|
!scrubber.WasSpeedPlaying() &&
|
||||||
@ -1470,15 +1456,15 @@ bool ControlToolBar::IsTransportingPinned()
|
|||||||
|
|
||||||
void ControlToolBar::StartScrollingIfPreferred()
|
void ControlToolBar::StartScrollingIfPreferred()
|
||||||
{
|
{
|
||||||
if (IsTransportingPinned())
|
if ( IsTransportingPinned() )
|
||||||
StartScrolling();
|
StartScrolling();
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
else if (Scrubber::Get( *::GetActiveProject() ).HasMark()) {
|
else if (Scrubber::Get( mProject ).HasMark()) {
|
||||||
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
|
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
|
||||||
// doing this causes wheel rotation events (mapped from the double finger vertical
|
// doing this causes wheel rotation events (mapped from the double finger vertical
|
||||||
// swipe) to be delivered more uniformly to the application, so that speed control
|
// swipe) to be delivered more uniformly to the application, so that speed control
|
||||||
// works better.
|
// works better.
|
||||||
ProjectWindow::Get( *::GetActiveProject() ).GetPlaybackScroller().Activate
|
ProjectWindow::Get( mProject ).GetPlaybackScroller().Activate
|
||||||
(ProjectWindow::PlaybackScroller::Mode::Refresh);
|
(ProjectWindow::PlaybackScroller::Mode::Refresh);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1489,7 +1475,7 @@ void ControlToolBar::StartScrollingIfPreferred()
|
|||||||
void ControlToolBar::StartScrolling()
|
void ControlToolBar::StartScrolling()
|
||||||
{
|
{
|
||||||
using Mode = ProjectWindow::PlaybackScroller::Mode;
|
using Mode = ProjectWindow::PlaybackScroller::Mode;
|
||||||
const auto project = GetActiveProject();
|
const auto project = &mProject;
|
||||||
if (project) {
|
if (project) {
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
auto mode = Mode::Pinned;
|
auto mode = Mode::Pinned;
|
||||||
@ -1527,7 +1513,7 @@ void ControlToolBar::StartScrolling()
|
|||||||
|
|
||||||
void ControlToolBar::StopScrolling()
|
void ControlToolBar::StopScrolling()
|
||||||
{
|
{
|
||||||
const auto project = GetActiveProject();
|
const auto project = &mProject;
|
||||||
if(project)
|
if(project)
|
||||||
ProjectWindow::Get( *project ).GetPlaybackScroller().Activate
|
ProjectWindow::Get( *project ).GetPlaybackScroller().Activate
|
||||||
(ProjectWindow::PlaybackScroller::Mode::Off);
|
(ProjectWindow::PlaybackScroller::Mode::Off);
|
||||||
@ -1535,18 +1521,18 @@ void ControlToolBar::StopScrolling()
|
|||||||
|
|
||||||
void ControlToolBar::CommitRecording()
|
void ControlToolBar::CommitRecording()
|
||||||
{
|
{
|
||||||
const auto project = GetActiveProject();
|
const auto project = &mProject;
|
||||||
TrackList::Get( *project ).ApplyPendingTracks();
|
TrackList::Get( *project ).ApplyPendingTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::CancelRecording()
|
void ControlToolBar::CancelRecording()
|
||||||
{
|
{
|
||||||
const auto project = GetActiveProject();
|
const auto project = &mProject;
|
||||||
TrackList::Get( *project ).ClearPendingTracks();
|
TrackList::Get( *project ).ClearPendingTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
#include "NoteTrack.h"
|
#include "../NoteTrack.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TransportTracks GetAllPlaybackTracks(TrackList &trackList, bool selectedOnly, bool useMidi)
|
TransportTracks GetAllPlaybackTracks(TrackList &trackList, bool selectedOnly, bool useMidi)
|
||||||
@ -1572,3 +1558,8 @@ TransportTracks GetAllPlaybackTracks(TrackList &trackList, bool selectedOnly, bo
|
|||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ TransportBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew ControlToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -51,10 +51,10 @@ class ControlToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ControlToolBar();
|
ControlToolBar( AudacityProject &project );
|
||||||
virtual ~ControlToolBar();
|
virtual ~ControlToolBar();
|
||||||
|
|
||||||
static bool IsTransportingPinned();
|
bool IsTransportingPinned() const;
|
||||||
|
|
||||||
static ControlToolBar *Find( AudacityProject &project );
|
static ControlToolBar *Find( AudacityProject &project );
|
||||||
static ControlToolBar &Get( AudacityProject &project );
|
static ControlToolBar &Get( AudacityProject &project );
|
||||||
|
@ -72,8 +72,8 @@ static int DeviceToolbarPrefsID()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
DeviceToolBar::DeviceToolBar()
|
DeviceToolBar::DeviceToolBar( AudacityProject &project )
|
||||||
: ToolBar(DeviceBarID, _("Device"), wxT("Device"), true)
|
: ToolBar( project, DeviceBarID, _("Device"), wxT("Device"), true )
|
||||||
{
|
{
|
||||||
wxTheApp->Bind( EVT_RESCANNED_DEVICES,
|
wxTheApp->Bind( EVT_RESCANNED_DEVICES,
|
||||||
&DeviceToolBar::OnRescannedDevices, this );
|
&DeviceToolBar::OnRescannedDevices, this );
|
||||||
@ -351,12 +351,8 @@ void DeviceToolBar::EnableDisableButtons()
|
|||||||
// Here we should relinquish focus
|
// Here we should relinquish focus
|
||||||
if (audioStreamActive) {
|
if (audioStreamActive) {
|
||||||
wxWindow *focus = wxWindow::FindFocus();
|
wxWindow *focus = wxWindow::FindFocus();
|
||||||
if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels) {
|
if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels)
|
||||||
AudacityProject *activeProject = GetActiveProject();
|
TrackPanel::Get( mProject ).SetFocus();
|
||||||
if (activeProject) {
|
|
||||||
TrackPanel::Get( *activeProject ).SetFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mHost->Enable(!audioStreamActive);
|
mHost->Enable(!audioStreamActive);
|
||||||
@ -871,3 +867,8 @@ void DeviceToolBar::ShowComboDialog(wxChoice *combo, const wxString &title)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ DeviceBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew DeviceToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -25,7 +25,7 @@ class DeviceToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DeviceToolBar();
|
DeviceToolBar( AudacityProject &project );
|
||||||
virtual ~DeviceToolBar();
|
virtual ~DeviceToolBar();
|
||||||
|
|
||||||
static DeviceToolBar &Get( AudacityProject &project );
|
static DeviceToolBar &Get( AudacityProject &project );
|
||||||
|
@ -76,8 +76,8 @@ BEGIN_EVENT_TABLE( EditToolBar, ToolBar )
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
EditToolBar::EditToolBar()
|
EditToolBar::EditToolBar( AudacityProject &project )
|
||||||
: ToolBar(EditBarID, _("Edit"), wxT("Edit"))
|
: ToolBar(project, EditBarID, _("Edit"), wxT("Edit"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +259,7 @@ void EditToolBar::ForAllButtons(int Action)
|
|||||||
CommandManager* cm = nullptr;
|
CommandManager* cm = nullptr;
|
||||||
|
|
||||||
if( Action & ETBActEnableDisable ){
|
if( Action & ETBActEnableDisable ){
|
||||||
p = GetActiveProject();
|
p = &mProject;
|
||||||
if (!p) return;
|
|
||||||
cm = &CommandManager::Get( *p );
|
cm = &CommandManager::Get( *p );
|
||||||
#ifdef OPTION_SYNC_LOCK_BUTTON
|
#ifdef OPTION_SYNC_LOCK_BUTTON
|
||||||
bool bSyncLockTracks;
|
bool bSyncLockTracks;
|
||||||
@ -279,7 +278,8 @@ void EditToolBar::ForAllButtons(int Action)
|
|||||||
if( Action & ETBActTooltips ){
|
if( Action & ETBActTooltips ){
|
||||||
TranslatedInternalString command{
|
TranslatedInternalString command{
|
||||||
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
|
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
|
||||||
ToolBar::SetButtonToolTip( *mButtons[entry.tool], &command, 1u );
|
ToolBar::SetButtonToolTip( mProject,
|
||||||
|
*mButtons[entry.tool], &command, 1u );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cm) {
|
if (cm) {
|
||||||
@ -294,13 +294,15 @@ void EditToolBar::OnButton(wxCommandEvent &event)
|
|||||||
// Be sure the pop-up happens even if there are exceptions, except for buttons which toggle.
|
// Be sure the pop-up happens even if there are exceptions, except for buttons which toggle.
|
||||||
auto cleanup = finally( [&] { mButtons[id]->InteractionOver();});
|
auto cleanup = finally( [&] { mButtons[id]->InteractionOver();});
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) return;
|
|
||||||
auto &cm = CommandManager::Get( *p );
|
auto &cm = CommandManager::Get( *p );
|
||||||
|
|
||||||
auto flags = MenuManager::Get(*p).GetUpdateFlags();
|
auto flags = MenuManager::Get(*p).GetUpdateFlags();
|
||||||
const CommandContext context( *GetActiveProject() );
|
const CommandContext context( *p );
|
||||||
cm.HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
|
cm.HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ EditBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew EditToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -74,7 +74,7 @@ class EditToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EditToolBar();
|
EditToolBar( AudacityProject &project );
|
||||||
virtual ~EditToolBar();
|
virtual ~EditToolBar();
|
||||||
|
|
||||||
void Create(wxWindow *parent) override;
|
void Create(wxWindow *parent) override;
|
||||||
|
@ -48,11 +48,9 @@ BEGIN_EVENT_TABLE( MeterToolBar, ToolBar )
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
MeterToolBar::MeterToolBar(AudacityProject *project, int type)
|
MeterToolBar::MeterToolBar(AudacityProject &project, int type)
|
||||||
: ToolBar(type, _("Combined Meter"), wxT("CombinedMeter"), true)
|
: ToolBar(project, type, _("Combined Meter"), wxT("CombinedMeter"), true)
|
||||||
{
|
{
|
||||||
mProject = project;
|
|
||||||
|
|
||||||
if( mType == RecordMeterBarID ){
|
if( mType == RecordMeterBarID ){
|
||||||
mWhichMeters = kWithRecordMeter;
|
mWhichMeters = kWithRecordMeter;
|
||||||
mLabel = _("Recording Meter");
|
mLabel = _("Recording Meter");
|
||||||
@ -88,7 +86,7 @@ void MeterToolBar::ReCreateButtons()
|
|||||||
{
|
{
|
||||||
MeterPanel::State playState{ false }, recordState{ false };
|
MeterPanel::State playState{ false }, recordState{ false };
|
||||||
|
|
||||||
auto &projectAudioIO = ProjectAudioIO::Get( *mProject );
|
auto &projectAudioIO = ProjectAudioIO::Get( mProject );
|
||||||
if (mPlayMeter && projectAudioIO.GetPlaybackMeter() == mPlayMeter)
|
if (mPlayMeter && projectAudioIO.GetPlaybackMeter() == mPlayMeter)
|
||||||
{
|
{
|
||||||
playState = mPlayMeter->SaveState();
|
playState = mPlayMeter->SaveState();
|
||||||
@ -116,13 +114,12 @@ void MeterToolBar::ReCreateButtons()
|
|||||||
void MeterToolBar::Populate()
|
void MeterToolBar::Populate()
|
||||||
{
|
{
|
||||||
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
wxASSERT(mProject); // to justify safenew
|
|
||||||
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND);
|
Add((mSizer = safenew wxGridBagSizer()), 1, wxEXPAND);
|
||||||
|
|
||||||
if( mWhichMeters & kWithRecordMeter ){
|
if( mWhichMeters & kWithRecordMeter ){
|
||||||
//JKC: Record on left, playback on right. Left to right flow
|
//JKC: Record on left, playback on right. Left to right flow
|
||||||
//(maybe we should do it differently for Arabic language :-) )
|
//(maybe we should do it differently for Arabic language :-) )
|
||||||
mRecordMeter = safenew MeterPanel( mProject,
|
mRecordMeter = safenew MeterPanel( &mProject,
|
||||||
this,
|
this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
true,
|
true,
|
||||||
@ -138,7 +135,7 @@ void MeterToolBar::Populate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( mWhichMeters & kWithPlayMeter ){
|
if( mWhichMeters & kWithPlayMeter ){
|
||||||
mPlayMeter = safenew MeterPanel( mProject,
|
mPlayMeter = safenew MeterPanel( &mProject,
|
||||||
this,
|
this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
false,
|
false,
|
||||||
@ -229,7 +226,7 @@ void MeterToolBar::OnSize( wxSizeEvent & event) //WXUNUSED(event) )
|
|||||||
|
|
||||||
bool MeterToolBar::Expose( bool show )
|
bool MeterToolBar::Expose( bool show )
|
||||||
{
|
{
|
||||||
auto &projectAudioIO = ProjectAudioIO::Get( *mProject );
|
auto &projectAudioIO = ProjectAudioIO::Get( mProject );
|
||||||
if( show ) {
|
if( show ) {
|
||||||
if( mPlayMeter ) {
|
if( mPlayMeter ) {
|
||||||
projectAudioIO.SetPlaybackMeter( mPlayMeter );
|
projectAudioIO.SetPlaybackMeter( mPlayMeter );
|
||||||
@ -274,3 +271,18 @@ void MeterToolBar::SetDocked(ToolDock *dock, bool pushed) {
|
|||||||
Fit();
|
Fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory1{ RecordMeterBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{
|
||||||
|
safenew MeterToolBar{ project, RecordMeterBarID } }; }
|
||||||
|
};
|
||||||
|
static RegisteredToolbarFactory factory2{ PlayMeterBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{
|
||||||
|
safenew MeterToolBar{ project, PlayMeterBarID } }; }
|
||||||
|
};
|
||||||
|
static RegisteredToolbarFactory factory3{ MeterBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{
|
||||||
|
safenew MeterToolBar{ project, MeterBarID } }; }
|
||||||
|
};
|
||||||
|
@ -33,7 +33,7 @@ class MeterToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MeterToolBar(AudacityProject *project, int type);
|
MeterToolBar(AudacityProject &project, int type);
|
||||||
virtual ~MeterToolBar();
|
virtual ~MeterToolBar();
|
||||||
|
|
||||||
void Create(wxWindow *parent) override;
|
void Create(wxWindow *parent) override;
|
||||||
@ -56,7 +56,6 @@ class MeterToolBar final : public ToolBar {
|
|||||||
private:
|
private:
|
||||||
void RegenerateTooltips() override;
|
void RegenerateTooltips() override;
|
||||||
|
|
||||||
AudacityProject *mProject;
|
|
||||||
int mWhichMeters;
|
int mWhichMeters;
|
||||||
wxGridBagSizer *mSizer;
|
wxGridBagSizer *mSizer;
|
||||||
MeterPanel *mPlayMeter;
|
MeterPanel *mPlayMeter;
|
||||||
|
@ -55,8 +55,8 @@ BEGIN_EVENT_TABLE(MixerToolBar, ToolBar)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
MixerToolBar::MixerToolBar()
|
MixerToolBar::MixerToolBar( AudacityProject &project )
|
||||||
: ToolBar(MixerBarID, _("Mixer"), wxT("Mixer"), true)
|
: ToolBar(project, MixerBarID, _("Mixer"), wxT("Mixer"), true)
|
||||||
{
|
{
|
||||||
mInputSliderVolume = 0.0;
|
mInputSliderVolume = 0.0;
|
||||||
mOutputSliderVolume = 0.0;
|
mOutputSliderVolume = 0.0;
|
||||||
@ -314,3 +314,8 @@ void MixerToolBar::SetToolTips()
|
|||||||
mOutputSlider->SetToolTipTemplate(_("Playback Volume (Unavailable; use system mixer.)"));
|
mOutputSlider->SetToolTipTemplate(_("Playback Volume (Unavailable; use system mixer.)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ MixerBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew MixerToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -23,7 +23,7 @@ class MixerToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MixerToolBar();
|
MixerToolBar( AudacityProject &project );
|
||||||
virtual ~MixerToolBar();
|
virtual ~MixerToolBar();
|
||||||
|
|
||||||
static MixerToolBar &Get( AudacityProject &project );
|
static MixerToolBar &Get( AudacityProject &project );
|
||||||
|
@ -55,8 +55,8 @@ EVT_COMMAND_RANGE( STBFirstButton,
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
ScrubbingToolBar::ScrubbingToolBar()
|
ScrubbingToolBar::ScrubbingToolBar( AudacityProject &project )
|
||||||
: ToolBar(ScrubbingBarID, _("Scrub"), wxT("Scrub"))
|
: ToolBar(project, ScrubbingBarID, _("Scrub"), wxT("Scrub"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,10 +147,10 @@ void ScrubbingToolBar::RegenerateTooltips()
|
|||||||
(AButton &button, const wxString &label, const CommandID &cmd)
|
(AButton &button, const wxString &label, const CommandID &cmd)
|
||||||
{
|
{
|
||||||
TranslatedInternalString command{ cmd, label };
|
TranslatedInternalString command{ cmd, label };
|
||||||
ToolBar::SetButtonToolTip( button, &command, 1u );
|
ToolBar::SetButtonToolTip( mProject, button, &command, 1u );
|
||||||
};
|
};
|
||||||
|
|
||||||
auto project = GetActiveProject();
|
auto project = &mProject;
|
||||||
if (project) {
|
if (project) {
|
||||||
auto &scrubber = Scrubber::Get( *project );
|
auto &scrubber = Scrubber::Get( *project );
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ void ScrubbingToolBar::RegenerateTooltips()
|
|||||||
|
|
||||||
void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
auto &scrubber = Scrubber::Get( *p );
|
auto &scrubber = Scrubber::Get( *p );
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void ScrubbingToolBar::EnableDisableButtons()
|
|||||||
const auto seekButton = mButtons[STBSeekID];
|
const auto seekButton = mButtons[STBSeekID];
|
||||||
seekButton->SetEnabled(true);
|
seekButton->SetEnabled(true);
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
|
|
||||||
auto &scrubber = Scrubber::Get( *p );
|
auto &scrubber = Scrubber::Get( *p );
|
||||||
@ -261,3 +261,8 @@ void ScrubbingToolBar::EnableDisableButtons()
|
|||||||
RegenerateTooltips();
|
RegenerateTooltips();
|
||||||
scrubber.CheckMenuItems();
|
scrubber.CheckMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ ScrubbingBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew ScrubbingToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -40,7 +40,7 @@ class ScrubbingToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ScrubbingToolBar();
|
ScrubbingToolBar( AudacityProject &project );
|
||||||
virtual ~ScrubbingToolBar();
|
virtual ~ScrubbingToolBar();
|
||||||
|
|
||||||
static ScrubbingToolBar &Get( AudacityProject &project );
|
static ScrubbingToolBar &Get( AudacityProject &project );
|
||||||
|
@ -56,8 +56,11 @@ with changes in the SelectionBar.
|
|||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../KeyboardCapture.h"
|
#include "../KeyboardCapture.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
#include "../Project.h"
|
||||||
|
#include "../ProjectAudioIO.h"
|
||||||
#include "../ProjectSettings.h"
|
#include "../ProjectSettings.h"
|
||||||
#include "../Snap.h"
|
#include "../Snap.h"
|
||||||
|
#include "../ViewInfo.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
@ -96,6 +99,7 @@ BEGIN_EVENT_TABLE(SelectionBar, ToolBar)
|
|||||||
EVT_TEXT(EndTimeID, SelectionBar::OnChangedTime)
|
EVT_TEXT(EndTimeID, SelectionBar::OnChangedTime)
|
||||||
EVT_CHOICE(SnapToID, SelectionBar::OnSnapTo)
|
EVT_CHOICE(SnapToID, SelectionBar::OnSnapTo)
|
||||||
EVT_CHOICE(ChoiceID, SelectionBar::OnChoice )
|
EVT_CHOICE(ChoiceID, SelectionBar::OnChoice )
|
||||||
|
EVT_IDLE( SelectionBar::OnIdle )
|
||||||
EVT_COMBOBOX(RateID, SelectionBar::OnRate)
|
EVT_COMBOBOX(RateID, SelectionBar::OnRate)
|
||||||
EVT_TEXT(RateID, SelectionBar::OnRate)
|
EVT_TEXT(RateID, SelectionBar::OnRate)
|
||||||
|
|
||||||
@ -103,8 +107,8 @@ BEGIN_EVENT_TABLE(SelectionBar, ToolBar)
|
|||||||
EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, SelectionBar::OnCaptureKey)
|
EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, SelectionBar::OnCaptureKey)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
SelectionBar::SelectionBar()
|
SelectionBar::SelectionBar( AudacityProject &project )
|
||||||
: ToolBar(SelectionBarID, _("Selection"), wxT("Selection")),
|
: ToolBar(project, SelectionBarID, _("Selection"), wxT("Selection")),
|
||||||
mListener(NULL), mRate(0.0),
|
mListener(NULL), mRate(0.0),
|
||||||
mStart(0.0), mEnd(0.0), mLength(0.0), mCenter(0.0), mAudio(0.0),
|
mStart(0.0), mEnd(0.0), mLength(0.0), mCenter(0.0), mAudio(0.0),
|
||||||
mDrive1( StartTimeID), mDrive2( EndTimeID ),
|
mDrive1( StartTimeID), mDrive2( EndTimeID ),
|
||||||
@ -578,6 +582,27 @@ void SelectionBar::OnChoice(wxCommandEvent & WXUNUSED(event))
|
|||||||
SelectionModeUpdated();
|
SelectionModeUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionBar::OnIdle( wxIdleEvent &evt )
|
||||||
|
{
|
||||||
|
evt.Skip();
|
||||||
|
auto &project = mProject;
|
||||||
|
const auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
|
||||||
|
double audioTime;
|
||||||
|
|
||||||
|
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
||||||
|
if ( projectAudioIO.IsAudioActive() ){
|
||||||
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
|
audioTime = gAudioIO->GetStreamTime();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const auto &playRegion = ViewInfo::Get( project ).playRegion;
|
||||||
|
audioTime = playRegion.GetStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTimes(selectedRegion.t0(), selectedRegion.t1(), audioTime);
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionBar::SelectionModeUpdated()
|
void SelectionBar::SelectionModeUpdated()
|
||||||
{
|
{
|
||||||
// We just changed the mode. Remember it.
|
// We just changed the mode. Remember it.
|
||||||
@ -760,3 +785,8 @@ void SelectionBar::OnSnapTo(wxCommandEvent & WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
mListener->AS_SetSnapTo(mSnapTo->GetSelection());
|
mListener->AS_SetSnapTo(mSnapTo->GetSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ SelectionBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew SelectionBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -40,7 +40,7 @@ class NumericTextCtrl;
|
|||||||
class SelectionBar final : public ToolBar {
|
class SelectionBar final : public ToolBar {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelectionBar();
|
SelectionBar( AudacityProject &project );
|
||||||
virtual ~SelectionBar();
|
virtual ~SelectionBar();
|
||||||
|
|
||||||
static SelectionBar &Get( AudacityProject &project );
|
static SelectionBar &Get( AudacityProject &project );
|
||||||
@ -79,6 +79,7 @@ class SelectionBar final : public ToolBar {
|
|||||||
void OnFocus(wxFocusEvent &event);
|
void OnFocus(wxFocusEvent &event);
|
||||||
void OnCaptureKey(wxCommandEvent &event);
|
void OnCaptureKey(wxCommandEvent &event);
|
||||||
void OnSize(wxSizeEvent &evt);
|
void OnSize(wxSizeEvent &evt);
|
||||||
|
void OnIdle( wxIdleEvent &evt );
|
||||||
|
|
||||||
void ModifySelection(int newDriver, bool done = false);
|
void ModifySelection(int newDriver, bool done = false);
|
||||||
void UpdateRates();
|
void UpdateRates();
|
||||||
|
@ -55,8 +55,10 @@ with changes in the SpectralSelectionBar.
|
|||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
#include "../Project.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../SelectedRegion.h"
|
#include "../SelectedRegion.h"
|
||||||
|
#include "../ViewInfo.h"
|
||||||
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
#include "../widgets/WindowAccessible.h"
|
#include "../widgets/WindowAccessible.h"
|
||||||
@ -86,13 +88,15 @@ BEGIN_EVENT_TABLE(SpectralSelectionBar, ToolBar)
|
|||||||
EVT_CHOICE(OnChoiceID, SpectralSelectionBar::OnChoice)
|
EVT_CHOICE(OnChoiceID, SpectralSelectionBar::OnChoice)
|
||||||
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
|
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
|
||||||
EVT_COMMAND(wxID_ANY, EVT_BANDWIDTHTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
|
EVT_COMMAND(wxID_ANY, EVT_BANDWIDTHTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
|
||||||
|
EVT_IDLE( SpectralSelectionBar::OnIdle )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
static const wxString preferencePath
|
static const wxString preferencePath
|
||||||
(wxT("/GUI/Toolbars/SpectralSelection/CenterAndWidthChoice"));
|
(wxT("/GUI/Toolbars/SpectralSelection/CenterAndWidthChoice"));
|
||||||
|
|
||||||
SpectralSelectionBar::SpectralSelectionBar()
|
SpectralSelectionBar::SpectralSelectionBar( AudacityProject &project )
|
||||||
: ToolBar(SpectralSelectionBarID, _("Spectral Selection"), wxT("SpectralSelection"))
|
: ToolBar( project,
|
||||||
|
SpectralSelectionBarID, _("Spectral Selection"), wxT("SpectralSelection") )
|
||||||
, mListener(NULL), mbCenterAndWidth(true)
|
, mListener(NULL), mbCenterAndWidth(true)
|
||||||
, mCenter(0.0), mWidth(0.0), mLow(0.0), mHigh(0.0)
|
, mCenter(0.0), mWidth(0.0), mLow(0.0), mHigh(0.0)
|
||||||
, mCenterCtrl(NULL), mWidthCtrl(NULL), mLowCtrl(NULL), mHighCtrl(NULL)
|
, mCenterCtrl(NULL), mWidthCtrl(NULL), mLowCtrl(NULL), mHighCtrl(NULL)
|
||||||
@ -368,6 +372,14 @@ void SpectralSelectionBar::OnChoice(wxCommandEvent &)
|
|||||||
Updated();
|
Updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectralSelectionBar::OnIdle( wxIdleEvent &evt )
|
||||||
|
{
|
||||||
|
evt.Skip();
|
||||||
|
auto &project = mProject;
|
||||||
|
const auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
SetFrequencies( selectedRegion.f0(), selectedRegion.f1() );
|
||||||
|
}
|
||||||
|
|
||||||
void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt)
|
void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt)
|
||||||
{
|
{
|
||||||
int index = evt.GetInt();
|
int index = evt.GetInt();
|
||||||
@ -491,4 +503,9 @@ void SpectralSelectionBar::SetBandwidthSelectionFormatName(const NumericFormatSy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ SpectralSelectionBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew SpectralSelectionBar{ project } }; }
|
||||||
|
};
|
||||||
|
|
||||||
#endif // #ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#endif // #ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
|
@ -29,7 +29,7 @@ class SpectralSelectionBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SpectralSelectionBar();
|
SpectralSelectionBar( AudacityProject &project );
|
||||||
virtual ~SpectralSelectionBar();
|
virtual ~SpectralSelectionBar();
|
||||||
|
|
||||||
static SpectralSelectionBar &Get( AudacityProject &project );
|
static SpectralSelectionBar &Get( AudacityProject &project );
|
||||||
@ -56,6 +56,7 @@ private:
|
|||||||
void OnUpdate(wxCommandEvent &evt);
|
void OnUpdate(wxCommandEvent &evt);
|
||||||
void OnCtrl(wxCommandEvent &evt);
|
void OnCtrl(wxCommandEvent &evt);
|
||||||
void OnChoice(wxCommandEvent &evt);
|
void OnChoice(wxCommandEvent &evt);
|
||||||
|
void OnIdle( wxIdleEvent &evt );
|
||||||
|
|
||||||
void OnSize(wxSizeEvent &evt);
|
void OnSize(wxSizeEvent &evt);
|
||||||
|
|
||||||
|
@ -314,11 +314,13 @@ END_EVENT_TABLE()
|
|||||||
//
|
//
|
||||||
// Constructor
|
// Constructor
|
||||||
//
|
//
|
||||||
ToolBar::ToolBar( int type,
|
ToolBar::ToolBar( AudacityProject &project,
|
||||||
|
int type,
|
||||||
const wxString &label,
|
const wxString &label,
|
||||||
const wxString §ion,
|
const wxString §ion,
|
||||||
bool resizable )
|
bool resizable )
|
||||||
: wxPanelWrapper()
|
: wxPanelWrapper()
|
||||||
|
, mProject{ project }
|
||||||
{
|
{
|
||||||
// Save parameters
|
// Save parameters
|
||||||
mType = type;
|
mType = type;
|
||||||
@ -842,10 +844,11 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ToolBar::SetButtonToolTip
|
void ToolBar::SetButtonToolTip
|
||||||
(AButton &button, const TranslatedInternalString commands[], size_t nCommands)
|
(AudacityProject &theProject,
|
||||||
|
AButton &button, const TranslatedInternalString commands[], size_t nCommands)
|
||||||
{
|
{
|
||||||
wxString result;
|
wxString result;
|
||||||
const auto project = GetActiveProject();
|
const auto project = &theProject;
|
||||||
const auto commandManager =
|
const auto commandManager =
|
||||||
project ? &CommandManager::Get( *project ) : nullptr;
|
project ? &CommandManager::Get( *project ) : nullptr;
|
||||||
if (commandManager)
|
if (commandManager)
|
||||||
@ -913,3 +916,25 @@ int ToolBar::GetResizeGrabberWidth()
|
|||||||
{
|
{
|
||||||
return RWIDTH;
|
return RWIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
RegisteredToolbarFactory::Functions &GetFunctions()
|
||||||
|
{
|
||||||
|
static RegisteredToolbarFactory::Functions factories( ToolBarCount );
|
||||||
|
return factories;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisteredToolbarFactory::RegisteredToolbarFactory(
|
||||||
|
int id, const Function &function)
|
||||||
|
{
|
||||||
|
wxASSERT( id >= 0 && id < ToolBarCount );
|
||||||
|
GetFunctions()[ id ] = function;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto RegisteredToolbarFactory::GetFactories() -> const Functions&
|
||||||
|
{
|
||||||
|
return GetFunctions();
|
||||||
|
}
|
||||||
|
@ -15,12 +15,14 @@
|
|||||||
|
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Theme.h"
|
#include "../Theme.h"
|
||||||
#include "../widgets/wxPanelWrapper.h" // to inherit
|
#include "../widgets/wxPanelWrapper.h" // to inherit
|
||||||
|
#include <wx/windowptr.h>
|
||||||
|
|
||||||
class wxBoxSizer;
|
class wxBoxSizer;
|
||||||
class wxDC;
|
class wxDC;
|
||||||
@ -85,6 +87,8 @@ enum
|
|||||||
// How may pixels padding each side of a floating toolbar
|
// How may pixels padding each side of a floating toolbar
|
||||||
enum { ToolBarFloatMargin = 1 };
|
enum { ToolBarFloatMargin = 1 };
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
|
|
||||||
class ToolBar /* not final */
|
class ToolBar /* not final */
|
||||||
: public wxPanelWrapper
|
: public wxPanelWrapper
|
||||||
, protected PrefsListener
|
, protected PrefsListener
|
||||||
@ -92,9 +96,11 @@ class ToolBar /* not final */
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Holder = Destroy_ptr<ToolBar>;
|
using Holder = wxWindowPtr<ToolBar>;
|
||||||
|
|
||||||
ToolBar(int type, const wxString & label, const wxString & section, bool resizable = false);
|
ToolBar( AudacityProject &project,
|
||||||
|
int type, const wxString & label, const wxString & section,
|
||||||
|
bool resizable = false);
|
||||||
virtual ~ToolBar();
|
virtual ~ToolBar();
|
||||||
|
|
||||||
bool AcceptsFocus() const override { return false; };
|
bool AcceptsFocus() const override { return false; };
|
||||||
@ -160,7 +166,7 @@ class ToolBar /* not final */
|
|||||||
|
|
||||||
static
|
static
|
||||||
void SetButtonToolTip
|
void SetButtonToolTip
|
||||||
(AButton &button,
|
(AudacityProject &project, AButton &button,
|
||||||
// If a shortcut key is defined for the command, then it is appended,
|
// If a shortcut key is defined for the command, then it is appended,
|
||||||
// parenthesized, after the translated name.
|
// parenthesized, after the translated name.
|
||||||
const TranslatedInternalString commands[], size_t nCommands);
|
const TranslatedInternalString commands[], size_t nCommands);
|
||||||
@ -214,6 +220,7 @@ class ToolBar /* not final */
|
|||||||
void OnMouseEvents(wxMouseEvent &event);
|
void OnMouseEvents(wxMouseEvent &event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
AudacityProject &mProject;
|
||||||
wxString mLabel;
|
wxString mLabel;
|
||||||
wxString mSection;
|
wxString mSection;
|
||||||
int mType;
|
int mType;
|
||||||
@ -239,4 +246,13 @@ class ToolBar /* not final */
|
|||||||
friend class ToolBarResizer;
|
friend class ToolBarResizer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RegisteredToolbarFactory {
|
||||||
|
using Function = std::function< ToolBar::Holder( AudacityProject & ) >;
|
||||||
|
using Functions = std::vector< Function >;
|
||||||
|
|
||||||
|
RegisteredToolbarFactory( int id, const Function &function );
|
||||||
|
|
||||||
|
static const Functions &GetFactories();
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,17 +52,6 @@
|
|||||||
#include <wx/minifram.h>
|
#include <wx/minifram.h>
|
||||||
#include <wx/popupwin.h>
|
#include <wx/popupwin.h>
|
||||||
|
|
||||||
#include "ControlToolBar.h"
|
|
||||||
#include "DeviceToolBar.h"
|
|
||||||
#include "EditToolBar.h"
|
|
||||||
#include "MeterToolBar.h"
|
|
||||||
#include "MixerToolBar.h"
|
|
||||||
#include "ScrubbingToolBar.h"
|
|
||||||
#include "SelectionBar.h"
|
|
||||||
#include "SpectralSelectionBar.h"
|
|
||||||
#include "ToolsToolBar.h"
|
|
||||||
#include "TranscriptionToolBar.h"
|
|
||||||
|
|
||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../ImageManipulation.h"
|
#include "../ImageManipulation.h"
|
||||||
@ -429,20 +418,16 @@ ToolManager::ToolManager( AudacityProject *parent, wxWindow *topDockParent )
|
|||||||
// Create all of the toolbars
|
// Create all of the toolbars
|
||||||
// All have the project as parent window
|
// All have the project as parent window
|
||||||
wxASSERT(parent);
|
wxASSERT(parent);
|
||||||
mBars[ ToolsBarID ] = ToolBar::Holder{ safenew ToolsToolBar() };
|
|
||||||
mBars[ TransportBarID ] = ToolBar::Holder{ safenew ControlToolBar() };
|
size_t ii = 0;
|
||||||
mBars[ RecordMeterBarID ] = ToolBar::Holder{ safenew MeterToolBar( parent, RecordMeterBarID ) };
|
for (const auto &factory : RegisteredToolbarFactory::GetFactories()) {
|
||||||
mBars[ PlayMeterBarID ] = ToolBar::Holder{ safenew MeterToolBar( parent, PlayMeterBarID ) };
|
if (factory) {
|
||||||
mBars[ MeterBarID ] = ToolBar::Holder{ safenew MeterToolBar( parent, MeterBarID ) };
|
mBars[ii] = factory( *parent );
|
||||||
mBars[ EditBarID ] = ToolBar::Holder{ safenew EditToolBar() };
|
}
|
||||||
mBars[ MixerBarID ] = ToolBar::Holder{ safenew MixerToolBar() };
|
else
|
||||||
mBars[ TranscriptionBarID ] = ToolBar::Holder{ safenew TranscriptionToolBar() };
|
wxASSERT( false );
|
||||||
mBars[ SelectionBarID ] = ToolBar::Holder{ safenew SelectionBar() };
|
++ii;
|
||||||
mBars[ DeviceBarID ] = ToolBar::Holder{ safenew DeviceToolBar() };
|
}
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
|
||||||
mBars[SpectralSelectionBarID] = ToolBar::Holder{ safenew SpectralSelectionBar() };
|
|
||||||
#endif
|
|
||||||
mBars[ ScrubbingBarID ] = ToolBar::Holder{ safenew ScrubbingToolBar() };
|
|
||||||
|
|
||||||
// We own the timer
|
// We own the timer
|
||||||
mTimer.SetOwner( this );
|
mTimer.SetOwner( this );
|
||||||
|
@ -71,8 +71,8 @@ BEGIN_EVENT_TABLE(ToolsToolBar, ToolBar)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard constructor
|
//Standard constructor
|
||||||
ToolsToolBar::ToolsToolBar()
|
ToolsToolBar::ToolsToolBar( AudacityProject &project )
|
||||||
: ToolBar(ToolsBarID, _("Tools"), wxT("Tools"))
|
: ToolBar(project, ToolsBarID, _("Tools"), wxT("Tools"))
|
||||||
{
|
{
|
||||||
//Read the following wxASSERTs as documentating a design decision
|
//Read the following wxASSERTs as documentating a design decision
|
||||||
wxASSERT( selectTool == selectTool - firstTool );
|
wxASSERT( selectTool == selectTool - firstTool );
|
||||||
@ -148,7 +148,8 @@ void ToolsToolBar::RegenerateTooltips()
|
|||||||
for (const auto &entry : table) {
|
for (const auto &entry : table) {
|
||||||
TranslatedInternalString command{
|
TranslatedInternalString command{
|
||||||
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
|
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
|
||||||
ToolBar::SetButtonToolTip( *mTool[entry.tool], &command, 1u );
|
ToolBar::SetButtonToolTip( mProject,
|
||||||
|
*mTool[entry.tool], &command, 1u );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -276,3 +277,8 @@ void ToolsToolBar::Create(wxWindow * parent)
|
|||||||
ToolBar::Create(parent);
|
ToolBar::Create(parent);
|
||||||
UpdatePrefs();
|
UpdatePrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ ToolsBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew ToolsToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -49,7 +49,7 @@ class ToolsToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ToolsToolBar();
|
ToolsToolBar( AudacityProject &project );
|
||||||
virtual ~ToolsToolBar();
|
virtual ~ToolsToolBar();
|
||||||
|
|
||||||
static ToolsToolBar &Get( AudacityProject &project );
|
static ToolsToolBar &Get( AudacityProject &project );
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "ControlToolBar.h"
|
#include "ControlToolBar.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../AudioIOBase.h"
|
#include "../AudioIO.h"
|
||||||
#include "../ImageManipulation.h"
|
#include "../ImageManipulation.h"
|
||||||
#include "../KeyboardCapture.h"
|
#include "../KeyboardCapture.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
@ -94,8 +94,9 @@ END_EVENT_TABLE()
|
|||||||
; //semicolon enforces proper automatic indenting in emacs.
|
; //semicolon enforces proper automatic indenting in emacs.
|
||||||
|
|
||||||
////Standard Constructor
|
////Standard Constructor
|
||||||
TranscriptionToolBar::TranscriptionToolBar()
|
TranscriptionToolBar::TranscriptionToolBar( AudacityProject &project )
|
||||||
: ToolBar(TranscriptionBarID, _("Play-at-Speed"), wxT("Transcription"),true)
|
: ToolBar( project,
|
||||||
|
TranscriptionBarID, _("Play-at-Speed"), wxT("Transcription"), true )
|
||||||
{
|
{
|
||||||
mPlaySpeed = 1.0 * 100.0;
|
mPlaySpeed = 1.0 * 100.0;
|
||||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||||
@ -288,8 +289,20 @@ void TranscriptionToolBar::Populate()
|
|||||||
|
|
||||||
void TranscriptionToolBar::EnableDisableButtons()
|
void TranscriptionToolBar::EnableDisableButtons()
|
||||||
{
|
{
|
||||||
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
|
auto gAudioIO = AudioIO::Get();
|
||||||
|
bool canStopAudioStream = (!gAudioIO->IsStreamActive() ||
|
||||||
|
gAudioIO->IsMonitoring() ||
|
||||||
|
gAudioIO->GetOwningProject() == p );
|
||||||
|
bool recording = gAudioIO->GetNumCaptureChannels() > 0;
|
||||||
|
|
||||||
|
// Only interested in audio type tracks
|
||||||
|
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
|
||||||
|
SetEnabled( canStopAudioStream && tracks && !recording );
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
// Is anything selected?
|
// Is anything selected?
|
||||||
auto selection = p->GetSel0() < p->GetSel1() && p->GetTracks()->Selected();
|
auto selection = p->GetSel0() < p->GetSel1() && p->GetTracks()->Selected();
|
||||||
@ -331,7 +344,8 @@ void TranscriptionToolBar::RegenerateTooltips()
|
|||||||
{ entry.commandName, wxGetTranslation(entry.untranslatedLabel) },
|
{ entry.commandName, wxGetTranslation(entry.untranslatedLabel) },
|
||||||
{ entry.commandName2, wxGetTranslation(entry.untranslatedLabel2) },
|
{ entry.commandName2, wxGetTranslation(entry.untranslatedLabel2) },
|
||||||
};
|
};
|
||||||
ToolBar::SetButtonToolTip( *mButtons[entry.tool], commands, 2u );
|
ToolBar::SetButtonToolTip( mProject,
|
||||||
|
*mButtons[entry.tool], commands, 2u );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||||
@ -410,7 +424,7 @@ void TranscriptionToolBar::GetSamples(
|
|||||||
// GetSamples attempts to translate the start and end selection markers into sample indices
|
// GetSamples attempts to translate the start and end selection markers into sample indices
|
||||||
// These selection numbers are doubles.
|
// These selection numbers are doubles.
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) {
|
if (!p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -453,7 +467,7 @@ void TranscriptionToolBar::GetSamples(
|
|||||||
void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
|
void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
|
||||||
{
|
{
|
||||||
// Can't do anything without an active project
|
// Can't do anything without an active project
|
||||||
AudacityProject * p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
if (!p) {
|
if (!p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,7 +574,7 @@ void TranscriptionToolBar::OnStartOn(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
||||||
if(t ) {
|
if(t ) {
|
||||||
@ -592,7 +606,7 @@ void TranscriptionToolBar::OnStartOff(wxCommandEvent & WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
SetButton(false, mButtons[TTB_StartOff]);
|
SetButton(false, mButtons[TTB_StartOff]);
|
||||||
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
||||||
@ -627,7 +641,7 @@ void TranscriptionToolBar::OnEndOn(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
||||||
if(t) {
|
if(t) {
|
||||||
auto wt = static_cast<const WaveTrack*>(t);
|
auto wt = static_cast<const WaveTrack*>(t);
|
||||||
@ -662,7 +676,7 @@ void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
auto t = *p->GetTracks()->Any< const WaveTrack >().begin();
|
||||||
if(t) {
|
if(t) {
|
||||||
@ -699,7 +713,7 @@ void TranscriptionToolBar::OnSelectSound(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
|
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
|
|
||||||
TrackList *tl = p->GetTracks();
|
TrackList *tl = p->GetTracks();
|
||||||
@ -738,7 +752,7 @@ void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
|
|
||||||
TrackList *tl = p->GetTracks();
|
TrackList *tl = p->GetTracks();
|
||||||
@ -777,7 +791,7 @@ void TranscriptionToolBar::OnCalibrate(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
|
|
||||||
TrackList *tl = p->GetTracks();
|
TrackList *tl = p->GetTracks();
|
||||||
if(auto wt = *tl->Any<const WaveTrack>().begin()) {
|
if(auto wt = *tl->Any<const WaveTrack>().begin()) {
|
||||||
@ -828,7 +842,7 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event))
|
|||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
|
|
||||||
mVk->AdjustThreshold(GetSensitivity());
|
mVk->AdjustThreshold(GetSensitivity());
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
TrackList *tl = p->GetTracks();
|
TrackList *tl = p->GetTracks();
|
||||||
if(auto wt = *tl->Any<const WaveTrack>().begin()) {
|
if(auto wt = *tl->Any<const WaveTrack>().begin()) {
|
||||||
sampleCount start, len;
|
sampleCount start, len;
|
||||||
@ -899,7 +913,7 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
void TranscriptionToolBar::OnMakeLabel(wxCommandEvent & WXUNUSED(event))
|
void TranscriptionToolBar::OnMakeLabel(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = &mProject;
|
||||||
SetButton(false, mButtons[TTB_MakeLabel]);
|
SetButton(false, mButtons[TTB_MakeLabel]);
|
||||||
p->DoAddLabel(SelectedRegion(p->GetSel0(), p->GetSel1()));
|
p->DoAddLabel(SelectedRegion(p->GetSel0(), p->GetSel1()));
|
||||||
}
|
}
|
||||||
@ -980,3 +994,7 @@ void TranscriptionToolBar::AdjustPlaySpeed(float adj)
|
|||||||
OnSpeedSlider(e);
|
OnSpeedSlider(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RegisteredToolbarFactory factory{ TranscriptionBarID,
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
return ToolBar::Holder{ safenew TranscriptionToolBar{ project } }; }
|
||||||
|
};
|
||||||
|
@ -65,7 +65,7 @@ class TranscriptionToolBar final : public ToolBar {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TranscriptionToolBar();
|
TranscriptionToolBar( AudacityProject &project );
|
||||||
virtual ~TranscriptionToolBar();
|
virtual ~TranscriptionToolBar();
|
||||||
|
|
||||||
static TranscriptionToolBar &Get( AudacityProject &project );
|
static TranscriptionToolBar &Get( AudacityProject &project );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user