Update of /cvsroot/audacity/audacity-src/src/effects
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv4868
Modified Files:
Noise.cpp Noise.h
Log Message:
Fix TimeTextCtrl handling in TransferDataToWindow()
Slight reformatting
Index: Noise.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Noise.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Noise.h 15 Apr 2007 02:23:26 -0000 1.11
+++ Noise.h 4 Jul 2007 09:19:30 -0000 1.12
@@ -93,7 +93,6 @@
private:
void OnTimeCtrlUpdate(wxCommandEvent & event);
- void OnNoiseDurationText(wxCommandEvent & event);
DECLARE_EVENT_TABLE()
public:
@@ -106,7 +105,7 @@
bool nIsSelection;
private:
- TimeTextCtrl *mNoiseDurationT;
+ TimeTextCtrl *mNoiseDurationT;
};
#endif
Index: Noise.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Noise.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Noise.cpp 31 Jan 2007 07:21:31 -0000 1.17
+++ Noise.cpp 4 Jul 2007 09:19:30 -0000 1.18
@@ -198,16 +198,13 @@
#define AMP_MIN 0
#define AMP_MAX 1
-#define ID_NOISE_DURATION_TEXT 10001
-
BEGIN_EVENT_TABLE(NoiseDialog, EffectDialog)
EVT_COMMAND(wxID_ANY, EVT_TIMETEXTCTRL_UPDATED,
NoiseDialog::OnTimeCtrlUpdate)
- EVT_TEXT(ID_NOISE_DURATION_TEXT, NoiseDialog::OnNoiseDurationText)
END_EVENT_TABLE()
-
NoiseDialog::NoiseDialog(wxWindow * parent, const wxString & title):
EffectDialog(parent, title, INSERT_EFFECT)
{
+ mNoiseDurationT = NULL;
/* // already initialized in EffectNoise::PromptUser
nDuration = noiseDuration;
nAmplitude = noiseAmplitude;
@@ -220,58 +217,56 @@
S.StartMultiColumn(2, wxCENTER);
{
S.AddFixedText(_("Noise duration"), false);
- mNoiseDurationT = new
- TimeTextCtrl(this,
- ID_NOISE_DURATION_TEXT,
- /*
- use this instead of "seconds" because if a selection is
passed to the effect,
- I want it (nDuration) to be used as the duration, and with
"seconds" this does
- not always work properly. For example, it rounds down to
zero...
- */
-
TimeTextCtrl::GetBuiltinFormat(nIsSelection==true?(wxT("hh:mm:ss +
samples")):(wxT("seconds"))),
- nDuration,
- 44100,
- wxDefaultPosition,
- wxDefaultSize,
- true);
+ if (mNoiseDurationT == NULL)
+ {
+ mNoiseDurationT = new
+ TimeTextCtrl(this,
+ wxID_ANY,
+ /*
+ use this instead of "seconds" because if a selection is
passed to the effect,
+ I want it (nDuration) to be used as the duration, and
with "seconds" this does
+ not always work properly. For example, it rounds down to
zero...
+ */
+
TimeTextCtrl::GetBuiltinFormat(nIsSelection==true?(wxT("hh:mm:ss +
samples")):(wxT("seconds"))),
+ nDuration,
+ 44100,
+ wxDefaultPosition,
+ wxDefaultSize,
+ true);
+ mNoiseDurationT->EnableMenu();
+ }
S.AddWindow(mNoiseDurationT);
- mNoiseDurationT->EnableMenu();
- S.TieTextBox( _("Amplitude"), nAmplitude, 10);
- S.TieChoice( _("Noise type:"), nType, nTypeList);
- S.SetSizeHints(-1,-1);
+ S.TieTextBox(_("Amplitude"), nAmplitude, 10);
+ S.TieChoice(_("Noise type"), nType, nTypeList);
+ S.SetSizeHints(-1, -1);
}
S.EndMultiColumn();
}
bool NoiseDialog::TransferDataToWindow()
{
-// if you don't remove these, there will be a double
-// timetextctrl in the dialog. Don't know why...
-//
-// ShuttleGui S( this, eIsSettingToDialog );
-// PopulateOrExchange( S );
+ EffectDialog::TransferDataToWindow();
+ // Must handle this ourselves since ShuttleGui doesn't know about it
mNoiseDurationT->SetTimeValue(nDuration);
- mNoiseDurationT->SetFocus();
- mNoiseDurationT->Fit();
+
return true;
}
bool NoiseDialog::TransferDataFromWindow()
{
- ShuttleGui S( this, eIsGettingFromDialog );
- PopulateOrExchange( S );
+ EffectDialog::TransferDataFromWindow();
nAmplitude = TrapDouble(nAmplitude, AMP_MIN, AMP_MAX);
- return true;
-}
-void NoiseDialog::OnNoiseDurationText(wxCommandEvent & event) {
+ // Must handle this ourselves since ShuttleGui doesn't know about it
nDuration = mNoiseDurationT->GetTimeValue();
+
+ return true;
}
void NoiseDialog::OnTimeCtrlUpdate(wxCommandEvent & event) {
- this->Fit();
+ Fit();
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs