mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
Separate source files for ScrubbingToolBar
This commit is contained in:
parent
cf79f91da0
commit
6a4d6ceeda
@ -1215,6 +1215,7 @@
|
|||||||
5ED1D0AD1CDE55BD00471E3C /* Overlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */; };
|
5ED1D0AD1CDE55BD00471E3C /* Overlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */; };
|
||||||
5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; };
|
5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; };
|
||||||
5ED1D0B11CDE560C00471E3C /* BackedPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */; };
|
5ED1D0B11CDE560C00471E3C /* BackedPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */; };
|
||||||
|
5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */; };
|
||||||
8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; };
|
8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; };
|
||||||
8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; };
|
8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; };
|
||||||
ED15214D163C22F000451B5F /* lsr.c in Sources */ = {isa = PBXBuildFile; fileRef = ED152123163C220300451B5F /* lsr.c */; };
|
ED15214D163C22F000451B5F /* lsr.c in Sources */ = {isa = PBXBuildFile; fileRef = ED152123163C220300451B5F /* lsr.c */; };
|
||||||
@ -2994,6 +2995,8 @@
|
|||||||
5ED1D0AC1CDE55BD00471E3C /* OverlayPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayPanel.h; sourceTree = "<group>"; };
|
5ED1D0AC1CDE55BD00471E3C /* OverlayPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayPanel.h; sourceTree = "<group>"; };
|
||||||
5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackedPanel.cpp; sourceTree = "<group>"; };
|
5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackedPanel.cpp; sourceTree = "<group>"; };
|
||||||
5ED1D0B01CDE560C00471E3C /* BackedPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackedPanel.h; sourceTree = "<group>"; };
|
5ED1D0B01CDE560C00471E3C /* BackedPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackedPanel.h; sourceTree = "<group>"; };
|
||||||
|
5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrubbingToolBar.cpp; sourceTree = "<group>"; };
|
||||||
|
5EF17C221D1F0A690090A642 /* ScrubbingToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrubbingToolBar.h; sourceTree = "<group>"; };
|
||||||
82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = "<group>"; };
|
82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = "<group>"; };
|
||||||
82FF184E13CF01A600C1B664 /* dBTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dBTable.h; path = sbsms/src/dBTable.h; sourceTree = "<group>"; };
|
82FF184E13CF01A600C1B664 /* dBTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dBTable.h; path = sbsms/src/dBTable.h; sourceTree = "<group>"; };
|
||||||
82FF184F13CF01A600C1B664 /* slide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slide.cpp; path = sbsms/src/slide.cpp; sourceTree = "<group>"; };
|
82FF184F13CF01A600C1B664 /* slide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slide.cpp; path = sbsms/src/slide.cpp; sourceTree = "<group>"; };
|
||||||
@ -5224,9 +5227,6 @@
|
|||||||
2897F6DB0AB3DB5A003C20C5 /* toolbars */ = {
|
2897F6DB0AB3DB5A003C20C5 /* toolbars */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
28001B481A0F0EB6007DD161 /* SpectralSelectionBar.cpp */,
|
|
||||||
28001B491A0F0EB6007DD161 /* SpectralSelectionBar.h */,
|
|
||||||
28001B4A1A0F0EB6007DD161 /* SpectralSelectionBarListener.h */,
|
|
||||||
2897F6DC0AB3DB5A003C20C5 /* ControlToolBar.cpp */,
|
2897F6DC0AB3DB5A003C20C5 /* ControlToolBar.cpp */,
|
||||||
2897F6DD0AB3DB5A003C20C5 /* ControlToolBar.h */,
|
2897F6DD0AB3DB5A003C20C5 /* ControlToolBar.h */,
|
||||||
289F9C7C0AC671BB00797DC1 /* DeviceToolBar.cpp */,
|
289F9C7C0AC671BB00797DC1 /* DeviceToolBar.cpp */,
|
||||||
@ -5237,9 +5237,14 @@
|
|||||||
2897F6E10AB3DB5A003C20C5 /* MeterToolBar.h */,
|
2897F6E10AB3DB5A003C20C5 /* MeterToolBar.h */,
|
||||||
2897F6E20AB3DB5A003C20C5 /* MixerToolBar.cpp */,
|
2897F6E20AB3DB5A003C20C5 /* MixerToolBar.cpp */,
|
||||||
2897F6E30AB3DB5A003C20C5 /* MixerToolBar.h */,
|
2897F6E30AB3DB5A003C20C5 /* MixerToolBar.h */,
|
||||||
|
5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */,
|
||||||
|
5EF17C221D1F0A690090A642 /* ScrubbingToolBar.h */,
|
||||||
2897F6E40AB3DB5A003C20C5 /* SelectionBar.cpp */,
|
2897F6E40AB3DB5A003C20C5 /* SelectionBar.cpp */,
|
||||||
2897F6E50AB3DB5A003C20C5 /* SelectionBar.h */,
|
2897F6E50AB3DB5A003C20C5 /* SelectionBar.h */,
|
||||||
2803C8BB19F35B4900278526 /* SelectionBarListener.h */,
|
2803C8BB19F35B4900278526 /* SelectionBarListener.h */,
|
||||||
|
28001B481A0F0EB6007DD161 /* SpectralSelectionBar.cpp */,
|
||||||
|
28001B491A0F0EB6007DD161 /* SpectralSelectionBar.h */,
|
||||||
|
28001B4A1A0F0EB6007DD161 /* SpectralSelectionBarListener.h */,
|
||||||
2897F6E60AB3DB5A003C20C5 /* ToolBar.cpp */,
|
2897F6E60AB3DB5A003C20C5 /* ToolBar.cpp */,
|
||||||
2897F6E70AB3DB5A003C20C5 /* ToolBar.h */,
|
2897F6E70AB3DB5A003C20C5 /* ToolBar.h */,
|
||||||
2897F6E80AB3DB5A003C20C5 /* ToolDock.cpp */,
|
2897F6E80AB3DB5A003C20C5 /* ToolDock.cpp */,
|
||||||
@ -7323,6 +7328,7 @@
|
|||||||
1790B12E09883BFD008A330A /* Amplify.cpp in Sources */,
|
1790B12E09883BFD008A330A /* Amplify.cpp in Sources */,
|
||||||
1790B13409883BFD008A330A /* ChangePitch.cpp in Sources */,
|
1790B13409883BFD008A330A /* ChangePitch.cpp in Sources */,
|
||||||
1790B13509883BFD008A330A /* ChangeSpeed.cpp in Sources */,
|
1790B13509883BFD008A330A /* ChangeSpeed.cpp in Sources */,
|
||||||
|
5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */,
|
||||||
1790B13609883BFD008A330A /* ChangeTempo.cpp in Sources */,
|
1790B13609883BFD008A330A /* ChangeTempo.cpp in Sources */,
|
||||||
1790B13709883BFD008A330A /* ClickRemoval.cpp in Sources */,
|
1790B13709883BFD008A330A /* ClickRemoval.cpp in Sources */,
|
||||||
1790B13809883BFD008A330A /* Compressor.cpp in Sources */,
|
1790B13809883BFD008A330A /* Compressor.cpp in Sources */,
|
||||||
|
@ -513,6 +513,8 @@ audacity_SOURCES = \
|
|||||||
toolbars/MeterToolBar.h \
|
toolbars/MeterToolBar.h \
|
||||||
toolbars/MixerToolBar.cpp \
|
toolbars/MixerToolBar.cpp \
|
||||||
toolbars/MixerToolBar.h \
|
toolbars/MixerToolBar.h \
|
||||||
|
toolbars/ScrubbingToolBar.cpp \
|
||||||
|
toolbars/ScrubbingToolBar.h \
|
||||||
toolbars/SelectionBar.cpp \
|
toolbars/SelectionBar.cpp \
|
||||||
toolbars/SelectionBar.h \
|
toolbars/SelectionBar.h \
|
||||||
toolbars/SpectralSelectionBar.cpp \
|
toolbars/SpectralSelectionBar.cpp \
|
||||||
|
@ -151,6 +151,7 @@ scroll information. It also has some status flags.
|
|||||||
#include "toolbars/EditToolBar.h"
|
#include "toolbars/EditToolBar.h"
|
||||||
#include "toolbars/MeterToolBar.h"
|
#include "toolbars/MeterToolBar.h"
|
||||||
#include "toolbars/MixerToolBar.h"
|
#include "toolbars/MixerToolBar.h"
|
||||||
|
#include "toolbars/ScrubbingToolBar.h"
|
||||||
#include "toolbars/SelectionBar.h"
|
#include "toolbars/SelectionBar.h"
|
||||||
#include "toolbars/SpectralSelectionBar.h"
|
#include "toolbars/SpectralSelectionBar.h"
|
||||||
#include "toolbars/ToolsToolBar.h"
|
#include "toolbars/ToolsToolBar.h"
|
||||||
|
@ -346,246 +346,3 @@ void EditToolBar::EnableDisableButtons()
|
|||||||
mButtons[ETBSyncLockID]->PopUp();
|
mButtons[ETBSyncLockID]->PopUp();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PRL: to do: move the below to its own file
|
|
||||||
// Much of this is imitative of EditToolBar. Should there be a common base
|
|
||||||
// class?
|
|
||||||
#include "../Audacity.h"
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
|
||||||
#include <wx/wxprec.h>
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include <wx/event.h>
|
|
||||||
#include <wx/image.h>
|
|
||||||
#include <wx/intl.h>
|
|
||||||
#include <wx/sizer.h>
|
|
||||||
#include <wx/tooltip.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../AllThemeResources.h"
|
|
||||||
#include "../AudioIO.h"
|
|
||||||
#include "../ImageManipulation.h"
|
|
||||||
#include "../Internat.h"
|
|
||||||
#include "../Prefs.h"
|
|
||||||
#include "../Project.h"
|
|
||||||
#include "../Theme.h"
|
|
||||||
#include "../Track.h"
|
|
||||||
#include "../UndoManager.h"
|
|
||||||
#include "../widgets/AButton.h"
|
|
||||||
#include "../widgets/Ruler.h"
|
|
||||||
#include "../tracks/ui/Scrubbing.h"
|
|
||||||
|
|
||||||
#include "../Experimental.h"
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(ScrubbingToolBar, ToolBar);
|
|
||||||
|
|
||||||
//const int BUTTON_WIDTH = 27;
|
|
||||||
//const int SEPARATOR_WIDTH = 14;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Methods for ScrubbingToolBar
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( ScrubbingToolBar, ToolBar )
|
|
||||||
EVT_COMMAND_RANGE( STBFirstButton,
|
|
||||||
STBFirstButton + STBNumButtons - 1,
|
|
||||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
|
||||||
ScrubbingToolBar::OnButton )
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
//Standard contructor
|
|
||||||
ScrubbingToolBar::ScrubbingToolBar()
|
|
||||||
: ToolBar(ScrubbingBarID, _("Scrub"), wxT("Scrub"))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrubbingToolBar::~ScrubbingToolBar()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::Create(wxWindow * parent)
|
|
||||||
{
|
|
||||||
ToolBar::Create(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This is a convenience function that allows for button creation in
|
|
||||||
/// MakeButtons() with fewer arguments
|
|
||||||
/// Very similar to code in ControlToolBar...
|
|
||||||
AButton *ScrubbingToolBar::AddButton
|
|
||||||
(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
|
||||||
int id,
|
|
||||||
const wxChar *label,
|
|
||||||
bool toggle)
|
|
||||||
{
|
|
||||||
AButton *&r = mButtons[id];
|
|
||||||
|
|
||||||
r = ToolBar::MakeButton
|
|
||||||
(this,
|
|
||||||
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
|
|
||||||
eEnabledUp, eEnabledDown, eDisabled,
|
|
||||||
wxWindowID(id),
|
|
||||||
wxDefaultPosition,
|
|
||||||
toggle,
|
|
||||||
theTheme.ImageSize( bmpRecoloredUpSmall ));
|
|
||||||
|
|
||||||
r->SetLabel(label);
|
|
||||||
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
|
|
||||||
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
|
|
||||||
|
|
||||||
Add( r, 0, wxALIGN_CENTER );
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::Populate()
|
|
||||||
{
|
|
||||||
MakeButtonBackgroundsSmall();
|
|
||||||
|
|
||||||
/* Buttons */
|
|
||||||
AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
|
|
||||||
_("Scrub"), true);
|
|
||||||
AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
|
|
||||||
_("Seek"), true);
|
|
||||||
AddButton(bmpToggleScrubBar, bmpToggleScrubBar, bmpToggleScrubBar,
|
|
||||||
STBBarID,
|
|
||||||
_("Scrub bar"), true);
|
|
||||||
|
|
||||||
|
|
||||||
RegenerateTooltips();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::UpdatePrefs()
|
|
||||||
{
|
|
||||||
RegenerateTooltips();
|
|
||||||
|
|
||||||
// Set label to pull in language change
|
|
||||||
SetLabel(_("Scrubbing"));
|
|
||||||
|
|
||||||
// Give base class a chance
|
|
||||||
ToolBar::UpdatePrefs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::RegenerateTooltips()
|
|
||||||
{
|
|
||||||
#if wxUSE_TOOLTIPS
|
|
||||||
std::vector<wxString> commands;
|
|
||||||
auto fn = [&]
|
|
||||||
(AButton &button, const wxString &label, const wxString &command)
|
|
||||||
{
|
|
||||||
commands.clear();
|
|
||||||
commands.push_back(label);
|
|
||||||
commands.push_back(command);
|
|
||||||
ToolBar::SetButtonToolTip(button, commands);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto project = GetActiveProject();
|
|
||||||
if (project) {
|
|
||||||
auto &scrubber = project->GetScrubber();
|
|
||||||
|
|
||||||
const auto scrubButton = mButtons[STBScrubID];
|
|
||||||
const auto seekButton = mButtons[STBSeekID];
|
|
||||||
|
|
||||||
wxString label;
|
|
||||||
label = (
|
|
||||||
scrubber.Scrubs()
|
|
||||||
/* i18n-hint: These commands assist the user in finding a sound by ear. ...
|
|
||||||
"Scrubbing" is variable-speed playback, ...
|
|
||||||
"Seeking" is normal speed playback but with skips
|
|
||||||
*/
|
|
||||||
? _("Stop Scrubbing")
|
|
||||||
: _("Start Scrubbing")
|
|
||||||
);
|
|
||||||
fn(*scrubButton, label, wxT("Scrub"));
|
|
||||||
|
|
||||||
label = (
|
|
||||||
scrubber.Seeks()
|
|
||||||
/* i18n-hint: These commands assist the user in finding a sound by ear. ...
|
|
||||||
"Scrubbing" is variable-speed playback, ...
|
|
||||||
"Seeking" is normal speed playback but with skips
|
|
||||||
*/
|
|
||||||
? _("Stop Seeking")
|
|
||||||
: _("Start Seeking")
|
|
||||||
);
|
|
||||||
fn(*seekButton, label, wxT("Seek"));
|
|
||||||
|
|
||||||
label = (
|
|
||||||
project->GetRulerPanel()->ShowingScrubBar()
|
|
||||||
? _("Hide Scrub Bar")
|
|
||||||
: _("Show Scrub Bar")
|
|
||||||
);
|
|
||||||
fn(*mButtons[STBBarID], label, wxT("ToggleScrubBar"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
|
||||||
{
|
|
||||||
AudacityProject *p = GetActiveProject();
|
|
||||||
if (!p) return;
|
|
||||||
auto &scrubber = p->GetScrubber();
|
|
||||||
|
|
||||||
int id = event.GetId();
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case STBScrubID:
|
|
||||||
scrubber.OnScrub(event);
|
|
||||||
break;
|
|
||||||
case STBSeekID:
|
|
||||||
scrubber.OnSeek(event);
|
|
||||||
break;
|
|
||||||
case STBBarID:
|
|
||||||
scrubber.OnToggleScrubBar(event);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
wxASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableDisableButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrubbingToolBar::EnableDisableButtons()
|
|
||||||
{
|
|
||||||
const auto scrubButton = mButtons[STBScrubID];
|
|
||||||
scrubButton->SetEnabled(true);
|
|
||||||
const auto seekButton = mButtons[STBSeekID];
|
|
||||||
seekButton->SetEnabled(true);
|
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
|
||||||
if (!p) return;
|
|
||||||
|
|
||||||
auto &scrubber = p->GetScrubber();
|
|
||||||
const auto canScrub = scrubber.CanScrub();
|
|
||||||
|
|
||||||
if (scrubber.Scrubs()) {
|
|
||||||
scrubButton->PushDown();
|
|
||||||
scrubButton->Enable();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scrubButton->PopUp();
|
|
||||||
if (canScrub)
|
|
||||||
scrubButton->Enable();
|
|
||||||
else
|
|
||||||
scrubButton->Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrubber.Seeks()) {
|
|
||||||
seekButton->PushDown();
|
|
||||||
seekButton->Enable();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
seekButton->PopUp();
|
|
||||||
if (canScrub)
|
|
||||||
seekButton->Enable();
|
|
||||||
else
|
|
||||||
seekButton->Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto barButton = mButtons[STBBarID];
|
|
||||||
barButton->Enable();
|
|
||||||
if (p->GetRulerPanel()->ShowingScrubBar())
|
|
||||||
barButton->PushDown();
|
|
||||||
else
|
|
||||||
barButton->PopUp();
|
|
||||||
}
|
|
||||||
|
@ -97,67 +97,5 @@ class EditToolBar final : public ToolBar {
|
|||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
// PRL: to do: move this to its own file
|
|
||||||
|
|
||||||
#include <wx/defs.h>
|
|
||||||
|
|
||||||
#include "ToolBar.h"
|
|
||||||
#include "../Theme.h"
|
|
||||||
#include "../Experimental.h"
|
|
||||||
|
|
||||||
class wxCommandEvent;
|
|
||||||
class wxDC;
|
|
||||||
class wxImage;
|
|
||||||
class wxWindow;
|
|
||||||
|
|
||||||
class AButton;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
STBScrubID,
|
|
||||||
STBSeekID,
|
|
||||||
STBBarID,
|
|
||||||
|
|
||||||
STBNumButtons,
|
|
||||||
STBFirstButton = STBScrubID
|
|
||||||
};
|
|
||||||
|
|
||||||
class ScrubbingToolBar final : public ToolBar {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ScrubbingToolBar();
|
|
||||||
virtual ~ScrubbingToolBar();
|
|
||||||
|
|
||||||
void Create(wxWindow *parent);
|
|
||||||
|
|
||||||
void OnButton(wxCommandEvent & event);
|
|
||||||
|
|
||||||
void Populate();
|
|
||||||
void Repaint(wxDC * WXUNUSED(dc)) {};
|
|
||||||
void EnableDisableButtons() override;
|
|
||||||
void UpdatePrefs() override;
|
|
||||||
|
|
||||||
void RegenerateTooltips() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
|
||||||
int id, const wxChar *label, bool toggle = false);
|
|
||||||
|
|
||||||
void MakeButtons();
|
|
||||||
|
|
||||||
AButton *mButtons[STBNumButtons];
|
|
||||||
|
|
||||||
wxImage *upImage;
|
|
||||||
wxImage *downImage;
|
|
||||||
wxImage *hiliteImage;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DECLARE_CLASS(EditToolBar);
|
|
||||||
DECLARE_EVENT_TABLE();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
253
src/toolbars/ScrubbingToolBar.cpp
Normal file
253
src/toolbars/ScrubbingToolBar.cpp
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
ScrubbingToolBar.cpp
|
||||||
|
|
||||||
|
Paul Licameli
|
||||||
|
|
||||||
|
See ScrubbingToolBar.h for details
|
||||||
|
|
||||||
|
*******************************************************************/
|
||||||
|
|
||||||
|
// Much of this is imitative of EditToolBar. Should there be a common base
|
||||||
|
// class?
|
||||||
|
#include "../Audacity.h"
|
||||||
|
#include "ScrubbingToolBar.h"
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/event.h>
|
||||||
|
#include <wx/image.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/tooltip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../AllThemeResources.h"
|
||||||
|
#include "../AudioIO.h"
|
||||||
|
#include "../ImageManipulation.h"
|
||||||
|
#include "../Internat.h"
|
||||||
|
#include "../Prefs.h"
|
||||||
|
#include "../Project.h"
|
||||||
|
#include "../Theme.h"
|
||||||
|
#include "../Track.h"
|
||||||
|
#include "../UndoManager.h"
|
||||||
|
#include "../widgets/AButton.h"
|
||||||
|
#include "../widgets/Ruler.h"
|
||||||
|
#include "../tracks/ui/Scrubbing.h"
|
||||||
|
|
||||||
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(ScrubbingToolBar, ToolBar);
|
||||||
|
|
||||||
|
//const int BUTTON_WIDTH = 27;
|
||||||
|
//const int SEPARATOR_WIDTH = 14;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// Methods for ScrubbingToolBar
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( ScrubbingToolBar, ToolBar )
|
||||||
|
EVT_COMMAND_RANGE( STBFirstButton,
|
||||||
|
STBFirstButton + STBNumButtons - 1,
|
||||||
|
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||||
|
ScrubbingToolBar::OnButton )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
//Standard contructor
|
||||||
|
ScrubbingToolBar::ScrubbingToolBar()
|
||||||
|
: ToolBar(ScrubbingBarID, _("Scrub"), wxT("Scrub"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrubbingToolBar::~ScrubbingToolBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::Create(wxWindow * parent)
|
||||||
|
{
|
||||||
|
ToolBar::Create(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is a convenience function that allows for button creation in
|
||||||
|
/// MakeButtons() with fewer arguments
|
||||||
|
/// Very similar to code in ControlToolBar...
|
||||||
|
AButton *ScrubbingToolBar::AddButton
|
||||||
|
(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||||
|
int id,
|
||||||
|
const wxChar *label,
|
||||||
|
bool toggle)
|
||||||
|
{
|
||||||
|
AButton *&r = mButtons[id];
|
||||||
|
|
||||||
|
r = ToolBar::MakeButton
|
||||||
|
(this,
|
||||||
|
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
|
||||||
|
eEnabledUp, eEnabledDown, eDisabled,
|
||||||
|
wxWindowID(id),
|
||||||
|
wxDefaultPosition,
|
||||||
|
toggle,
|
||||||
|
theTheme.ImageSize( bmpRecoloredUpSmall ));
|
||||||
|
|
||||||
|
r->SetLabel(label);
|
||||||
|
// JKC: Unlike ControlToolBar, does not have a focus rect. Shouldn't it?
|
||||||
|
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );
|
||||||
|
|
||||||
|
Add( r, 0, wxALIGN_CENTER );
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::Populate()
|
||||||
|
{
|
||||||
|
MakeButtonBackgroundsSmall();
|
||||||
|
|
||||||
|
/* Buttons */
|
||||||
|
AddButton(bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
|
||||||
|
_("Scrub"), true);
|
||||||
|
AddButton(bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
|
||||||
|
_("Seek"), true);
|
||||||
|
AddButton(bmpToggleScrubBar, bmpToggleScrubBar, bmpToggleScrubBar,
|
||||||
|
STBBarID,
|
||||||
|
_("Scrub bar"), true);
|
||||||
|
|
||||||
|
|
||||||
|
RegenerateTooltips();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::UpdatePrefs()
|
||||||
|
{
|
||||||
|
RegenerateTooltips();
|
||||||
|
|
||||||
|
// Set label to pull in language change
|
||||||
|
SetLabel(_("Scrubbing"));
|
||||||
|
|
||||||
|
// Give base class a chance
|
||||||
|
ToolBar::UpdatePrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::RegenerateTooltips()
|
||||||
|
{
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
std::vector<wxString> commands;
|
||||||
|
auto fn = [&]
|
||||||
|
(AButton &button, const wxString &label, const wxString &command)
|
||||||
|
{
|
||||||
|
commands.clear();
|
||||||
|
commands.push_back(label);
|
||||||
|
commands.push_back(command);
|
||||||
|
ToolBar::SetButtonToolTip(button, commands);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto project = GetActiveProject();
|
||||||
|
if (project) {
|
||||||
|
auto &scrubber = project->GetScrubber();
|
||||||
|
|
||||||
|
const auto scrubButton = mButtons[STBScrubID];
|
||||||
|
const auto seekButton = mButtons[STBSeekID];
|
||||||
|
|
||||||
|
wxString label;
|
||||||
|
label = (
|
||||||
|
scrubber.Scrubs()
|
||||||
|
/* i18n-hint: These commands assist the user in finding a sound by ear. ...
|
||||||
|
"Scrubbing" is variable-speed playback, ...
|
||||||
|
"Seeking" is normal speed playback but with skips
|
||||||
|
*/
|
||||||
|
? _("Stop Scrubbing")
|
||||||
|
: _("Start Scrubbing")
|
||||||
|
);
|
||||||
|
fn(*scrubButton, label, wxT("Scrub"));
|
||||||
|
|
||||||
|
label = (
|
||||||
|
scrubber.Seeks()
|
||||||
|
/* i18n-hint: These commands assist the user in finding a sound by ear. ...
|
||||||
|
"Scrubbing" is variable-speed playback, ...
|
||||||
|
"Seeking" is normal speed playback but with skips
|
||||||
|
*/
|
||||||
|
? _("Stop Seeking")
|
||||||
|
: _("Start Seeking")
|
||||||
|
);
|
||||||
|
fn(*seekButton, label, wxT("Seek"));
|
||||||
|
|
||||||
|
label = (
|
||||||
|
project->GetRulerPanel()->ShowingScrubBar()
|
||||||
|
? _("Hide Scrub Bar")
|
||||||
|
: _("Show Scrub Bar")
|
||||||
|
);
|
||||||
|
fn(*mButtons[STBBarID], label, wxT("ToggleScrubBar"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
||||||
|
{
|
||||||
|
AudacityProject *p = GetActiveProject();
|
||||||
|
if (!p) return;
|
||||||
|
auto &scrubber = p->GetScrubber();
|
||||||
|
|
||||||
|
int id = event.GetId();
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case STBScrubID:
|
||||||
|
scrubber.OnScrub(event);
|
||||||
|
break;
|
||||||
|
case STBSeekID:
|
||||||
|
scrubber.OnSeek(event);
|
||||||
|
break;
|
||||||
|
case STBBarID:
|
||||||
|
scrubber.OnToggleScrubBar(event);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wxASSERT(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnableDisableButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::EnableDisableButtons()
|
||||||
|
{
|
||||||
|
const auto scrubButton = mButtons[STBScrubID];
|
||||||
|
scrubButton->SetEnabled(true);
|
||||||
|
const auto seekButton = mButtons[STBSeekID];
|
||||||
|
seekButton->SetEnabled(true);
|
||||||
|
|
||||||
|
AudacityProject *p = GetActiveProject();
|
||||||
|
if (!p) return;
|
||||||
|
|
||||||
|
auto &scrubber = p->GetScrubber();
|
||||||
|
const auto canScrub = scrubber.CanScrub();
|
||||||
|
|
||||||
|
if (scrubber.Scrubs()) {
|
||||||
|
scrubButton->PushDown();
|
||||||
|
scrubButton->Enable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scrubButton->PopUp();
|
||||||
|
if (canScrub)
|
||||||
|
scrubButton->Enable();
|
||||||
|
else
|
||||||
|
scrubButton->Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scrubber.Seeks()) {
|
||||||
|
seekButton->PushDown();
|
||||||
|
seekButton->Enable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
seekButton->PopUp();
|
||||||
|
if (canScrub)
|
||||||
|
seekButton->Enable();
|
||||||
|
else
|
||||||
|
seekButton->Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto barButton = mButtons[STBBarID];
|
||||||
|
barButton->Enable();
|
||||||
|
if (p->GetRulerPanel()->ShowingScrubBar())
|
||||||
|
barButton->PushDown();
|
||||||
|
else
|
||||||
|
barButton->PopUp();
|
||||||
|
}
|
76
src/toolbars/ScrubbingToolBar.h
Normal file
76
src/toolbars/ScrubbingToolBar.h
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
|
||||||
|
ScrubbingToolbar.h
|
||||||
|
|
||||||
|
Paul Licameli
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_SCRUBBING_TOOLBAR__
|
||||||
|
#define __AUDACITY_SCRUBBING_TOOLBAR__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <wx/defs.h>
|
||||||
|
|
||||||
|
#include "ToolBar.h"
|
||||||
|
#include "../Theme.h"
|
||||||
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
class wxCommandEvent;
|
||||||
|
class wxDC;
|
||||||
|
class wxImage;
|
||||||
|
class wxWindow;
|
||||||
|
|
||||||
|
class AButton;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
STBScrubID,
|
||||||
|
STBSeekID,
|
||||||
|
STBBarID,
|
||||||
|
|
||||||
|
STBNumButtons,
|
||||||
|
STBFirstButton = STBScrubID
|
||||||
|
};
|
||||||
|
|
||||||
|
class ScrubbingToolBar final : public ToolBar {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ScrubbingToolBar();
|
||||||
|
virtual ~ScrubbingToolBar();
|
||||||
|
|
||||||
|
void Create(wxWindow *parent);
|
||||||
|
|
||||||
|
void OnButton(wxCommandEvent & event);
|
||||||
|
|
||||||
|
void Populate();
|
||||||
|
void Repaint(wxDC * WXUNUSED(dc)) {};
|
||||||
|
void EnableDisableButtons() override;
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
|
void RegenerateTooltips() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||||
|
int id, const wxChar *label, bool toggle = false);
|
||||||
|
|
||||||
|
void MakeButtons();
|
||||||
|
|
||||||
|
AButton *mButtons[STBNumButtons];
|
||||||
|
|
||||||
|
wxImage *upImage;
|
||||||
|
wxImage *downImage;
|
||||||
|
wxImage *hiliteImage;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DECLARE_CLASS(EditToolBar);
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -53,6 +53,7 @@
|
|||||||
#include "EditToolBar.h"
|
#include "EditToolBar.h"
|
||||||
#include "MeterToolBar.h"
|
#include "MeterToolBar.h"
|
||||||
#include "MixerToolBar.h"
|
#include "MixerToolBar.h"
|
||||||
|
#include "ScrubbingToolBar.h"
|
||||||
#include "SelectionBar.h"
|
#include "SelectionBar.h"
|
||||||
#include "SpectralSelectionBar.h"
|
#include "SpectralSelectionBar.h"
|
||||||
#include "ToolsToolBar.h"
|
#include "ToolsToolBar.h"
|
||||||
|
@ -21,7 +21,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../commands/CommandFunctors.h"
|
#include "../../commands/CommandFunctors.h"
|
||||||
#include "../../prefs/PlaybackPrefs.h"
|
#include "../../prefs/PlaybackPrefs.h"
|
||||||
#include "../../toolbars/ControlToolBar.h"
|
#include "../../toolbars/ControlToolBar.h"
|
||||||
#include "../../toolbars/EditToolBar.h"
|
#include "../../toolbars/ScrubbingToolBar.h"
|
||||||
#include "../../toolbars/ToolManager.h"
|
#include "../../toolbars/ToolManager.h"
|
||||||
|
|
||||||
#undef USE_TRANSCRIPTION_TOOLBAR
|
#undef USE_TRANSCRIPTION_TOOLBAR
|
||||||
|
@ -212,6 +212,7 @@
|
|||||||
<ClCompile Include="..\..\..\src\TimeDialog.cpp" />
|
<ClCompile Include="..\..\..\src\TimeDialog.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\TimerRecordDialog.cpp" />
|
<ClCompile Include="..\..\..\src\TimerRecordDialog.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\TimeTrack.cpp" />
|
<ClCompile Include="..\..\..\src\TimeTrack.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\src\toolbars\ScrubbingToolBar.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\toolbars\SpectralSelectionBar.cpp" />
|
<ClCompile Include="..\..\..\src\toolbars\SpectralSelectionBar.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\Track.cpp" />
|
<ClCompile Include="..\..\..\src\Track.cpp" />
|
||||||
<ClCompile Include="..\..\..\src\TrackArtist.cpp" />
|
<ClCompile Include="..\..\..\src\TrackArtist.cpp" />
|
||||||
@ -445,6 +446,7 @@
|
|||||||
<ClInclude Include="..\..\..\src\RevisionIdent.h" />
|
<ClInclude Include="..\..\..\src\RevisionIdent.h" />
|
||||||
<ClInclude Include="..\..\..\src\SelectedRegion.h" />
|
<ClInclude Include="..\..\..\src\SelectedRegion.h" />
|
||||||
<ClInclude Include="..\..\..\src\SseMathFuncs.h" />
|
<ClInclude Include="..\..\..\src\SseMathFuncs.h" />
|
||||||
|
<ClInclude Include="..\..\..\src\toolbars\ScrubbingToolBar.h" />
|
||||||
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBar.h" />
|
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBar.h" />
|
||||||
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBarListener.h" />
|
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBarListener.h" />
|
||||||
<ClInclude Include="..\..\..\src\TrackPanelCell.h" />
|
<ClInclude Include="..\..\..\src\TrackPanelCell.h" />
|
||||||
|
@ -884,6 +884,9 @@
|
|||||||
<ClCompile Include="..\..\..\src\effects\Distortion.cpp">
|
<ClCompile Include="..\..\..\src\effects\Distortion.cpp">
|
||||||
<Filter>src\effects</Filter>
|
<Filter>src\effects</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\src\toolbars\ScrubbingToolBar.cpp">
|
||||||
|
<Filter>src\toolbars</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\src\AboutDialog.h">
|
<ClInclude Include="..\..\..\src\AboutDialog.h">
|
||||||
@ -1789,6 +1792,9 @@
|
|||||||
<ClInclude Include="..\..\..\src\effects\Distortion.h">
|
<ClInclude Include="..\..\..\src\effects\Distortion.h">
|
||||||
<Filter>src\effects</Filter>
|
<Filter>src\effects</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\src\toolbars\ScrubbingToolBar.h">
|
||||||
|
<Filter>src\toolbars</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\..\audacity.ico">
|
<Image Include="..\..\audacity.ico">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user