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

make many functions which do not require access to class member variables static so they can be called without an object to do so with. Based on part of a patch by Campbell Barton

This commit is contained in:
RichardAsh1981@gmail.com 2013-09-21 19:15:42 +00:00
parent 6758caa5e1
commit 28e9f0ca73
8 changed files with 16 additions and 16 deletions

View File

@ -163,7 +163,7 @@ void Envelope::CopyFrom(const Envelope *e, double t0, double t1)
/// Limit() limits a double value to a range. /// Limit() limits a double value to a range.
/// TODO: Move to a general utilities source file. /// TODO: Move to a general utilities source file.
double Limit( double Lo, double Value, double Hi ) static double Limit( double Lo, double Value, double Hi )
{ {
if( Value < Lo ) if( Value < Lo )
return Lo; return Lo;
@ -201,7 +201,7 @@ double Envelope::fromDB(double value) const
} }
/// TODO: This should probably move to track artist. /// TODO: This should probably move to track artist.
void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top) static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
{ {
if (y >= 0 && y <= r.height) { if (y >= 0 && y <= r.height) {
wxRect circle(r.x + x, r.y + (top ? y - 1: y - 2), 4, 4); wxRect circle(r.x + x, r.y + (top ? y - 1: y - 2), 4, 4);
@ -1495,7 +1495,7 @@ void Envelope::print()
printf( "(%.2f, %.2f)\n", mEnv[i]->GetT(), mEnv[i]->GetVal() ); printf( "(%.2f, %.2f)\n", mEnv[i]->GetT(), mEnv[i]->GetVal() );
} }
void checkResult( int n, double a, double b ) static void checkResult( int n, double a, double b )
{ {
if( (a-b > 0 ? a-b : b-a) > 0.0000001 ) if( (a-b > 0 ? a-b : b-a) > 0.0000001 )
{ {

View File

@ -21,7 +21,7 @@
wxString WrapText( const wxString & Text ) static wxString WrapText( const wxString & Text )
{ {
return wxString(wxT(""))+ return wxString(wxT(""))+
wxT("<html><head></head>") + wxT("<html><head></head>") +
@ -30,7 +30,7 @@ wxString WrapText( const wxString & Text )
wxT("</body></html>"); wxT("</body></html>");
} }
wxString Link( const wxString &Key, const wxString& Text ) static wxString Link( const wxString &Key, const wxString& Text )
{ {
return wxString(wxT("")) + return wxString(wxT("")) +
wxT("<a href='innerlink:") + wxT("<a href='innerlink:") +
@ -40,7 +40,7 @@ wxString Link( const wxString &Key, const wxString& Text )
wxT("</a>"); wxT("</a>");
} }
wxString WikiLink( const wxString &Key, const wxString& Text ) static wxString WikiLink( const wxString &Key, const wxString& Text )
{ {
return wxString(wxT("")) + return wxString(wxT("")) +
wxT("<a href='http://www.audacityteam.org/wiki/index.php?title=") + wxT("<a href='http://www.audacityteam.org/wiki/index.php?title=") +
@ -50,7 +50,7 @@ wxString WikiLink( const wxString &Key, const wxString& Text )
wxT("</a>"); wxT("</a>");
} }
wxString FileLink( const wxString &Key, const wxString& Text ) static wxString FileLink( const wxString &Key, const wxString& Text )
{ {
return wxString(wxT("")) + return wxString(wxT("")) +
wxT("<a href='") + wxT("<a href='") +
@ -62,7 +62,7 @@ wxString FileLink( const wxString &Key, const wxString& Text )
wxT("</a>"); wxT("</a>");
} }
wxString HttpLink( const wxString &Key, const wxString& Text ) static wxString HttpLink( const wxString &Key, const wxString& Text )
{ {
return wxString(wxT("")) + return wxString(wxT("")) +
wxT("<a href='") + wxT("<a href='") +
@ -73,7 +73,7 @@ wxString HttpLink( const wxString &Key, const wxString& Text )
wxT("</a>"); wxT("</a>");
} }
wxString LinkExpand( const wxString & Text ) static wxString LinkExpand( const wxString & Text )
{ {
wxString Temp = Text; wxString Temp = Text;
int i,j,k; int i,j,k;
@ -177,7 +177,7 @@ wxString TitleText( const wxString & Key )
return Key; return Key;
} }
wxString HelpTextBuiltIn( const wxString & Key ) static wxString HelpTextBuiltIn( const wxString & Key )
{ {
if(Key==wxT("welcome")) if(Key==wxT("welcome"))
{ {

View File

@ -1345,7 +1345,7 @@ void LabelTrack::MayMoveLabel( int iLabel, int iEdge, double fNewTime)
// Constrain function, as in processing/arduino. // Constrain function, as in processing/arduino.
// returned value will be between min and max (inclusive). // returned value will be between min and max (inclusive).
int Constrain( int value, int min, int max ) static int Constrain( int value, int min, int max )
{ {
wxASSERT( min <= max ); wxASSERT( min <= max );
int result=value; int result=value;

View File

@ -42,7 +42,7 @@
WX_DECLARE_STRING_HASH_MAP(wxString, LangHash); WX_DECLARE_STRING_HASH_MAP(wxString, LangHash);
bool TranslationExists(wxArrayString &audacityPathList, wxString code) static bool TranslationExists(wxArrayString &audacityPathList, wxString code)
{ {
wxArrayString results; wxArrayString results;
wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"), wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"),

View File

@ -82,7 +82,7 @@ public:
FILE *mNewFile; FILE *mNewFile;
}; };
bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
{ {
wxString line; wxString line;
wxString kind; wxString kind;

View File

@ -18,7 +18,7 @@
#include "WaveTrack.h" #include "WaveTrack.h"
#include "widgets/TimeTextCtrl.h" #include "widgets/TimeTextCtrl.h"
int CompareSnapPoints(SnapPoint *s1, SnapPoint *s2) static int CompareSnapPoints(SnapPoint *s1, SnapPoint *s2)
{ {
return (s1->t - s2->t > 0? 1 : -1); return (s1->t - s2->t > 0? 1 : -1);
} }

View File

@ -1707,7 +1707,7 @@ void TrackArtist::DrawSpectrum(WaveTrack *track,
} }
} }
float sumFreqValues(float *freq, int x0, float bin0, float bin1) static float sumFreqValues(float *freq, int x0, float bin0, float bin1)
{ {
float value; float value;
if (int(bin1) == int(bin0)) { if (int(bin1) == int(bin0)) {

View File

@ -263,7 +263,7 @@ public:
#ifdef EXPERIMENTAL_USE_REALFFTF #ifdef EXPERIMENTAL_USE_REALFFTF
#include "FFT.h" #include "FFT.h"
void ComputeSpectrumUsingRealFFTf(float *buffer, HFFT hFFT, float *window, int len, float *out) static void ComputeSpectrumUsingRealFFTf(float *buffer, HFFT hFFT, float *window, int len, float *out)
{ {
int i; int i;
if(len > hFFT->Points*2) if(len > hFFT->Points*2)