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

Merge branch 'master' into Escape-key

This commit is contained in:
Paul-Licameli 2015-04-11 23:49:59 -04:00
commit 662d42178c
21 changed files with 357 additions and 123 deletions

View File

@ -966,6 +966,7 @@
28D587CC0E264CF4009C7DEA /* LV2Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28D587C90E264CF4009C7DEA /* LV2Effect.cpp */; };
28D65C720B97E54B000E001A /* AutoDuck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28D65C700B97E54B000E001A /* AutoDuck.cpp */; };
28D65C760B97E573000E001A /* DtmfGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28D65C740B97E573000E001A /* DtmfGen.cpp */; };
28D8425C1AD8D69D00551353 /* SelectedRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28D8425B1AD8D69D00551353 /* SelectedRegion.cpp */; };
28DA07390E4F5CEC003933C5 /* ExportFFmpegDialogs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28DA07380E4F5CEC003933C5 /* ExportFFmpegDialogs.cpp */; };
28DABFBE0FF19DB100AC7848 /* RealFFTf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28DABFBC0FF19DB100AC7848 /* RealFFTf.cpp */; };
28DB34790FDC2C5D0011F589 /* ResponseQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28DB34780FDC2C5D0011F589 /* ResponseQueue.cpp */; };
@ -3757,6 +3758,8 @@
28D65C710B97E54B000E001A /* AutoDuck.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = AutoDuck.h; sourceTree = "<group>"; tabWidth = 3; };
28D65C740B97E573000E001A /* DtmfGen.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = DtmfGen.cpp; sourceTree = "<group>"; tabWidth = 3; };
28D65C750B97E573000E001A /* DtmfGen.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = DtmfGen.h; sourceTree = "<group>"; tabWidth = 3; };
28D8425A1AD8D69D00551353 /* RevisionIdent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevisionIdent.h; sourceTree = "<group>"; };
28D8425B1AD8D69D00551353 /* SelectedRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectedRegion.cpp; sourceTree = "<group>"; };
28DA07370E4F5CEC003933C5 /* ExportFFmpegDialogs.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = ExportFFmpegDialogs.h; sourceTree = "<group>"; tabWidth = 3; };
28DA07380E4F5CEC003933C5 /* ExportFFmpegDialogs.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ExportFFmpegDialogs.cpp; sourceTree = "<group>"; tabWidth = 3; };
28DABFBC0FF19DB100AC7848 /* RealFFTf.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = RealFFTf.cpp; sourceTree = "<group>"; tabWidth = 3; };
@ -5128,12 +5131,14 @@
EDFCEBA318894B2A00C98E51 /* RealFFTf48x.h */,
1790B0D209883BFD008A330A /* Resample.cpp */,
1790B0D309883BFD008A330A /* Resample.h */,
28D8425A1AD8D69D00551353 /* RevisionIdent.h */,
1790B0D409883BFD008A330A /* RingBuffer.cpp */,
1790B0D509883BFD008A330A /* RingBuffer.h */,
1790B0D609883BFD008A330A /* SampleFormat.cpp */,
1790B0D709883BFD008A330A /* SampleFormat.h */,
285DE1F80BF03C7800A20DF0 /* Screenshot.cpp */,
285DE1F90BF03C7800A20DF0 /* Screenshot.h */,
28D8425B1AD8D69D00551353 /* SelectedRegion.cpp */,
2813897919E6163C004111ED /* SelectedRegion.h */,
1790B0DA09883BFD008A330A /* Sequence.cpp */,
1790B0DB09883BFD008A330A /* Sequence.h */,
@ -9251,6 +9256,7 @@
28BB98051A15BE6800D1CC80 /* NoiseReduction.cpp in Sources */,
28285C801A27A81600BC2205 /* AudioUnitCocoaHelper.mm in Sources */,
28D000A51A32920C00367B21 /* DeviceChange.cpp in Sources */,
28D8425C1AD8D69D00551353 /* SelectedRegion.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -2130,8 +2130,6 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
// loop through attrs, which is a null-terminated list of
// attribute-value pairs
bool has_t1 = false;
double dblValue;
while(*attrs) {
const wxChar *attr = *attrs++;
const wxChar *value = *attrs++;
@ -2145,14 +2143,8 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
return false;
}
if (!wxStrcmp(attr, wxT("t")) && Internat::CompatibleToDouble(strValue, &dblValue))
selectedRegion.setT0(dblValue, false);
else if (!wxStrcmp(attr, wxT("t1")) && Internat::CompatibleToDouble(strValue, &dblValue))
{
has_t1 = true;
selectedRegion.setT1(dblValue, false);
}
// PRL: to do: read other selection fields
if (selectedRegion.HandleXMLAttribute(attr, value, wxT("t"), wxT("t1")))
;
else if (!wxStrcmp(attr, wxT("title")))
title = strValue;
@ -2160,8 +2152,10 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
// Handle files created by Audacity 1.1. Labels in Audacity 1.1
// did not have separate start- and end-times.
if (!has_t1)
selectedRegion.collapseToT0();
// PRL: this superfluous now, given class SelectedRegion's internal
// consistency guarantees
//if (selectedRegion.t1() < 0)
// selectedRegion.collapseToT0();
LabelStruct *l = new LabelStruct(selectedRegion, title);
mLabels.Add(l);
@ -2230,9 +2224,8 @@ void LabelTrack::WriteXML(XMLWriter &xmlFile)
for (i = 0; i < len; i++) {
xmlFile.StartTag(wxT("label"));
// PRL: mismatch of attribute name and structure field name, historical
xmlFile.WriteAttr(wxT("t"), mLabels[i]->getT0(), 8);
xmlFile.WriteAttr(wxT("t1"), mLabels[i]->getT1(), 8);
mLabels[i]->getSelectedRegion()
.WriteXMLAttributes(xmlFile, wxT("t"), wxT("t1"));
// PRL: to do: write other selection fields
xmlFile.WriteAttr(wxT("title"), mLabels[i]->title);
xmlFile.EndTag(wxT("label"));

View File

@ -56,6 +56,7 @@ public:
void DrawTextBox( wxDC & dc, const wxRect & r);
void DrawHighlight( wxDC & dc, int xPos1, int xPos2, int charHeight);
void getXPos( wxDC & dc, int * xPos1, int cursorPos);
const SelectedRegion &getSelectedRegion() const { return selectedRegion; }
double getDuration() const { return selectedRegion.duration(); }
double getT0() const { return selectedRegion.t0(); }
double getT1() const { return selectedRegion.t1(); }
@ -169,11 +170,11 @@ class AUDACITY_DLL_API LabelTrack : public Track
static bool IsTextClipSupported();
// methods to set flags
void SetDragXPos(const int d) { mDragXPos = d; };
void SetInBox(bool inTextBox) { mInBox = inTextBox; };
void SetResetCursorPos(bool resetFlag) { mResetCursorPos = resetFlag; };
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; };
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; };
void SetDragXPos(const int d) { mDragXPos = d; }
void SetInBox(bool inTextBox) { mInBox = inTextBox; }
void SetResetCursorPos(bool resetFlag) { mResetCursorPos = resetFlag; }
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; }
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, double h, double pps,
SelectedRegion *newSel);
@ -202,7 +203,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
//get current cursor position
bool CalcCursorX(wxWindow * parent, int * x);
int getCurrentCursorPosition() const { return mCurrentCursorPos; };
int getCurrentCursorPosition() const { return mCurrentCursorPos; }
void MayAdjustLabel( int iLabel, int iEdge, bool bAllowSwapping, double fNewTime);
void MayMoveLabel( int iLabel, int iEdge, double fNewTime);

View File

@ -185,10 +185,12 @@ audacity_SOURCES = \
RealFFTf48x.h \
Resample.cpp \
Resample.h \
RevisionIdent.h \
RingBuffer.cpp \
RingBuffer.h \
Screenshot.cpp \
Screenshot.h \
SelectedRegion.cpp \
SelectedRegion.h \
Shuttle.cpp \
Shuttle.h \

View File

@ -304,12 +304,12 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
PluginManager.cpp PluginManager.h Printing.cpp Printing.h \
Profiler.cpp Profiler.h Project.cpp Project.h RealFFTf.cpp \
RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h Resample.cpp \
Resample.h RingBuffer.cpp RingBuffer.h Screenshot.cpp \
Screenshot.h SelectedRegion.h Shuttle.cpp Shuttle.h \
ShuttleGui.cpp ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h \
Snap.cpp Snap.h SoundActivatedRecord.cpp \
SoundActivatedRecord.h Spectrum.cpp Spectrum.h \
SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \
Screenshot.cpp Screenshot.h SelectedRegion.cpp \
SelectedRegion.h Shuttle.cpp Shuttle.h ShuttleGui.cpp \
ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \
SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \
Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \
ThemeAsCeeCode.h TimeDialog.cpp TimeDialog.h \
TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \
@ -546,7 +546,8 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
audacity-Profiler.$(OBJEXT) audacity-Project.$(OBJEXT) \
audacity-RealFFTf.$(OBJEXT) audacity-RealFFTf48x.$(OBJEXT) \
audacity-Resample.$(OBJEXT) audacity-RingBuffer.$(OBJEXT) \
audacity-Screenshot.$(OBJEXT) audacity-Shuttle.$(OBJEXT) \
audacity-Screenshot.$(OBJEXT) \
audacity-SelectedRegion.$(OBJEXT) audacity-Shuttle.$(OBJEXT) \
audacity-ShuttleGui.$(OBJEXT) audacity-ShuttlePrefs.$(OBJEXT) \
audacity-Snap.$(OBJEXT) \
audacity-SoundActivatedRecord.$(OBJEXT) \
@ -1173,12 +1174,12 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
PluginManager.cpp PluginManager.h Printing.cpp Printing.h \
Profiler.cpp Profiler.h Project.cpp Project.h RealFFTf.cpp \
RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h Resample.cpp \
Resample.h RingBuffer.cpp RingBuffer.h Screenshot.cpp \
Screenshot.h SelectedRegion.h Shuttle.cpp Shuttle.h \
ShuttleGui.cpp ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h \
Snap.cpp Snap.h SoundActivatedRecord.cpp \
SoundActivatedRecord.h Spectrum.cpp Spectrum.h \
SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \
Screenshot.cpp Screenshot.h SelectedRegion.cpp \
SelectedRegion.h Shuttle.cpp Shuttle.h ShuttleGui.cpp \
ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \
SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \
Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \
ThemeAsCeeCode.h TimeDialog.cpp TimeDialog.h \
TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \
@ -2029,6 +2030,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-RingBuffer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-SampleFormat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Screenshot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-SelectedRegion.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Sequence.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Shuttle.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ShuttleGui.Po@am__quote@
@ -3266,6 +3268,20 @@ audacity-Screenshot.obj: Screenshot.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-Screenshot.obj `if test -f 'Screenshot.cpp'; then $(CYGPATH_W) 'Screenshot.cpp'; else $(CYGPATH_W) '$(srcdir)/Screenshot.cpp'; fi`
audacity-SelectedRegion.o: SelectedRegion.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-SelectedRegion.o -MD -MP -MF $(DEPDIR)/audacity-SelectedRegion.Tpo -c -o audacity-SelectedRegion.o `test -f 'SelectedRegion.cpp' || echo '$(srcdir)/'`SelectedRegion.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-SelectedRegion.Tpo $(DEPDIR)/audacity-SelectedRegion.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SelectedRegion.cpp' object='audacity-SelectedRegion.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-SelectedRegion.o `test -f 'SelectedRegion.cpp' || echo '$(srcdir)/'`SelectedRegion.cpp
audacity-SelectedRegion.obj: SelectedRegion.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-SelectedRegion.obj -MD -MP -MF $(DEPDIR)/audacity-SelectedRegion.Tpo -c -o audacity-SelectedRegion.obj `if test -f 'SelectedRegion.cpp'; then $(CYGPATH_W) 'SelectedRegion.cpp'; else $(CYGPATH_W) '$(srcdir)/SelectedRegion.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-SelectedRegion.Tpo $(DEPDIR)/audacity-SelectedRegion.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SelectedRegion.cpp' object='audacity-SelectedRegion.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-SelectedRegion.obj `if test -f 'SelectedRegion.cpp'; then $(CYGPATH_W) 'SelectedRegion.cpp'; else $(CYGPATH_W) '$(srcdir)/SelectedRegion.cpp'; fi`
audacity-Shuttle.o: Shuttle.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-Shuttle.o -MD -MP -MF $(DEPDIR)/audacity-Shuttle.Tpo -c -o audacity-Shuttle.o `test -f 'Shuttle.cpp' || echo '$(srcdir)/'`Shuttle.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-Shuttle.Tpo $(DEPDIR)/audacity-Shuttle.Po

View File

@ -1214,6 +1214,10 @@ void AudacityProject::CreateMenusAndCommands()
AudioIOBusyFlag);
c->AddCommand(wxT("PlayOneSec"), _("Play One Second"), FN(OnPlayOneSecond), wxT("1"));
c->AddCommand(wxT("PlayToSelection"),_("Play To Selection"), FN(OnPlayToSelection), wxT("B"));
c->AddCommand(wxT("PlayBeforeSelectionStart"),_("Play Before Selection Start"), FN(OnPlayBeforeSelectionStart), wxT("Shift+F5"));
c->AddCommand(wxT("PlayAfterSelectionStart"),_("Play After Selection Start"), FN(OnPlayAfterSelectionStart), wxT("Shift+F6"));
c->AddCommand(wxT("PlayBeforeSelectionEnd"),_("Play Before Selection End"), FN(OnPlayBeforeSelectionEnd), wxT("Shift+F7"));
c->AddCommand(wxT("PlayAfterSelectionEnd"),_("Play After Selection End"), FN(OnPlayAfterSelectionEnd), wxT("Shift+F8"));
c->AddCommand(wxT("PlayCutPreview"), _("Play Cut Preview"), FN(OnPlayCutPreview), wxT("C"));
c->AddCommand(wxT("SelStart"), _("Selection to Start"), FN(OnSelToStart), wxT("Shift+Home"));
@ -2252,6 +2256,74 @@ void AudacityProject::OnPlayToSelection()
GetControlToolBar()->PlayPlayRegion(t0, t1);
}
// The next 4 functions provide a limited version of the
// functionality of OnPlayToSelection() for keyboard users
void AudacityProject::OnPlayBeforeSelectionStart()
{
if( !MakeReadyToPlay() )
return;
double t0 = mViewInfo.selectedRegion.t0();
double beforeLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
GetControlToolBar()->PlayPlayRegion(t0 - beforeLen, t0);
}
void AudacityProject::OnPlayAfterSelectionStart()
{
if( !MakeReadyToPlay() )
return;
double t0 = mViewInfo.selectedRegion.t0();
double t1 = mViewInfo.selectedRegion.t1();
double afterLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
if ( t1 - t0 > 0.0 && t1 - t0 < afterLen )
GetControlToolBar()->PlayPlayRegion(t0, t1);
else
GetControlToolBar()->PlayPlayRegion(t0, t0 + afterLen);
}
void AudacityProject::OnPlayBeforeSelectionEnd()
{
if( !MakeReadyToPlay() )
return;
double t0 = mViewInfo.selectedRegion.t0();
double t1 = mViewInfo.selectedRegion.t1();
double beforeLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 1.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
if ( t1 - t0 > 0.0 && t1 - t0 < beforeLen )
GetControlToolBar()->PlayPlayRegion(t0, t1);
else
GetControlToolBar()->PlayPlayRegion(t1 - beforeLen, t1);
}
void AudacityProject::OnPlayAfterSelectionEnd()
{
if( !MakeReadyToPlay() )
return;
double t1 = mViewInfo.selectedRegion.t1();
double afterLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
GetControlToolBar()->PlayPlayRegion(t1, t1 + afterLen);
}
void AudacityProject::OnPlayLooped()
{
if( !MakeReadyToPlay(true) )

View File

@ -93,6 +93,10 @@ void OnPlayStop();
void OnPlayStopSelect();
void OnPlayOneSecond();
void OnPlayToSelection();
void OnPlayBeforeSelectionStart();
void OnPlayAfterSelectionStart();
void OnPlayBeforeSelectionEnd();
void OnPlayAfterSelectionEnd();
void OnPlayLooped();
void OnPlayCutPreview();

View File

@ -741,6 +741,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample)),
mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
mSelectionFormat(gPrefs->Read(wxT("/SelectionFormat"), wxT(""))),
mFrequencySelectionFormatName(gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT(""))),
mBandwidthSelectionFormatName(gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT(""))),
mDirty(false),
mRuler(NULL),
mTrackPanel(NULL),
@ -773,6 +775,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mLastEffectType(0),
mTimerRecordCanceled(false),
mMenuClose(false)
, mbInitializingScrollbar(false)
{
int widths[] = {-2, -1};
mStatusBar = CreateStatusBar(2);
@ -1253,16 +1256,16 @@ void AudacityProject::SSBL_SetFrequencySelectionFormatName(const wxString & form
gPrefs->Flush();
}
const wxString & AudacityProject::SSBL_GetLogFrequencySelectionFormatName()
const wxString & AudacityProject::SSBL_GetBandwidthSelectionFormatName()
{
return GetLogFrequencySelectionFormatName();
return GetBandwidthSelectionFormatName();
}
void AudacityProject::SSBL_SetLogFrequencySelectionFormatName(const wxString & formatName)
void AudacityProject::SSBL_SetBandwidthSelectionFormatName(const wxString & formatName)
{
mLogFrequencySelectionFormatName = formatName;
mBandwidthSelectionFormatName = formatName;
gPrefs->Write(wxT("/LogFrequencySelectionFormatName"), mLogFrequencySelectionFormatName);
gPrefs->Write(wxT("/BandwidthSelectionFormatName"), mBandwidthSelectionFormatName);
gPrefs->Flush();
}
@ -1299,17 +1302,17 @@ void AudacityProject::SetFrequencySelectionFormatName(const wxString & formatNam
#endif
}
const wxString & AudacityProject::GetLogFrequencySelectionFormatName() const
const wxString & AudacityProject::GetBandwidthSelectionFormatName() const
{
return mLogFrequencySelectionFormatName;
return mBandwidthSelectionFormatName;
}
void AudacityProject::SetLogFrequencySelectionFormatName(const wxString & formatName)
void AudacityProject::SetBandwidthSelectionFormatName(const wxString & formatName)
{
SSBL_SetLogFrequencySelectionFormatName(formatName);
SSBL_SetBandwidthSelectionFormatName(formatName);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
if (GetSpectralSelectionBar()) {
GetSpectralSelectionBar()->SetLogFrequencySelectionFormatName(formatName);
GetSpectralSelectionBar()->SetBandwidthSelectionFormatName(formatName);
}
#endif
}
@ -1508,7 +1511,16 @@ void AudacityProject::FixScrollbars()
mViewInfo.sbarH = (wxInt64) (mViewInfo.h * mViewInfo.zoom);
int lastv = mViewInfo.vpos;
// PRL: Can someone else find a more elegant solution to bug 812, than
// introducing this boolean member variable?
// Setting mVSbar earlier, int HandlXMLTag, didn't succeed in restoring
// the vertical scrollbar to its saved position. So defer that till now.
// mbInitializingScrollbar should be true only at the start of the life
// of an AudacityProject reopened from disk.
if (!mbInitializingScrollbar) {
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
}
mbInitializingScrollbar = false;
if (mViewInfo.vpos >= totalHeight)
mViewInfo.vpos = totalHeight - 1;
@ -2808,6 +2820,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
int requiredTags = 0;
long longVpos = 0;
// loop through attrs, which is a null-terminated list of
// attribute-value pairs
@ -2834,19 +2847,19 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
}
}
if (!wxStrcmp(attr, wxT("version")))
else if (!wxStrcmp(attr, wxT("version")))
{
fileVersion = value;
bFileVersionFound = true;
requiredTags++;
}
if (!wxStrcmp(attr, wxT("audacityversion"))) {
else if (!wxStrcmp(attr, wxT("audacityversion"))) {
audacityVersion = value;
requiredTags++;
}
if (!wxStrcmp(attr, wxT("projname"))) {
else if (!wxStrcmp(attr, wxT("projname"))) {
wxString projName;
wxString projPath;
@ -2911,46 +2924,46 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
requiredTags++;
}
if (!wxStrcmp(attr, wxT("sel0"))) {
double t0;
Internat::CompatibleToDouble(value, &t0);
mViewInfo.selectedRegion.setT0(t0, false);
else if (mViewInfo.selectedRegion
.HandleXMLAttribute(attr, value, wxT("sel0"), wxT("sel1"))) {
}
if (!wxStrcmp(attr, wxT("sel1"))) {
double t1;
Internat::CompatibleToDouble(value, &t1);
mViewInfo.selectedRegion.setT1(t1, false);
}
// PRL: to do: persistence of other fields of the selection
long longVpos = 0;
if (!wxStrcmp(attr, wxT("vpos")))
else if (!wxStrcmp(attr, wxT("vpos")))
// Just assign a variable, put the value in its place later
wxString(value).ToLong(&longVpos);
mViewInfo.track = NULL;
mViewInfo.vpos = longVpos;
if (!wxStrcmp(attr, wxT("h")))
else if (!wxStrcmp(attr, wxT("h")))
Internat::CompatibleToDouble(value, &mViewInfo.h);
if (!wxStrcmp(attr, wxT("zoom")))
else if (!wxStrcmp(attr, wxT("zoom")))
Internat::CompatibleToDouble(value, &mViewInfo.zoom);
if (!wxStrcmp(attr, wxT("rate"))) {
else if (!wxStrcmp(attr, wxT("rate"))) {
Internat::CompatibleToDouble(value, &mRate);
GetSelectionBar()->SetRate(mRate);
}
if (!wxStrcmp(attr, wxT("snapto"))) {
else if (!wxStrcmp(attr, wxT("snapto"))) {
SetSnapTo(wxString(value) == wxT("on") ? true : false);
}
if (!wxStrcmp(attr, wxT("selectionformat"))) {
else if (!wxStrcmp(attr, wxT("selectionformat")))
SetSelectionFormat(value);
}
else if (!wxStrcmp(attr, wxT("frequencyformat")))
SetFrequencySelectionFormatName(value);
else if (!wxStrcmp(attr, wxT("bandwidthformat")))
SetBandwidthSelectionFormatName(value);
} // while
if (longVpos != 0) {
// PRL: It seems this must happen after SetSnapTo
mViewInfo.track = NULL;
mViewInfo.vpos = longVpos;
mbInitializingScrollbar = true;
}
// Specifically detect newer versions of Audacity
// WARNING: This will need review/revision if we ever have a version string
// such as 1.5.10, i.e. with 2 digit numbers.
@ -3117,8 +3130,8 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile)
xmlFile.WriteAttr(wxT("projname"), projName);
xmlFile.WriteAttr(wxT("version"), wxT(AUDACITY_FILE_FORMAT_VERSION));
xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);
xmlFile.WriteAttr(wxT("sel0"), mViewInfo.selectedRegion.t0(), 10);
xmlFile.WriteAttr(wxT("sel1"), mViewInfo.selectedRegion.t1(), 10);
mViewInfo.selectedRegion
.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
// PRL: to do: persistence of other fields of the selection
xmlFile.WriteAttr(wxT("vpos"), mViewInfo.vpos);
xmlFile.WriteAttr(wxT("h"), mViewInfo.h, 10);
@ -3126,6 +3139,8 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile)
xmlFile.WriteAttr(wxT("rate"), mRate);
xmlFile.WriteAttr(wxT("snapto"), GetSnapTo() ? wxT("on") : wxT("off"));
xmlFile.WriteAttr(wxT("selectionformat"), GetSelectionFormat());
xmlFile.WriteAttr(wxT("frequencyformat"), GetFrequencySelectionFormatName());
xmlFile.WriteAttr(wxT("bandwidthformat"), GetBandwidthSelectionFormatName());
mTags->WriteXML(xmlFile);

View File

@ -110,10 +110,10 @@ enum PlayMode {
class ImportXMLTagHandler : public XMLTagHandler
{
public:
ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; };
ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; }
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
virtual XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; };
virtual XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; }
// Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack.
// <import> tags are instead written by AudacityProject::WriteXML.
@ -135,7 +135,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
const wxPoint & pos, const wxSize & size);
virtual ~AudacityProject();
TrackList *GetTracks() { return mTracks; };
TrackList *GetTracks() { return mTracks; }
UndoManager *GetUndoManager() { return &mUndoManager; }
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
@ -221,7 +221,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
bool GetDirty() { return mDirty; }
void SetProjectTitle();
TrackPanel * GetTrackPanel(){return mTrackPanel;};
TrackPanel * GetTrackPanel(){return mTrackPanel;}
bool GetIsEmpty() { return mTracks->IsEmpty(); }
@ -327,8 +327,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
void SetFrequencySelectionFormatName(const wxString & format);
const wxString & GetFrequencySelectionFormatName() const;
void SetLogFrequencySelectionFormatName(const wxString & format);
const wxString & GetLogFrequencySelectionFormatName() const;
void SetBandwidthSelectionFormatName(const wxString & format);
const wxString & GetBandwidthSelectionFormatName() const;
// Scrollbars
@ -387,8 +387,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
Meter *GetCaptureMeter();
void SetCaptureMeter(Meter *capture);
LyricsWindow* GetLyricsWindow() { return mLyricsWindow; };
MixerBoard* GetMixerBoard() { return mMixerBoard; };
LyricsWindow* GetLyricsWindow() { return mLyricsWindow; }
MixerBoard* GetMixerBoard() { return mMixerBoard; }
// SelectionBarListener callback methods
@ -407,8 +407,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
virtual const wxString & SSBL_GetFrequencySelectionFormatName();
virtual void SSBL_SetFrequencySelectionFormatName(const wxString & formatName);
virtual const wxString & SSBL_GetLogFrequencySelectionFormatName();
virtual void SSBL_SetLogFrequencySelectionFormatName(const wxString & formatName);
virtual const wxString & SSBL_GetBandwidthSelectionFormatName();
virtual void SSBL_SetBandwidthSelectionFormatName(const wxString & formatName);
virtual void SSBL_ModifySpectralSelection(double &bottom, double &top, bool done);
@ -464,8 +464,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
static bool GetCacheBlockFiles();
public:
bool IsSoloSimple() { return mSoloPref == wxT("Simple"); };
bool IsSoloNone() { return mSoloPref == wxT("None"); };
bool IsSoloSimple() { return mSoloPref == wxT("Simple"); }
bool IsSoloNone() { return mSoloPref == wxT("None"); }
private:
@ -488,7 +488,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
int mSnapTo;
wxString mSelectionFormat;
wxString mFrequencySelectionFormatName;
wxString mLogFrequencySelectionFormatName;
wxString mBandwidthSelectionFormatName;
TrackList *mLastSavedTracks;
@ -618,6 +618,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
// Are we currently closing as the result of a menu command?
bool mMenuClose;
bool mbInitializingScrollbar;
DECLARE_EVENT_TABLE()
};

63
src/SelectedRegion.cpp Normal file
View File

@ -0,0 +1,63 @@
/**********************************************************************
Audacity: A Digital Audio Editor
SelectedRegion.cpp
Paul Licameli
*******************************************************************/
#include "Internat.h"
#include "SelectedRegion.h"
#include "xml/XMLWriter.h"
const wxChar *SelectedRegion::sDefaultT0Name = wxT("selStart");
const wxChar *SelectedRegion::sDefaultT1Name = wxT("selEnd");
namespace {
const wxChar *sDefaultF0Name = wxT("selLow");
const wxChar *sDefaultF1Name = wxT("selHigh");
}
void SelectedRegion::WriteXMLAttributes
(XMLWriter &xmlFile,
const wxChar *legacyT0Name, const wxChar *legacyT1Name) const
{
xmlFile.WriteAttr(legacyT0Name, t0(), 10);
xmlFile.WriteAttr(legacyT1Name, t1(), 10);
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
if (f0() >= 0)
xmlFile.WriteAttr(sDefaultF0Name, f0(), 10);
if (f1() >= 0)
xmlFile.WriteAttr(sDefaultF1Name, f1(), 10);
#endif
}
bool SelectedRegion::HandleXMLAttribute
(const wxChar *attr, const wxChar *value,
const wxChar *legacyT0Name, const wxChar *legacyT1Name)
{
typedef bool (SelectedRegion::*Setter)(double, bool);
Setter setter = 0;
if (!wxStrcmp(attr, legacyT0Name))
setter = &SelectedRegion::setT0;
else if (!wxStrcmp(attr, legacyT1Name))
setter = &SelectedRegion::setT1;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
else if (!wxStrcmp(attr, sDefaultF0Name))
setter = &SelectedRegion::setF0;
else if (!wxStrcmp(attr, sDefaultF1Name))
setter = &SelectedRegion::setF1;
#endif
else
return false;
double dblValue;
if (!Internat::CompatibleToDouble(value, &dblValue))
return false;
// False means don't flip time or frequency boundaries
(void)(this->*setter)(dblValue, false);
return true;
}

View File

@ -28,6 +28,12 @@
#include "Audacity.h"
#include "Experimental.h"
#include <wx/defs.h>
#include <wx/wxchar.h>
#include <math.h>
class XMLWriter;
class AUDACITY_DLL_API SelectedRegion {
// Maintains the invariant: t1() >= t0()
@ -156,15 +162,31 @@ public:
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
// Returns true iff the bounds got swapped
bool setF0(double f) {
bool setF0(double f, bool maySwap = true) {
if (f < 0)
f = UndefinedFrequency;
mF0 = f;
if (maySwap)
return ensureFrequencyOrdering();
else {
if (mF1 >= 0 && mF1 < mF0)
mF1 = mF0;
return false;
}
}
// Returns true iff the bounds got swapped
bool setF1(double f) {
bool setF1(double f, bool maySwap = true) {
if (f < 0)
f = UndefinedFrequency;
mF1 = f;
if (maySwap)
return ensureFrequencyOrdering();
else {
if (mF0 >= 0 && mF1 < mF0)
mF0 = mF1;
return false;
}
}
// Returns true iff the bounds got swapped
@ -176,6 +198,30 @@ public:
}
#endif
// Serialization: historically, selections were written to file
// in two places (project, and each label) but only as attributes
// in the tags, and different names were used in the two places.
// For compatibility, continue that, but possibly add attributes
// as SelectedRegion is extended. Therefore, this is not an
// XMLTagHandler.
static const wxChar *sDefaultT0Name;
static const wxChar *sDefaultT1Name;
// Serialize, not with tags of its own, but as attributes within a tag.
// Don't add more legacy arguments as the structure grows.
void WriteXMLAttributes
(XMLWriter &xmlFile,
const wxChar *legacyT0Name = sDefaultT0Name,
const wxChar *legacyT1Name = sDefaultT1Name) const;
// Return true iff the attribute is recognized.
// Don't add more legacy arguments as the structure grows.
bool HandleXMLAttribute
(const wxChar *attr, const wxChar *value,
const wxChar *legacyT0Name = sDefaultT0Name,
const wxChar *legacyT1Name = sDefaultT1Name);
private:
bool ensureOrdering()
{

View File

@ -2,12 +2,15 @@
Name=Audacity
Name[de]=Audacity
Name[ru]=Audacity
Name[uk]=Audacity
GenericName=Sound Editor
GenericName[de]=Audio-Editor
GenericName[ru]=Редактор звуковых файлов
GenericName[uk]=Редактор звукових файлів
Comment=Record and edit audio files
Comment[de]=Audio-Dateien aufnehmen und bearbeiten
Comment[ru]=Запись и редактирование звуковых файлов
Comment[uk]=Запис і редагування звукових файлів
Icon=@AUDACITY_NAME@

View File

@ -1454,26 +1454,26 @@ struct ControlInfo {
}; const ControlInfo *controlInfo() { static const ControlInfo table[] = {
{ &EffectNoiseReduction::Settings::mNoiseGain,
0.0, 48.0, 48, wxT("%d"), true,
wxTRANSLATE("&Noise reduction (dB):"), wxTRANSLATE("Noise reduction") },
wxString(wxTRANSLATE("&Noise reduction (dB):")), wxString(wxTRANSLATE("Noise reduction")) },
{ &EffectNoiseReduction::Settings::mNewSensitivity,
0.0, 24.0, 48, wxT("%.2f"), false,
wxTRANSLATE("&Sensitivity:"), wxTRANSLATE("Sensitivity") },
wxString(wxTRANSLATE("&Sensitivity:")), wxString(wxTRANSLATE("Sensitivity")) },
#ifdef ATTACK_AND_RELEASE
{ &EffectNoiseReduction::Settings::mAttackTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("Attac&k time (secs):"), wxTRANSLATE("Attack time") },
wxString(wxTRANSLATE("Attac&k time (secs):")), wxString(wxTRANSLATE("Attack time")) },
{ &EffectNoiseReduction::Settings::mReleaseTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("R&elease time (secs):"), wxTRANSLATE("Release time") },
wxTRANSLATE("R&elease time (secs):"), wxString(wxTRANSLATE("Release time")) },
#endif
{ &EffectNoiseReduction::Settings::mFreqSmoothingBands,
0, 6, 6, wxT("%d"), true,
wxTRANSLATE("&Frequency smoothing (bands):"), wxTRANSLATE("Frequency smoothing") },
wxString(wxTRANSLATE("&Frequency smoothing (bands):")), wxString(wxTRANSLATE("Frequency smoothing")) },
#ifdef ADVANCED_SETTINGS
{ &EffectNoiseReduction::Settings::mOldSensitivity,
-20.0, 20.0, 4000, wxT("%.2f"), false,
wxTRANSLATE("Sensiti&vity (dB):"), wxTRANSLATE("Old Sensitivity") },
wxString(wxTRANSLATE("Sensiti&vity (dB):")), wxString(wxTRANSLATE("Old Sensitivity")) },
// add here
#endif
}; return table; }

