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

Merge branch 'master' into refactor

This commit is contained in:
Paul Licameli 2015-06-10 14:45:05 -04:00
commit a3aa1fe630
20 changed files with 105 additions and 54 deletions

View File

@ -336,7 +336,7 @@ float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB,
// TODO: Cache the gPrefs value. Reading it every time is inefficient.
dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
float v = ::ValueOfPixel(y, height, mContourOffset, dB, dBRange, zoomMin, zoomMax);
float v = ::ValueOfPixel(y, height, 0 != mContourOffset, dB, dBRange, zoomMin, zoomMax);
// MB: this is mostly equivalent to what the old code did, I'm not sure
// if anything special is needed for asymmetric ranges
@ -1413,7 +1413,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area )
if(area == 0.0)
return t0;
unsigned int count = mEnv.Count();
int count = mEnv.Count();
if(count == 0) // 'empty' envelope
return t0 + area * mDefaultValue;

View File

@ -172,14 +172,14 @@
// Paul Licameli (PRL) 16 Apr 2015
// Support for scrubbing in the AudioIO engine, without calls to it
#define EXPERIMENTAL_SCRUBBING_SUPPORT
// The following enable parts of the scrubbing user interface.
// You must define EXPERIMENTAL_SCRUBBING_SUPPORT if you enable this:
#define EXPERIMENTAL_SCRUBBING_BASIC
// You must define EXPERIMENTAL_SCRUBBING_BASIC if you enable this:
#define EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
// You must define EXPERIMENTAL_SCRUBBING_BASIC if you enable this:
#define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
// The following enable parts of the scrubbing user interface.
#define EXPERIMENTAL_SCRUBBING_BASIC
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
#define EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
#define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
#endif
#endif
// Paul Licameli (PRL) 24 May 2015
// Allow scrolling up to one half of a screenful beyond either end of the project,

View File

@ -122,7 +122,7 @@ public:
// or child.
virtual wxAccStatus GetValue( int childId, wxString *strValue );
void SetSelected( int item );
void SetSelected( int item, bool focused = true );
private:
wxListCtrl *mParent;
@ -140,7 +140,7 @@ CheckListAx::~CheckListAx()
{
}
void CheckListAx::SetSelected( int item )
void CheckListAx::SetSelected( int item, bool focused )
{
if (mLastId != -1)
{
@ -153,10 +153,13 @@ void CheckListAx::SetSelected( int item )
if (item != -1)
{
NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
mParent,
wxOBJID_CLIENT,
item + 1 );
if (focused)
{
NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
mParent,
wxOBJID_CLIENT,
item + 1 );
}
NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
mParent,
@ -473,14 +476,13 @@ END_EVENT_TABLE()
PluginRegistrationDialog::PluginRegistrationDialog(wxWindow *parent, EffectType type)
: wxDialog(parent,
wxID_ANY,
_("Plug-in Manager: Effects"),
_("Plug-in Manager: Effects, Generators and Analyzers"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
mType = type;
mEffects = NULL;
SetLabel(_("Plug-in Manager: Effects")); // Provide visual label
SetName(_("Plug-in Manager: Effects")); // Provide audible label
SetName(GetTitle());
mStates.SetCount(STATE_COUNT);
mStates[STATE_Enabled] = _("Enabled");
@ -747,7 +749,7 @@ void PluginRegistrationDialog::RegenerateEffectsList(int filter)
// mEffects->SetFocus();
mEffects->SetItemState(0, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED);
#if wxUSE_ACCESSIBILITY
mAx->SetSelected(0);
mAx->SetSelected(0, false);
#endif
}
}
@ -1343,14 +1345,17 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
//
// ============================================================================
bool PluginManager::IsPluginRegistered(const PluginID & ID)
bool PluginManager::IsPluginRegistered(const wxString & path)
{
if (mPlugins.find(ID) == mPlugins.end())
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
{
return false;
if (iter->second.GetPath().IsSameAs(path))
{
return true;
}
}
return true;
return false;
}
const PluginID & PluginManager::RegisterPlugin(ModuleInterface *module)

View File

@ -172,7 +172,7 @@ public:
// PluginManagerInterface implementation
virtual bool IsPluginRegistered(const PluginID & ID);
virtual bool IsPluginRegistered(const wxString & path);
virtual const PluginID & RegisterPlugin(ModuleInterface *module);
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect);

View File

@ -50,6 +50,7 @@ scroll information. It also has some status flags.
*//*******************************************************************/
#include "Audacity.h"
#include "Project.h"
#include <stdio.h>
#include <iostream>
@ -90,8 +91,6 @@ scroll information. It also has some status flags.
#endif
#endif
#include "Project.h"
#include "FreqWindow.h"
#include "effects/Contrast.h"
#include "AutoRecovery.h"
@ -1021,7 +1020,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mTrackFactory = new TrackFactory(mDirManager);
int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -2, -1};
int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, 150};
mStatusBar->SetStatusWidths(4, widths);
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
AUDACITY_VERSION_STRING);

View File

@ -31,7 +31,6 @@
#include "xml/XMLTagHandler.h"
#include "toolbars/SelectionBarListener.h"
#include "toolbars/SpectralSelectionBarListener.h"
#include "widgets/Meter.h"
#include <wx/defs.h>
#include <wx/event.h>
@ -63,6 +62,7 @@ class EffectPlugs;
class TrackPanel;
class FreqWindow;
class ContrastDialog;
class Meter;
// toolbar classes
class ControlToolBar;

View File

@ -1952,9 +1952,13 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
// choose boundaries only in snapping tolerance,
// and may choose center.
// But don't change the cursor when scrubbing.
SelectionBoundary boundary = IsScrubbing()
SelectionBoundary boundary =
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
IsScrubbing()
? SBNone
: ChooseBoundary(event, t, r, !bShiftDown, !bShiftDown);
:
#endif
ChooseBoundary(event, t, r, !bShiftDown, !bShiftDown);
#ifdef USE_MIDI
// The MIDI HitTest will only succeed if we are on a midi track, so
@ -6852,6 +6856,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
return;
}
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if ((!pTrack ||
pTrack->GetKind() == Track::Wave) &&
IsScrubbing()) {
@ -6862,6 +6867,7 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
else if (event.LeftIsDown())
return;
}
#endif
if (pTrack && (pTrack->GetKind() == Track::Wave) &&
(mMouseCapture == IsUncaptured || mMouseCapture == IsOverCutLine ||

View File

@ -316,7 +316,9 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
);
bool MaybeStartScrubbing(wxMouseEvent &event);
bool ContinueScrubbing(wxCoord position, bool hasFocus, bool seek);
public:
bool StopScrubbing();
protected:
#endif
virtual void SelectionHandleClick(wxMouseEvent &event,

View File

@ -964,7 +964,6 @@ void SpecCache::Populate
// FFT length may be longer than the window of samples that affect results
// because of zero padding done for increased frequency resolution
const int fftLen = windowSize * zeroPaddingFactor;
const int padding = (windowSize * (zeroPaddingFactor - 1)) / 2;
std::vector<float> buffer(
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS

View File

@ -32,7 +32,7 @@ CommandHandler::~CommandHandler()
delete mCurrentContext;
}
void CommandHandler::SetProject(AudacityProject *proj)
void CommandHandler::SetProject(AudacityProject *)
{
// TODO: Review if the extend command handling is ever utilized
// mCurrentContext->proj = proj;

View File

@ -34,7 +34,7 @@ class wxWindow;
#include "../Internat.h"
#include "../widgets/ProgressDialog.h"
#define BUILTIN_EFFECT_PREFIX wxT("Builtin Effect: ")
#define BUILTIN_EFFECT_PREFIX wxT("Built-in Effect: ")
class SelectedRegion;
class TimeWarper;

View File

@ -288,11 +288,11 @@ bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
{
PluginID ID(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
if (!pm.IsPluginRegistered(ID))
if (!pm.IsPluginRegistered(path))
{
RegisterPlugin(pm, ID);
RegisterPlugin(pm, path);
}
}

View File

@ -1391,7 +1391,7 @@ void NyquistEffect::Parse(wxString line)
long v;
// Splits are restored by default. Set to 0 to prevent.
tokens[1].ToLong(&v);
mRestoreSplits = v;
mRestoreSplits = !!v;
return;
}
#endif

View File

@ -69,7 +69,7 @@ bool ImportMIDI(wxString fName, NoteTrack * dest)
Alg_event_ptr evt;
int note_count = 0;
int pitch_sum = 0;
while ((evt = iterator.next())) {
while (NULL != (evt = iterator.next())) {
// if the event is a note
if (evt->get_type() == 'n') {
Alg_note_ptr note = (Alg_note_ptr) evt;

View File

@ -140,6 +140,9 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
#if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
bdwn->Enable(FALSE);
bfnd->Enable(FALSE);
#else
// fix compilation warnings about unused variables
bfnd, bdwn;
#endif
}
S.EndTwoColumn();

View File

@ -26,6 +26,8 @@
#include "../ShuttleGui.h"
#include "../FFT.h"
#include <algorithm>
SpectrumPrefs::SpectrumPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Spectrograms"))
{

View File

@ -74,8 +74,9 @@ class SpectrumPrefs:public PrefsPanel
};
struct SpectrogramSettings
class SpectrogramSettings
{
public:
static SpectrogramSettings &defaults();
SpectrogramSettings();
~SpectrogramSettings();

View File

@ -33,6 +33,7 @@
#include "../Audacity.h"
#include "ToolsToolBar.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
@ -46,12 +47,14 @@
#include <wx/tooltip.h>
#include "MeterToolBar.h"
#include "ToolsToolBar.h"
#include "../Prefs.h"
#include "../AllThemeResources.h"
#include "../ImageManipulation.h"
#include "../Project.h"
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
#include "../TrackPanel.h"
#endif
#include "../Theme.h"
#include "../widgets/AButton.h"
@ -215,6 +218,18 @@ void ToolsToolBar::SetCurrentTool(int tool, bool show)
//In multi-mode the current tool is shown by the
//cursor icon. The buttons are not updated.
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if (tool != selectTool) {
AudacityProject *p = GetActiveProject();
if (p) {
TrackPanel *tp = p->GetTrackPanel();
if (tp) {
tp->StopScrubbing();
}
}
}
#endif
bool leavingMulticlipMode =
IsDown(multiTool) && show && tool != multiTool;
@ -278,6 +293,18 @@ void ToolsToolBar::OnTool(wxCommandEvent & evt)
else
mTool[i]->PopUp();
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
if (0 != mCurrentTool) {
AudacityProject *p = GetActiveProject();
if (p) {
TrackPanel *tp = p->GetTrackPanel();
if (tp) {
tp->StopScrubbing();
}
}
}
#endif
RedrawAllProjects();
gPrefs->Write(wxT("/GUI/ToolBars/Tools/MultiToolActive"),

View File

@ -2232,31 +2232,38 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
if (m->mMonitoring)
{
*name += wxString::Format(_(" Monitoring "));
// translations of strings such as " Monitoring " did not
// always retain the leading space. Therefore a space has
// been added to ensure at least one space, and stop
// words from being merged
*name += wxT(" ") + wxString::Format(_(" Monitoring "));
}
else if (m->mActive)
{
*name += wxString::Format(_(" Active "));
*name += wxT(" ") + wxString::Format(_(" Active "));
}
float peak = 0.;
bool clipped = false;
for (int i = 0; i < m->mNumBars; i++)
{
peak = wxMax(peak, m->mBar[i].peakPeakHold);
if (m->mBar[i].clipping)
clipped = true;
}
if (m->mDB)
{
*name += wxString::Format(_(" Peak %2.f dB"), (peak * m->mDBRange) - m->mDBRange);
*name += wxT(" ") + wxString::Format(_(" Peak %2.f dB"), (peak * m->mDBRange) - m->mDBRange);
}
else
{
*name += wxString::Format(_(" Peak %.2f "), peak);
*name += wxT(" ") + wxString::Format(_(" Peak %.2f "), peak);
}
if (m->IsClipping())
if (clipped)
{
*name += wxString::Format(_(" Clipped "));
*name += wxT(" ") + wxString::Format(_(" Clipped "));
}
}

View File

@ -1677,9 +1677,9 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
mIsRecording = false;
mTimelineToolTip = gPrefs->Read(wxT("/QuickPlay/ToolTips"), 1L);
mTimelineToolTip = !!gPrefs->Read(wxT("/QuickPlay/ToolTips"), 1L);
mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false;
mQuickPlayEnabled = gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
UpdatePrefs();
@ -2188,7 +2188,7 @@ void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
DrawQuickPlayIndicator(&cdc, true);
}
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt)
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent&)
{
mQuickPlayEnabled = (mQuickPlayEnabled)? false : true;
gPrefs->Write(wxT("/QuickPlay/QuickPlayEnabled"), mQuickPlayEnabled);
@ -2196,7 +2196,7 @@ void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt)
RegenerateTooltips();
}
void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent& evt)
void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent&)
{
mPlayRegionDragsSelection = (mPlayRegionDragsSelection)? false : true;
gPrefs->Write(wxT("/QuickPlay/DragSelection"), mPlayRegionDragsSelection);
@ -2233,7 +2233,7 @@ void AdornedRulerPanel::HandleSnapping()
}
void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent& evt)
void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent&)
{
mTimelineToolTip = (mTimelineToolTip)? false : true;
gPrefs->Write(wxT("/QuickPlay/ToolTips"), mTimelineToolTip);
@ -2244,7 +2244,7 @@ void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent& evt)
}
void AdornedRulerPanel::OnAutoScroll(wxCommandEvent& evt)
void AdornedRulerPanel::OnAutoScroll(wxCommandEvent&)
{
if (mViewInfo->bUpdateTrackIndicator)
gPrefs->Write(wxT("/GUI/AutoScroll"), false);
@ -2255,7 +2255,7 @@ void AdornedRulerPanel::OnAutoScroll(wxCommandEvent& evt)
}
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent& evt)
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&)
{
if (mProject->IsPlayRegionLocked())
mProject->OnUnlockPlayRegion();