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

Merge branch 'master' of github.com:audacity/audacity into nyquistPlus

This commit is contained in:
Steve Daulton 2015-04-14 13:56:15 +01:00
commit fa3d546cf8
25 changed files with 359 additions and 199 deletions

View File

@ -1,9 +1,9 @@
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libwxgtk2.8-dev
- git show -s --format="wxT(\"<a href=\\\"https://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")"
- git show -s --format="wxT(\"<a href=\\\"https://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")" > ./src/RevisionIdent.h
- git show -s --format="wxT(\"<a href=\\\"http://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")"
- git show -s --format="wxT(\"<a href=\\\"http://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")" > ./src/RevisionIdent.h
language: cpp
compiler:
- gcc
script: ./configure && make
script: aclocal --install -I m4 && automake && ./configure && make

View File

@ -49,7 +49,7 @@ includedir=.
Name: ${pkg}
Version: ${version}
Description: Temporary fake config file
Libs: -L\${libdir} ${lib} -ldl
Libs: -L\${libdir} ${lib} -ldl -lm
Cflags: -I\${includedir}/${pkg}${major}
EOF

View File

@ -339,7 +339,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S )
wxString informationStr; // string to build up list of information in
S.StartNotebookPage( _("Build Information") ); // start the tab
S.StartVerticalLay(2); // create the window
HtmlWindow *html = new HtmlWindow(S.GetParent(), -1, wxDefaultPosition,
HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1, wxDefaultPosition,
wxSize(ABOUT_DIALOG_WIDTH, 264),
wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
// create a html pane in it to put the content in.
@ -582,7 +582,7 @@ void AboutDialog::PopulateLicensePage( ShuttleGui & S )
{
S.StartNotebookPage( _("GPL License") );
S.StartVerticalLay(1);
HtmlWindow *html = new HtmlWindow(S.GetParent(), -1,
HtmlWindow *html = new LinkingHtmlWindow(S.GetParent(), -1,
wxDefaultPosition,
wxSize(ABOUT_DIALOG_WIDTH, 264),
wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);

View File

@ -960,7 +960,11 @@ void AudacityApp::InitLang( const wxString & lang )
wxSetEnv(wxT("LANG"), wxT("en_US"));
#endif
#if wxCHECK_VERSION(3,0,0)
mLocale = new wxLocale(wxT(""), lang, wxT(""), true);
#else
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true);
#endif
#if defined(__WXMAC__)
if (existed) {

View File

@ -11,6 +11,9 @@
#include "Audacity.h"
#include <wx/defs.h>
#if wxCHECK_VERSION(3,0,0)
#include <wx/crt.h>
#endif
#include <wx/filename.h>
#include <wx/wfstream.h>

View File

@ -72,7 +72,11 @@ enum {
BEGIN_EVENT_TABLE(LabelDialog, wxDialog)
EVT_GRID_SELECT_CELL(LabelDialog::OnSelectCell)
#if wxCHECK_VERSION(3,0,0)
EVT_GRID_CELL_CHANGED(LabelDialog::OnCellChange)
#else
EVT_GRID_CELL_CHANGE(LabelDialog::OnCellChange)
#endif
EVT_BUTTON(ID_INSERTA, LabelDialog::OnInsert)
EVT_BUTTON(ID_INSERTB, LabelDialog::OnInsert)
EVT_BUTTON(ID_REMOVE, LabelDialog::OnRemove)
@ -438,7 +442,7 @@ void LabelDialog::OnInsert(wxCommandEvent &event)
// Attempt to guess which track the label should reside on
if (cnt > 0) {
row = mGrid->GetCursorRow();
row = mGrid->GetGridCursorRow();
if (row > 0 && row >= cnt) {
index = mTrackNames.Index(mGrid->GetCellValue(row - 1, Col_Track));
}
@ -470,8 +474,8 @@ void LabelDialog::OnInsert(wxCommandEvent &event)
void LabelDialog::OnRemove(wxCommandEvent & WXUNUSED(event))
{
int row = mGrid->GetCursorRow();
int col = mGrid->GetCursorColumn();
int row = mGrid->GetGridCursorRow();
int col = mGrid->GetGridCursorCol();
int cnt = mData.GetCount();
// Don't try to remove if no labels exist

View File

@ -2299,7 +2299,7 @@ void AudacityProject::OnPlayBeforeSelectionEnd()
double t0 = mViewInfo.selectedRegion.t0();
double t1 = mViewInfo.selectedRegion.t1();
double beforeLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 1.0);
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()

View File

@ -318,8 +318,8 @@ int NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r)
}
wxString t;
long w;
long h;
wxCoord w;
wxCoord h;
t.Printf(wxT("%d"), chanName);
dc.GetTextExtent(t, &w, &h);

View File

@ -1688,7 +1688,7 @@ void AudacityProject::OnIconize(wxIconizeEvent &event)
// why but it does no harm.
// Should we be returning true/false rather than
// void return? I don't know.
mIconized = event.Iconized();
mIconized = event.IsIconized();
unsigned int i;

View File

@ -21,8 +21,12 @@
*//********************************************************************/
// The commented out string below is like the one the build servers
// will replace this file with.
//wxT("<a href=\"http://github.com/audacity/audacity/commit/28864acb238cb3ca71dda190a2d93242591dd80e\">28864ac</a> of Sun Apr 12 12:40:22 2015 +0100")
// The string below is what you get if
// the build system does not replace this file.
wxT("No revision identifier was provided")

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

@ -30,6 +30,8 @@
#include <wx/defs.h>
#include <wx/wxchar.h>
#include <math.h>
class XMLWriter;
class AUDACITY_DLL_API SelectedRegion {

View File

@ -636,7 +636,11 @@ enum {
};
BEGIN_EVENT_TABLE(TagsEditor, wxDialog)
#if wxCHECK_VERSION(3,0,0)
EVT_GRID_CELL_CHANGED(TagsEditor::OnChange)
#else
EVT_GRID_CELL_CHANGE(TagsEditor::OnChange)
#endif
EVT_BUTTON(EditID, TagsEditor::OnEdit)
EVT_BUTTON(ResetID, TagsEditor::OnReset)
EVT_BUTTON(ClearID, TagsEditor::OnClear)
@ -1216,7 +1220,7 @@ void TagsEditor::OnAdd(wxCommandEvent & WXUNUSED(event))
void TagsEditor::OnRemove(wxCommandEvent & WXUNUSED(event))
{
size_t row = mGrid->GetCursorRow();
size_t row = mGrid->GetGridCursorRow();
if (!mEditTitle && mGrid->GetCellValue(row, 0).CmpNoCase(LABEL_TITLE) == 0) {
return;

View File

@ -610,7 +610,7 @@ void TrackArtist::DrawVRuler(Track *t, wxDC * dc, wxRect & r)
// ISO standard: A440 is in the 4th octave, denoted
// A4 <- the "4" should be a subscript.
s.Printf(wxT("C%d"), octave - 1);
long width, height;
wxCoord width, height;
dc->GetTextExtent(s, &width, &height);
if (obottom - height + 4 > r.y &&
obottom + 4 < r.y + r.height) {

View File

@ -590,6 +590,8 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mLastScrubTime = 0;
mLastScrubPosition = 0;
#endif
mInitialTrackSelection = new std::vector<bool>;
}
TrackPanel::~TrackPanel()
@ -651,6 +653,8 @@ TrackPanel::~TrackPanel()
#if !wxUSE_ACCESSIBILITY
delete mAx;
#endif
delete mInitialTrackSelection;
}
void TrackPanel::BuildMenus(void)
@ -1472,16 +1476,56 @@ void TrackPanel::HandleEscapeKey()
{
switch (mMouseCapture)
{
case IsSelecting:
{
TrackListIterator iter(mTracks);
std::vector<bool>::const_iterator
it = mInitialTrackSelection->begin(),
end = mInitialTrackSelection->end();
for (Track *t = iter.First(); t; t = iter.Next()) {
wxASSERT(it != end);
t->SetSelected(*it++);
}
mViewInfo->selectedRegion = mInitialSelection;
}
break;
case IsZooming:
case IsVZooming:
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseMouse();
Refresh(false);
return;
break;
case IsResizing:
mCapturedTrack->SetHeight(mInitialActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
break;
case IsResizingBetweenLinkedTracks:
{
Track *const next = mTracks->GetNext(mCapturedTrack);
mCapturedTrack->SetHeight(mInitialUpperActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
next->SetHeight(mInitialActualHeight);
next->SetMinimized(mInitialMinimized);
}
break;
case IsResizingBelowLinkedTracks:
{
Track *const prev = mTracks->GetPrev(mCapturedTrack);
mCapturedTrack->SetHeight(mInitialActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
prev->SetHeight(mInitialUpperActualHeight);
prev->SetMinimized(mInitialMinimized);
}
break;
default:
return;
;
}
// Common part in all cases that do anything
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseMouse();
wxMouseEvent dummy;
HandleCursor(dummy);
Refresh(false);
}
void TrackPanel::HandleAltKey(bool down)
@ -2201,14 +2245,39 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
Track * pTrack, wxRect r)
{
Track *rightTrack = NULL;
bool nextTrackIsLinkFromPTrack = false;
mCapturedTrack = pTrack;
mCapturedRect = r;
mMouseClickX = event.m_x;
mMouseClickY = event.m_y;
bool startNewSelection = true;
mMouseCapture=IsSelecting;
mInitialSelection = mViewInfo->selectedRegion;
// Save initial state of track selections, also,
// if the shift button is down and no track is selected yet,
// at least select the track we clicked into.
bool isAtLeastOneTrackSelected = false;
mInitialTrackSelection->clear();
{
bool nextTrackIsLinkFromPTrack = false;
TrackListIterator iter(mTracks);
for (Track *t = iter.First(); t; t = iter.Next()) {
const bool isSelected = t->GetSelected();
mInitialTrackSelection->push_back(isSelected);
if (isSelected) {
isAtLeastOneTrackSelected = true;
}
if (!isAtLeastOneTrackSelected) {
if (t == pTrack && t->GetLinked()) {
nextTrackIsLinkFromPTrack = true;
}
else if (nextTrackIsLinkFromPTrack) {
rightTrack = t;
nextTrackIsLinkFromPTrack = false;
}
}
}
}
// We create a new snap manager in case any snap-points have changed
if (mSnapManager)
@ -2237,23 +2306,6 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
&& !stretch
#endif
) {
// If the shift button is down and no track is selected yet,
// at least select the track we clicked into.
bool isAtLeastOneTrackSelected = false;
TrackListIterator iter(mTracks);
for (Track *t = iter.First(); t; t = iter.Next()) {
if (t->GetSelected()) {
isAtLeastOneTrackSelected = true;
break;
} else if (t == pTrack && t->GetLinked()) {
nextTrackIsLinkFromPTrack = true;
} else if (nextTrackIsLinkFromPTrack) {
rightTrack = t;
nextTrackIsLinkFromPTrack = false;
}
}
if (!isAtLeastOneTrackSelected) {
pTrack->SetSelected(true);
if (rightTrack)
@ -2324,10 +2376,15 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
mLastScrubPosition = PositionToTime(event.m_x, GetLeftOffset());
#else
StartOrJumpPlayback(event);
// Not starting a drag
SetCapturedTrack(NULL, IsUncaptured);
#endif
return;
}
//Make sure you are within the selected track
bool startNewSelection = true;
if (pTrack && pTrack->GetSelected()) {
// Adjusting selection edges can be turned off in the
// preferences now
@ -2411,9 +2468,12 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
// IF the user clicked a label, THEN select all other tracks by Label
if (lt->IsSelected()) {
mTracks->Select( lt );
mTracks->Select(lt);
SelectTracksByLabel( lt );
DisplaySelection();
// Not starting a drag
SetCapturedTrack(NULL, IsUncaptured);
return;
}
}
@ -5591,6 +5651,7 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
mMouseClickY = event.m_y;
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
// To do: escape key
if(MONO_WAVE_PAN(t)){
//STM: Determine whether we should rescale one or two tracks
if (t->GetVirtualStereo()) {
@ -5613,18 +5674,21 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks);
}
else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
}
else {
// DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing);
}
}
@ -5636,18 +5700,26 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight();
mInitialUpperActualHeight = prev->GetActualHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks);
}
else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight();
mInitialActualHeight = next->GetActualHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight();
mInitialUpperActualHeight = t->GetActualHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
}
else {
// DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing);
}
#endif // EXPERIMENTAL_OUTPUT_DISPLAY
@ -9517,7 +9589,7 @@ void TrackInfo::DrawTitleBar(wxDC * dc, const wxRect r, Track * t,
wxString titleStr = t->GetName();
int allowableWidth = kTrackInfoWidth - 38 - kLeftInset;
long textWidth, textHeight;
wxCoord textWidth, textHeight;
dc->GetTextExtent(titleStr, &textWidth, &textHeight);
while (textWidth > allowableWidth) {
titleStr = titleStr.Left(titleStr.Length() - 1);
@ -9583,7 +9655,7 @@ void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect r, Track * t,
dc->SetPen( *wxTRANSPARENT_PEN );//No border!
dc->DrawRectangle(bev);
long textWidth, textHeight;
wxCoord textWidth, textHeight;
wxString str = (solo) ?
/* i18n-hint: This is on a button that will silence this track.*/
_("Solo") :
@ -9837,69 +9909,3 @@ TrackPanel *(*TrackPanel::FactoryFunction)(
TrackPanelListener * listener,
AdornedRulerPanel * ruler) = TrackPanelFactory;
/**********************************************************************
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

@ -12,6 +12,7 @@
#define __AUDACITY_TRACK_PANEL__
#include <memory>
#include <vector>
#include <wx/dcmemory.h>
#include <wx/dynarray.h>
@ -573,6 +574,10 @@ protected:
wxLongLong mLastSelectionAdjustment;
SelectedRegion mInitialSelection;
// Extra indirection to avoid the stupid MSW compiler warnings! Rrrr!
std::vector<bool> *mInitialTrackSelection;
bool mSelStartValid;
double mSelStart;
@ -712,8 +717,11 @@ protected:
bool onlyWithinSnapDistance,
double *pPinValue = NULL) const;
bool mInitialMinimized;
int mInitialTrackHeight;
int mInitialActualHeight;
int mInitialUpperTrackHeight;
int mInitialUpperActualHeight;
bool mAutoScrolling;
enum MouseCaptureEnum

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

@ -394,7 +394,7 @@ void CommandManager::InsertItem(wxString name, wxString label_in,
for (size_t lndx = 0; lndx < lcnt; lndx++) {
item = list.Item(lndx)->GetData();
if (item->GetLabel() == label) {
if (item->GetItemLabelText() == label) {
break;
}
pos++;
@ -681,7 +681,7 @@ int CommandManager::NewIdentifier(wxString name, wxString label, wxMenu *menu,
tmpEntry->label = label;
tmpEntry->labelPrefix = labelPrefix;
tmpEntry->labelTop = wxMenuItem::GetLabelFromText(mCurrentMenuName);
tmpEntry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName);
tmpEntry->menu = menu;
tmpEntry->callback = callback;
tmpEntry->multi = multi;
@ -975,7 +975,7 @@ void CommandManager::ToggleAccels(wxMenu *m, bool show)
}
// Set the new label
mi->SetText( label );
mi->SetItemLabel( label );
}
}
@ -1251,7 +1251,7 @@ wxString CommandManager::GetPrefixedLabelFromName(wxString name)
if (!entry->labelPrefix.IsEmpty()) {
prefix = entry->labelPrefix + wxT(" - ");
}
return wxMenuItem::GetLabelFromText(prefix + entry->label);
return wxMenuItem::GetLabelText(prefix + entry->label);
#else
return wxString(entry->labelPrefix + wxT(" ") + entry->label).Trim(false).Trim(true);
#endif
@ -1342,7 +1342,7 @@ void CommandManager::WriteXML(XMLWriter &xmlFile)
for(j=0; j<mCommandList.GetCount(); j++) {
wxString label = mCommandList[j]->label;
label = wxMenuItem::GetLabelFromText(label.BeforeFirst(wxT('\t')));
label = wxMenuItem::GetLabelText(label.BeforeFirst(wxT('\t')));
xmlFile.StartTag(wxT("command"));
xmlFile.WriteAttr(wxT("name"), mCommandList[j]->name);

View File

@ -36,6 +36,7 @@
#include <wx/slider.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/utils.h>
// Used to communicate the type of the filter.
static const int bassType = 0; //Low Shelf
@ -78,9 +79,9 @@ wxString EffectBassTreble::GetEffectDescription() {
bool EffectBassTreble::PromptUser()
{
BassTrebleDialog dlog(this, mParent);
dlog.bass = dB_bass;
dlog.treble = dB_treble;
dlog.level = dB_level;
dlog.mBass = dB_bass;
dlog.mTreble = dB_treble;
dlog.mLevel = dB_level;
dlog.mbNormalize = mbNormalize;
dlog.TransferDataToWindow();
dlog.CentreOnParent();
@ -89,9 +90,9 @@ bool EffectBassTreble::PromptUser()
if (dlog.GetReturnCode() == wxID_CANCEL)
return false;
dB_bass = dlog.bass;
dB_treble = dlog.treble;
dB_level = dlog.level;
dB_bass = dlog.mBass;
dB_treble = dlog.mTreble;
dB_level = dlog.mLevel;
mbNormalize = dlog.mbNormalize;
gPrefs->Write(wxT("/Effects/BassTreble/Bass"), dB_bass);
@ -268,6 +269,7 @@ float EffectBassTreble::DoFilter(float in)
#define TREBLE_MAX 150 // Corresponds to +15 dB
#define LEVEL_MIN -300 // Corresponds to -30 dN
#define LEVEL_MAX 0 // Corresponds to 0 dB
#define DB_MAX 100 // Maximum allowed dB boost
BEGIN_EVENT_TABLE(BassTrebleDialog, EffectDialog)
EVT_SLIDER(ID_BASS_SLIDER, BassTrebleDialog::OnBassSlider)
@ -341,26 +343,27 @@ void BassTrebleDialog::PopulateOrExchange(ShuttleGui & S)
S.EndStatic();
// Normalize checkbox
S.StartHorizontalLay(wxLEFT, true);
S.StartTwoColumn();
{
S.AddSpace(5,0);
mNormalizeCheckBox = S.Id(ID_NORMALIZE).AddCheckBox(_("&Enable level control"),
mbNormalize ? wxT("true") : wxT("false"));
mWarning = S.AddVariableText( wxT(""), false,
wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
S.AddSpace(5, 0);
mWarning = S.AddVariableText( wxT(""), false);
}
S.EndHorizontalLay();
S.EndTwoColumn();
}
bool BassTrebleDialog::TransferDataToWindow()
{
mBassS->SetValue((double)bass);
mTrebleS->SetValue((double)treble);
mLevelS->SetValue((double)level);
mBassS->SetValue((double)mBass);
mTrebleS->SetValue((double)mTreble);
mLevelS->SetValue((double)mLevel);
mBassT->SetValue(wxString::Format(wxT("%.1f"), (float)bass));
mTrebleT->SetValue(wxString::Format(wxT("%.1f"), (float)treble));
mLevelT->SetValue(wxString::Format(wxT("%.1f"), (float)level));
mBassT->SetValue(wxString::Format(wxT("%.1f"), (float)mBass));
mTrebleT->SetValue(wxString::Format(wxT("%.1f"), (float)mTreble));
mLevelT->SetValue(wxString::Format(wxT("%.1f"), (float)mLevel));
mNormalizeCheckBox->SetValue(mbNormalize);
UpdateUI();
@ -371,11 +374,17 @@ bool BassTrebleDialog::TransferDataToWindow()
bool BassTrebleDialog::TransferDataFromWindow()
{
mBassT->GetValue().ToDouble(&bass);
mTrebleT->GetValue().ToDouble(&treble);
mLevelT->GetValue().ToDouble(&level);
mBassT->GetValue().ToDouble(&mBass);
mTrebleT->GetValue().ToDouble(&mTreble);
mLevelT->GetValue().ToDouble(&mLevel);
mbNormalize = mNormalizeCheckBox->GetValue();
// Ensure that max values can never exceed design limits
// See bug 683.
mBass = wxMin(DB_MAX, mBass);
mTreble = wxMin(DB_MAX, mTreble);
mLevel = wxMin(0, mLevel);
return true;
}
@ -387,6 +396,9 @@ void BassTrebleDialog::OnNormalize(wxCommandEvent& WXUNUSED(evt))
void BassTrebleDialog::UpdateUI()
{
bool enable = mNormalizeCheckBox->GetValue();
bool okEnabled = true;
bool preveiwEnabled = true;
wxString warning = wxT("");
double v0, v1, v2;
wxString val0 = mBassT->GetValue();
val0.ToDouble(&v0);
@ -402,30 +414,31 @@ void BassTrebleDialog::UpdateUI()
wxButton *ok = (wxButton *) FindWindow(wxID_OK);
wxButton *preview = (wxButton *) FindWindow(ID_EFFECT_PREVIEW);
if (v0==0 && v1==0 && !enable)
{
if (v0==0 && v1==0 && !enable) {
// Disallow OK if nothing to do (but allow preview)
ok->Enable(false);
preview->Enable(true);
mWarning->SetLabel(_(" No change to apply."));
okEnabled = false;
warning = (_("Warning: No change to apply."));
}
else
{
if ((v2 > 0) && enable)
{
// Disallow OK and Preview if level enabled and > 0
ok->Enable(false);
preview->Enable(false);
mWarning->SetLabel(_(": Maximum 0 dB."));
}
else
{
// OK and Preview enabled
ok->Enable(true);
preview->Enable(true);
mWarning->SetLabel(wxT(""));
}
if (v0 > DB_MAX) {
okEnabled = false;
preveiwEnabled = false;
warning = (_("Error: Maximum Bass = 100 dB."));
}
if (v1 > DB_MAX) {
okEnabled = false;
preveiwEnabled = false;
warning = (_("Error: Maximum Treble = 100 dB."));
}
if ((v2 > 0) && enable) {
// Disallow OK and Preview if level enabled and > 0
okEnabled = false;
preveiwEnabled = false;
warning = (_("Error: Maximum Level = 0 dB."));
}
mWarning->SetLabel(warning);
ok->Enable(okEnabled);
preview->Enable(preveiwEnabled);
}
// handler implementations for BassTrebleDialog
@ -484,9 +497,9 @@ void BassTrebleDialog::OnPreview(wxCommandEvent & WXUNUSED(event))
double oldLevel = mEffect->dB_level;
bool oldUseGain = mEffect->mbNormalize;
mEffect->dB_bass = bass;
mEffect->dB_treble = treble;
mEffect->dB_level = level;
mEffect->dB_bass = mBass;
mEffect->dB_treble = mTreble;
mEffect->dB_level = mLevel;
mEffect->mbNormalize = mbNormalize;
mEffect->Preview();

View File

@ -117,9 +117,9 @@ private:
public:
EffectBassTreble *mEffect;
double bass;
double treble;
double level;
double mBass;
double mTreble;
double mLevel;
bool mbNormalize;
DECLARE_EVENT_TABLE()

View File

@ -1449,34 +1449,47 @@ struct ControlInfo {
// (valueMin - valueMax) / sliderMax is the value increment of the slider
const wxChar* format;
bool formatAsInt;
const wxChar* textBoxCaption_; wxString textBoxCaption() const { return wxGetTranslation(textBoxCaption_); }
const wxChar* sliderName_; wxString sliderName() const { return wxGetTranslation(sliderName_); }
}; 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") },
{ &EffectNoiseReduction::Settings::mNewSensitivity,
0.0, 24.0, 48, wxT("%.2f"), false,
wxTRANSLATE("&Sensitivity:"), wxTRANSLATE("Sensitivity") },
const wxString textBoxCaption_; wxString textBoxCaption() const { return wxGetTranslation(textBoxCaption_); }
const wxString sliderName_; wxString sliderName() const { return wxGetTranslation(sliderName_); }
ControlInfo(MemberPointer f, double vMin, double vMax, long sMax, const wxChar* fmt, bool fAsInt,
const wxString &caption, const wxString &name)
: field(f), valueMin(vMin), valueMax(vMax), sliderMax(sMax), format(fmt), formatAsInt(fAsInt)
, textBoxCaption_(caption), sliderName_(name)
{
}
};
const ControlInfo *controlInfo() {
static const ControlInfo table[] = {
ControlInfo(&EffectNoiseReduction::Settings::mNoiseGain,
0.0, 48.0, 48, wxT("%d"), true,
wxTRANSLATE("&Noise reduction (dB):"), wxTRANSLATE("Noise reduction")),
ControlInfo(&EffectNoiseReduction::Settings::mNewSensitivity,
0.0, 24.0, 48, wxT("%.2f"), false,
wxTRANSLATE("&Sensitivity:"), wxTRANSLATE("Sensitivity")),
#ifdef ATTACK_AND_RELEASE
{ &EffectNoiseReduction::Settings::mAttackTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("Attac&k time (secs):"), wxTRANSLATE("Attack time") },
{ &EffectNoiseReduction::Settings::mReleaseTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("R&elease time (secs):"), wxTRANSLATE("Release time") },
ControlInfo(&EffectNoiseReduction::Settings::mAttackTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("Attac&k time (secs):"), wxTRANSLATE("Attack time")),
ControlInfo(&EffectNoiseReduction::Settings::mReleaseTime,
0, 1.0, 100, wxT("%.2f"), false,
wxTRANSLATE("R&elease time (secs):"), wxTRANSLATE("Release time")),
#endif
{ &EffectNoiseReduction::Settings::mFreqSmoothingBands,
0, 6, 6, wxT("%d"), true,
wxTRANSLATE("&Frequency smoothing (bands):"), wxTRANSLATE("Frequency smoothing") },
ControlInfo(&EffectNoiseReduction::Settings::mFreqSmoothingBands,
0, 6, 6, wxT("%d"), true,
wxTRANSLATE("&Frequency smoothing (bands):"), wxTRANSLATE("Frequency smoothing")),
#ifdef ADVANCED_SETTINGS
{ &EffectNoiseReduction::Settings::mOldSensitivity,
-20.0, 20.0, 4000, wxT("%.2f"), false,
wxTRANSLATE("Sensiti&vity (dB):"), wxTRANSLATE("Old Sensitivity") },
// add here
ControlInfo(&EffectNoiseReduction::Settings::mOldSensitivity,
-20.0, 20.0, 4000, wxT("%.2f"), false,
wxTRANSLATE("Sensiti&vity (dB):"), wxTRANSLATE("Old Sensitivity")),
// add here
#endif
}; return table; }
};
return table;
}
} // namespace

View File

@ -19,7 +19,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "../Audacity.h"
#include "Reverb.h"
#include "Reverb_libSoX.h"
#include "../Prefs.h"
@ -477,7 +477,12 @@ void ReverbDialogue::OnStereoWidthWidget(wxCommandEvent & WXUNUSED(event))
static int wxGetChoiceFromUser(wxWindow * parent, wxString const & message,
wxString const & caption, wxArrayString const & choices,
char * * clientData = 0, long style = wxCHOICEDLG_STYLE,
#if wxCHECK_VERSION(3,0,0)
void * * clientData = 0,
#else
char * * clientData = 0,
#endif
long style = wxCHOICEDLG_STYLE,
wxPoint const & pos = wxDefaultPosition) // Home-grown function
{
wxSingleChoiceDialog d(parent, message, caption, choices, clientData, style, pos);

View File

@ -541,7 +541,11 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
if((mInfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF)
len = wxUINT32_SWAP_ON_LE(len);
if (Stricmp(id, "ID3 ") != 0) { // must be case insensitive
#if wxCHECK_VERSION(3,0,0)
if (wxStricmp(id, "ID3 ") != 0) { // must be case insensitive
#else
if (Stricmp(id, "ID3 ") != 0) { // must be case insensitive
#endif
f.Seek(len + (len & 0x01), wxFromCurrent);
continue;
}

View File

@ -585,8 +585,8 @@ KeyView::RefreshBindings(const wxArrayString & names,
int x, y;
// Remove any menu code from the category and prefix
wxString cat = wxMenuItem::GetLabelFromText(categories[i]);
wxString pfx = wxMenuItem::GetLabelFromText(prefixes[i]);
wxString cat = wxMenuItem::GetLabelText(categories[i]);
wxString pfx = wxMenuItem::GetLabelText(prefixes[i]);
// Append "Menu" this node is for a menu title
if (cat != wxT("Command"))
@ -696,7 +696,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
else
{
// Strip any menu codes from label
node.label = wxMenuItem::GetLabelFromText(labels[i].BeforeFirst(wxT('\t')));
node.label = wxMenuItem::GetLabelText(labels[i].BeforeFirst(wxT('\t')));
}
// Fill in remaining info
@ -1229,7 +1229,11 @@ KeyView::OnSetFocus(wxFocusEvent & event)
// will also refresh the visual (highlighted) state.
if (GetSelection() != wxNOT_FOUND)
{
RefreshLine(GetSelection());
#if wxCHECK_VERSION(3,0,0)
RefreshRow(GetSelection());
#else
RefreshLine(GetSelection());
#endif
}
#if wxUSE_ACCESSIBILITY
@ -1250,7 +1254,11 @@ KeyView::OnKillFocus(wxFocusEvent & event)
// Refresh the selected line to adjust visual highlighting.
if (GetSelection() != wxNOT_FOUND)
{
RefreshLine(GetSelection());
#if wxCHECK_VERSION(3,0,0)
RefreshRow(GetSelection());
#else
RefreshLine(GetSelection());
#endif
}
}
@ -1325,7 +1333,11 @@ KeyView::OnKeyDown(wxKeyEvent & event)
RefreshLines();
// Reset the original top line
ScrollToLine(topline);
#if wxCHECK_VERSION(3,0,0)
ScrollToRow(topline);
#else
ScrollToLine(topline);
#endif
// And make sure current line is still selected
SelectNode(LineToIndex(line));
@ -1389,7 +1401,11 @@ KeyView::OnKeyDown(wxKeyEvent & event)
RefreshLines();
// Reset the original top line
ScrollToLine(topline);
#if wxCHECK_VERSION(3,0,0)
ScrollToRow(topline);
#else
ScrollToLine(topline);
#endif
// And make sure current line is still selected
SelectNode(LineToIndex(line));
@ -1531,7 +1547,11 @@ KeyView::OnLeftDown(wxMouseEvent & event)
RefreshLines();
// Reset the original top line
ScrollToLine(topline);
#if wxCHECK_VERSION(3,0,0)
ScrollToRow(topline);
#else
ScrollToLine(topline);
#endif
// And make sure current line is still selected
SelectNode(LineToIndex(line));
@ -1757,7 +1777,11 @@ KeyView::GetLineHeight(int line)
return 0;
}
#if wxCHECK_VERSION(3,0,0)
return OnGetRowHeight(line);
#else
return OnGetLineHeight(line);
#endif
}
//
@ -1892,7 +1916,7 @@ KeyViewAx::IdToLine(int childId, int & line)
line = childId - 1;
// Make sure id is valid
if (line < 0 || line >= (int) mView->GetLineCount())
if (line < 0 || line >= (int) mView->GetItemCount())
{
// Indicate the control itself in this case
return false;
@ -1908,7 +1932,7 @@ bool
KeyViewAx::LineToId(int line, int & childId)
{
// Make sure line is valid
if (line < 0 || line >= (int) mView->GetLineCount())
if (line < 0 || line >= (int) mView->GetItemCount())
{
// Indicate the control itself in this case
childId = wxACC_SELF;
@ -1966,7 +1990,7 @@ KeyViewAx::GetChild(int childId, wxAccessible** child)
wxAccStatus
KeyViewAx::GetChildCount(int *childCount)
{
*childCount = (int) mView->GetLineCount();
*childCount = (int) mView->GetItemCount();
return wxACC_OK;
}

View File

@ -1134,7 +1134,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message,
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
long widthText = 0;
wxCoord widthText = 0;
dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
ds.x = (wxCoord) wxMax(wxMax(3 * widthText / 2, 4 * ds.y / 3), 300);
SetClientSize(ds);