View File

@ -52,6 +52,8 @@ void GUIPrefs::Populate()
mRangeCodes.Add(wxT("36"));
mRangeCodes.Add(wxT("48"));
mRangeCodes.Add(wxT("60"));
mRangeCodes.Add(wxT("72"));
mRangeCodes.Add(wxT("84"));
mRangeCodes.Add(wxT("96"));
mRangeCodes.Add(wxT("120"));
mRangeCodes.Add(wxT("145"));
@ -59,6 +61,8 @@ void GUIPrefs::Populate()
mRangeChoices.Add(_("-36 dB (shallow range for high-amplitude editing)"));
mRangeChoices.Add(_("-48 dB (PCM range of 8 bit samples)"));
mRangeChoices.Add(_("-60 dB (PCM range of 10 bit samples)"));
mRangeChoices.Add(_("-72 dB (PCM range of 12 bit samples)"));
mRangeChoices.Add(_("-84 dB (PCM range of 14 bit samples)"));
mRangeChoices.Add(_("-96 dB (PCM range of 16 bit samples)"));
mRangeChoices.Add(_("-120 dB (approximate limit of human hearing)"));
mRangeChoices.Add(_("-145 dB (PCM range of 24 bit samples)"));

View File

@ -76,7 +76,7 @@ BEGIN_EVENT_TABLE(SpectralSelectionBar, ToolBar)
EVT_TEXT(OnHighID, SpectralSelectionBar::OnCtrl)
EVT_CHOICE(OnChoiceID, SpectralSelectionBar::OnChoice)
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
EVT_COMMAND(wxID_ANY, EVT_LOGFREQUENCYTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
EVT_COMMAND(wxID_ANY, EVT_BANDWIDTHTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
END_EVENT_TABLE()
static const wxString preferencePath
@ -117,8 +117,8 @@ void SpectralSelectionBar::Populate()
wxString frequencyFormatName = mListener
? mListener->SSBL_GetFrequencySelectionFormatName()
: wxString(wxEmptyString);
wxString logFrequencyFormatName = mListener
? mListener->SSBL_GetLogFrequencySelectionFormatName()
wxString bandwidthFormatName = mListener
? mListener->SSBL_GetBandwidthSelectionFormatName()
: wxString(wxEmptyString);
wxFlexGridSizer *mainSizer = new wxFlexGridSizer(1, 1, 1);
@ -151,7 +151,7 @@ void SpectralSelectionBar::Populate()
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mWidthCtrl = new NumericTextCtrl(
NumericConverter::LOG_FREQUENCY, this, OnWidthID, logFrequencyFormatName, 0.0);
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0);
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
mWidthCtrl->EnableMenu();
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
@ -192,7 +192,7 @@ void SpectralSelectionBar::UpdatePrefs()
if (mbCenterAndWidth)
{
wxCommandEvent e(EVT_LOGFREQUENCYTEXTCTRL_UPDATED);
wxCommandEvent e(EVT_BANDWIDTHTEXTCTRL_UPDATED);
e.SetInt(mWidthCtrl->GetFormatIndex());
OnUpdate(e);
}
@ -208,7 +208,7 @@ void SpectralSelectionBar::SetListener(SpectralSelectionBarListener *l)
{
mListener = l;
SetFrequencySelectionFormatName(mListener->SSBL_GetFrequencySelectionFormatName());
SetLogFrequencySelectionFormatName(mListener->SSBL_GetLogFrequencySelectionFormatName());
SetBandwidthSelectionFormatName(mListener->SSBL_GetBandwidthSelectionFormatName());
};
void SpectralSelectionBar::OnSize(wxSizeEvent &evt)
@ -312,9 +312,9 @@ void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt)
mListener->SSBL_SetFrequencySelectionFormatName(frequencyFormatName);
}
else if (mbCenterAndWidth &&
type == EVT_LOGFREQUENCYTEXTCTRL_UPDATED) {
wxString logFrequencyFormatName = mWidthCtrl->GetBuiltinName(index);
mListener->SSBL_SetLogFrequencySelectionFormatName(logFrequencyFormatName);
type == EVT_BANDWIDTHTEXTCTRL_UPDATED) {
wxString bandwidthFormatName = mWidthCtrl->GetBuiltinName(index);
mListener->SSBL_SetBandwidthSelectionFormatName(bandwidthFormatName);
}
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
@ -377,12 +377,12 @@ void SpectralSelectionBar::SetFrequencySelectionFormatName(const wxString & form
OnUpdate(e);
}
void SpectralSelectionBar::SetLogFrequencySelectionFormatName(const wxString & formatName)
void SpectralSelectionBar::SetBandwidthSelectionFormatName(const wxString & formatName)
{
if (mbCenterAndWidth) {
mWidthCtrl->SetFormatName(formatName);
wxCommandEvent e(EVT_LOGFREQUENCYTEXTCTRL_UPDATED);
wxCommandEvent e(EVT_BANDWIDTHTEXTCTRL_UPDATED);
e.SetInt(mWidthCtrl->GetFormatIndex());
OnUpdate(e);
}

View File

@ -43,7 +43,7 @@ public:
void SetFrequencies(double bottom, double top);
void SetFrequencySelectionFormatName(const wxString & formatName);
void SetLogFrequencySelectionFormatName(const wxString & formatName);
void SetBandwidthSelectionFormatName(const wxString & formatName);
void SetListener(SpectralSelectionBarListener *l);
private:

View File

@ -14,22 +14,21 @@
#include "../Audacity.h"
class wxString;
class SelectedRegion;
class AUDACITY_DLL_API SpectralSelectionBarListener {
public:
SpectralSelectionBarListener(){};
virtual ~SpectralSelectionBarListener(){};
SpectralSelectionBarListener(){}
virtual ~SpectralSelectionBarListener(){}
virtual double SSBL_GetRate() const = 0;
virtual const wxString & SSBL_GetFrequencySelectionFormatName() = 0;
virtual void SSBL_SetFrequencySelectionFormatName(const wxString & formatName) = 0;
virtual const wxString & SSBL_GetLogFrequencySelectionFormatName() = 0;
virtual void SSBL_SetLogFrequencySelectionFormatName(const wxString & formatName) = 0;
virtual const wxString & SSBL_GetBandwidthSelectionFormatName() = 0;
virtual void SSBL_SetBandwidthSelectionFormatName(const wxString & formatName) = 0;
virtual void SSBL_ModifySpectralSelection(double &bottom, double &top, bool done) = 0;
};

View File

@ -486,7 +486,7 @@ const BuiltinFormatString FrequencyConverterFormats[] = {
* array of string pairs for name of the format and the format string
* needed to create that format output. This is used for the pop-up
* list of formats to choose from in the control. */
const BuiltinFormatString LogFrequencyConverterFormats[] = {
const BuiltinFormatString BandwidthConverterFormats[] = {
{
/* i18n-hint: Name of display format that shows log of frequency
* in octaves */
@ -546,10 +546,10 @@ NumericConverter::NumericConverter(Type type,
mNBuiltins = sizeof(FrequencyConverterFormats) /
sizeof (FrequencyConverterFormats[0]);
break;
case LOG_FREQUENCY:
mBuiltinFormatStrings = LogFrequencyConverterFormats;
mNBuiltins = sizeof(LogFrequencyConverterFormats) /
sizeof (LogFrequencyConverterFormats[0]);
case BANDWIDTH:
mBuiltinFormatStrings = BandwidthConverterFormats;
mNBuiltins = sizeof(BandwidthConverterFormats) /
sizeof(BandwidthConverterFormats[0]);
default:
break;
}
@ -1099,7 +1099,7 @@ void NumericConverter::Adjust(int steps, int dir)
DEFINE_EVENT_TYPE(EVT_TIMETEXTCTRL_UPDATED)
DEFINE_EVENT_TYPE(EVT_FREQUENCYTEXTCTRL_UPDATED)
DEFINE_EVENT_TYPE(EVT_LOGFREQUENCYTEXTCTRL_UPDATED)
DEFINE_EVENT_TYPE(EVT_BANDWIDTHTEXTCTRL_UPDATED)
BEGIN_EVENT_TABLE(NumericTextCtrl, wxControl)
EVT_ERASE_BACKGROUND(NumericTextCtrl::OnErase)
@ -1470,8 +1470,8 @@ void NumericTextCtrl::OnContext(wxContextMenuEvent &event)
case NumericConverter::FREQUENCY:
eventType = EVT_FREQUENCYTEXTCTRL_UPDATED;
break;
case NumericConverter::LOG_FREQUENCY:
eventType = EVT_LOGFREQUENCYTEXTCTRL_UPDATED;
case NumericConverter::BANDWIDTH:
eventType = EVT_BANDWIDTHTEXTCTRL_UPDATED;
break;
default:
wxASSERT(false);

View File

@ -32,7 +32,7 @@
// update their formats to agree.
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_TIMETEXTCTRL_UPDATED, -1);
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_FREQUENCYTEXTCTRL_UPDATED, -1);
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_LOGFREQUENCYTEXTCTRL_UPDATED,
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_BANDWIDTHTEXTCTRL_UPDATED,
-1);
/** \brief struct to hold a formatting control string and it's user facing name
@ -53,7 +53,7 @@ public:
enum Type {
TIME,
FREQUENCY,
LOG_FREQUENCY,
BANDWIDTH,
};
NumericConverter(Type type,

View File

@ -293,6 +293,7 @@
<ClCompile Include="..\..\..\src\RingBuffer.cpp" />
<ClCompile Include="..\..\..\src\SampleFormat.cpp" />
<ClCompile Include="..\..\..\src\Screenshot.cpp" />
<ClCompile Include="..\..\..\src\SelectedRegion.cpp" />
<ClCompile Include="..\..\..\src\Sequence.cpp" />
<ClCompile Include="..\..\..\src\Shuttle.cpp" />
<ClCompile Include="..\..\..\src\ShuttleGui.cpp" />
@ -530,6 +531,7 @@
<ClInclude Include="..\..\..\src\import\SpecPowerMeter.h" />
<ClInclude Include="..\..\..\src\ModuleManager.h" />
<ClInclude Include="..\..\..\src\RevisionIdent.h" />
<ClInclude Include="..\..\..\src\SelectedRegion.h" />
<ClInclude Include="..\..\..\src\SseMathFuncs.h" />
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBar.h" />
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBarListener.h" />

View File

@ -837,6 +837,9 @@
<ClCompile Include="..\..\..\src\DeviceChange.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\SelectedRegion.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\AboutDialog.h">
@ -1673,6 +1676,9 @@
<ClInclude Include="..\..\..\src\RevisionIdent.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\SelectedRegion.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\audacity.ico">