Update of /cvsroot/audacity/audacity-src/src/toolbars In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29736/src/toolbars
Modified Files: SelectionBar.cpp SelectionBar.h Log Message: Snap-to-time fixes, take 2. Gets rid of troublesome dummy control, doesn't use snap manager when snapping to time. Index: SelectionBar.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/toolbars/SelectionBar.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- SelectionBar.cpp 21 Jan 2010 02:25:05 -0000 1.32 +++ SelectionBar.cpp 21 Jan 2010 06:09:34 -0000 1.33 @@ -85,7 +85,7 @@ SelectionBar::SelectionBar() : ToolBar(SelectionBarID, _("Selection"), wxT("Selection")), mListener(NULL), mRate(0.0), mStart(0.0), mEnd(0.0), mAudio(0.0), - mLeftTime(NULL), mRightTime(NULL), mDummyRight(NULL), mAudioTime(NULL) + mLeftTime(NULL), mRightTime(NULL), mAudioTime(NULL) { } @@ -265,10 +265,6 @@ mRightTime->EnableMenu(); mainSizer->Add(mRightTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); - // Dummy control is constructed but shown off screen - mDummyRight = new TimeTextCtrl(this, -1, format, 0.0, mRate, - wxPoint(-32000,-32000)); - mainSizer->Add(new wxStaticLine(this, -1, wxDefaultPosition, wxSize(1, toolbarSingle), wxLI_VERTICAL), @@ -378,7 +374,6 @@ // so reset pointers first. mLeftTime = mRightTime = - mDummyRight = mAudioTime = NULL; mRightEndButton = @@ -394,7 +389,6 @@ wxString formatString = mLeftTime->GetBuiltinFormat(index); mLeftTime->SetFormatString(formatString); mRightTime->SetFormatString(formatString); - mDummyRight->SetFormatString(formatString); mAudioTime->SetFormatString(formatString); if (leftFocus) { @@ -414,14 +408,10 @@ { mLeftTime->SetTimeValue(mStart); - if (mRightEndButton->GetValue()) { + if (mRightEndButton->GetValue()) mRightTime->SetTimeValue(mEnd); - mDummyRight->SetTimeValue(mEnd - mStart); - } - else { + else mRightTime->SetTimeValue(mEnd - mStart); - mDummyRight->SetTimeValue(mEnd); - } mAudioTime->SetTimeValue(mAudio); } @@ -444,8 +434,14 @@ { if (mRightEndButton->GetValue()) return mRightTime->GetTimeValue(); - else - return mDummyRight->GetTimeValue(); + else { + // What would be shown if we were showing the end time + TimeTextCtrl ttc(this, wxID_ANY, wxT(""), 0.0, mRate); + ttc.SetFormatString(mRightTime->GetFormatString()); + ttc.SetSampleRate(mRate); + ttc.SetTimeValue(mEnd); + return ttc.GetTimeValue(); + } } void SelectionBar::SetField(const wxChar *msg, int fieldNum) @@ -473,7 +469,6 @@ // update the TimeTextCtrls if they exist if (mLeftTime) mLeftTime->SetSampleRate(rate); if (mRightTime) mRightTime->SetSampleRate(rate); - if (mDummyRight) mDummyRight->SetSampleRate(rate); if (mAudioTime) mAudioTime->SetSampleRate(rate); } } @@ -485,7 +480,6 @@ { if (mLeftTime) mLeftTime->SetSampleRate(mRate); if (mRightTime) mRightTime->SetSampleRate(mRate); - if (mDummyRight) mDummyRight->SetSampleRate(mRate); if (mAudioTime) mAudioTime->SetSampleRate(mRate); if (mListener) mListener->AS_SetRate(mRate); } Index: SelectionBar.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/toolbars/SelectionBar.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- SelectionBar.h 21 Jan 2010 02:25:05 -0000 1.11 +++ SelectionBar.h 21 Jan 2010 06:09:34 -0000 1.12 @@ -90,8 +90,6 @@ TimeTextCtrl *mLeftTime; TimeTextCtrl *mRightTime; - // An un-shown control; holds whichever of end/length is not displayed - TimeTextCtrl *mDummyRight; wxRadioButton *mRightEndButton; wxRadioButton *mRightLengthButton; TimeTextCtrl *mAudioTime; ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs