- commit
- 125b6b62f9b540e9e9658552f5fb9eb745603248
- parent
- 94e7a516f10b45032fbe9571530795ec35ecbb01
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2010-11-07 19:24
always update gui
Diffstat
| M | README | 2 | -- |
| M | src/gui/RetimerMainFrame.cpp | 62 | +++++++++++++++++++++++++++++++++++-------------------------- |
| M | src/gui/RetimerMainFrame.h | 8 | ++++++-- |
| M | src/gui/retimer_wx.cpp | 4 | ++-- |
| M | src/gui/retimer_wx.fbp | 10 | +++++----- |
| M | src/gui/retimer_wx.h | 2 | +- |
| M | xiRetimer | 0 |
7 files changed, 50 insertions, 38 deletions
diff --git a/README b/README
@@ -10,9 +10,7 @@ timestretch - rubberband (v>=1.5) 10 10 11 11 12 12 TODO13 -1 rubberband crashes14 13 smooth interpolation15 -1 always update gui16 14 libmad 17 15 exits with error 18 16 soundtouch
diff --git a/src/gui/RetimerMainFrame.cpp b/src/gui/RetimerMainFrame.cpp
@@ -22,10 +22,16 @@ RetimerMainFrame::RetimerMainFrame( wxWindow* parent ) : MainFrame( parent ) {
22 22 penMarker=new wxPen(wxColor(255,255,0),1);
23 23 wxBitmap waveform;
24 24 _updateWaveform=true;
-1 25
-1 26 timer;
-1 27 timer.SetOwner(this);
-1 28 Connect( wxEVT_TIMER, wxTimerEventHandler( RetimerMainFrame::OnTimer ) );
-1 29 timer.Start(100);
25 30 }
26 31
27 32
28 33 RetimerMainFrame::~RetimerMainFrame() {
-1 34 timer.Stop();
29 35 // TODO destroy objects
30 36 // delete[] curve;
31 37 // delete[] playback;
@@ -156,36 +162,19 @@ void RetimerMainFrame::OnClearClick( wxCommandEvent& event ) {
156 162 // ************ misc **************
157 163 void RetimerMainFrame::OnProcessClick( wxCommandEvent& event ) {process();}
158 164
159 -1 void RetimerMainFrame::OnPaint( wxUpdateUIEvent& event ) {
160 -1 // TODO repaint also if UI update is not necessary, eg whe seeker is moving from playback
161 -1 paint();
162 -1 }
163 -1
164 -1 void RetimerMainFrame::OnSize( wxSizeEvent& event ) {
165 -1 _updateWaveform=true;
-1 165 void RetimerMainFrame::OnPaint( wxPaintEvent& event ) {
-1 166 wxPaintDC pdc(this);
-1 167 // paint(&pdc);
166 168 }
167 169
168 -1
169 -1 // ***********************************
170 -1 void RetimerMainFrame::process() {
171 -1 // sometings wrong here
172 -1 if (sample->process()!=0)
173 -1 // reportError(_T("Could not process data!"));
174 -1 {}
175 -1
176 -1 wxProgressDialog::wxProgressDialog* dialog = new wxProgressDialog( _T("processing..."), _T("please wait") );
177 -1 dialog ->Show();
178 -1 while (sample->getProcessing()) {
179 -1 dialog->Update(int(sample->getFinished()*100));
180 -1 }
181 -1 dialog->Show(false);
182 -1 // TODO deatroy dialog
-1 170 void RetimerMainFrame::OnTimer(wxTimerEvent& event) {
-1 171 wxClientDC dc(this);
-1 172 paint(&dc);
183 173 }
184 174
185 -1 void RetimerMainFrame::paint() {
186 -1 wxClientDC dc(this);
187 -1 dc.GetSize(&width,&height);
188 -1 wxBufferedDC bdc(&dc,wxSize(width,height));
-1 175 void RetimerMainFrame::paint(wxDC* dc) {
-1 176 dc->GetSize(&width,&height);
-1 177 wxBufferedDC bdc(dc,wxSize(width,height));
189 178 // waveform
190 179 if (_updateWaveform) {
191 180 waveform.Create(width, height);
@@ -229,6 +218,27 @@ void RetimerMainFrame::paint() {
229 218 }
230 219 }
231 220
-1 221 void RetimerMainFrame::OnSize( wxSizeEvent& event ) {
-1 222 _updateWaveform=true;
-1 223 }
-1 224
-1 225
-1 226 // ***********************************
-1 227 void RetimerMainFrame::process() {
-1 228 // sometings wrong here
-1 229 if (sample->process()!=0)
-1 230 // reportError(_T("Could not process data!"));
-1 231 {}
-1 232
-1 233 wxProgressDialog::wxProgressDialog* dialog = new wxProgressDialog( _T("processing..."), _T("please wait") );
-1 234 dialog ->Show();
-1 235 while (sample->getProcessing()) {
-1 236 dialog->Update(int(sample->getFinished()*100));
-1 237 }
-1 238 dialog->Show(false);
-1 239 // TODO deatroy dialog
-1 240 }
-1 241
232 242 void RetimerMainFrame::reportError(wxString string) {
233 243 wxMessageDialog::wxMessageDialog* dialog = new wxMessageDialog( this, string, _T("Error"), wxOK | wxICON_ERROR );
234 244 dialog ->ShowModal();
diff --git a/src/gui/RetimerMainFrame.h b/src/gui/RetimerMainFrame.h
@@ -18,6 +18,7 @@ Subclass of MainFrame, which is generated by wxFormBuilder. 18 18 #include <wx/dcbuffer.h> 19 19 #include <wx/string.h> 20 20 #include <wx/filedlg.h> -1 21 #include <wx/timer.h> 21 22 22 23 #include <iostream> 23 24 @@ -44,10 +45,13 @@ protected: 44 45 // misc 45 46 void OnPrefsClick( wxCommandEvent& event ); 46 47 void OnProcessClick( wxCommandEvent& event );47 -1 void OnPaint( wxUpdateUIEvent& event );-1 48 void OnPaint( wxPaintEvent& event ); 48 49 void OnSize( wxSizeEvent& event ); 49 5050 -1 void paint();-1 51 void paint(wxDC* dc); -1 52 wxTimer timer; -1 53 void OnTimer(wxTimerEvent& event); -1 54 51 55 void process(); 52 56 bool _updateWaveform; 53 57 void reportError(wxString string);
diff --git a/src/gui/retimer_wx.cpp b/src/gui/retimer_wx.cpp
@@ -128,8 +128,8 @@ wxInitAllImageHandlers(); 128 128 this->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame::OnLeftDown ) ); 129 129 this->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame::OnLeftUp ) ); 130 130 this->Connect( wxEVT_MOTION, wxMouseEventHandler( MainFrame::OnMotion ) ); -1 131 this->Connect( wxEVT_PAINT, wxPaintEventHandler( MainFrame::OnPaint ) ); 131 132 this->Connect( wxEVT_SIZE, wxSizeEventHandler( MainFrame::OnSize ) );132 -1 this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( MainFrame::OnPaint ) );133 133 this->Connect( m_open->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnOpenClick ) ); 134 134 this->Connect( m_export->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExportClick ) ); 135 135 this->Connect( m_prefs->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPrefsClick ) ); @@ -148,8 +148,8 @@ MainFrame::~MainFrame() 148 148 this->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame::OnLeftDown ) ); 149 149 this->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame::OnLeftUp ) ); 150 150 this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( MainFrame::OnMotion ) ); -1 151 this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( MainFrame::OnPaint ) ); 151 152 this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( MainFrame::OnSize ) );152 -1 this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( MainFrame::OnPaint ) );153 153 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnOpenClick ) ); 154 154 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnExportClick ) ); 155 155 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnPrefsClick ) );
diff --git a/src/gui/retimer_wx.fbp b/src/gui/retimer_wx.fbp
@@ -68,13 +68,13 @@ 68 68 <event name="OnMotion">OnMotion</event> 69 69 <event name="OnMouseEvents"></event> 70 70 <event name="OnMouseWheel"></event>71 -1 <event name="OnPaint"></event>-1 71 <event name="OnPaint">OnPaint</event> 72 72 <event name="OnRightDClick"></event> 73 73 <event name="OnRightDown"></event> 74 74 <event name="OnRightUp"></event> 75 75 <event name="OnSetFocus"></event> 76 76 <event name="OnSize">OnSize</event>77 -1 <event name="OnUpdateUI">OnPaint</event>-1 77 <event name="OnUpdateUI"></event> 78 78 <object class="wxBoxSizer" expanded="1"> 79 79 <property name="minimum_size"></property> 80 80 <property name="name">bSizer3</property> @@ -130,7 +130,7 @@ 130 130 <event name="OnSize"></event> 131 131 <event name="OnUpdateUI"></event> 132 132 </object>133 -1 <object class="wxMenuBar" expanded="1">-1 133 <object class="wxMenuBar" expanded="0"> 134 134 <property name="bg"></property> 135 135 <property name="context_help"></property> 136 136 <property name="enabled">1</property> @@ -342,7 +342,7 @@ 342 342 </object> 343 343 </object> 344 344 </object>345 -1 <object class="Dialog" expanded="1">-1 345 <object class="Dialog" expanded="0"> 346 346 <property name="bg"></property> 347 347 <property name="center"></property> 348 348 <property name="context_help"></property> @@ -648,7 +648,7 @@ 648 648 </object> 649 649 </object> 650 650 </object>651 -1 <object class="Dialog" expanded="1">-1 651 <object class="Dialog" expanded="0"> 652 652 <property name="bg"></property> 653 653 <property name="center"></property> 654 654 <property name="context_help"></property>
diff --git a/src/gui/retimer_wx.h b/src/gui/retimer_wx.h
@@ -48,8 +48,8 @@ class MainFrame : public wxFrame 48 48 virtual void OnLeftDown( wxMouseEvent& event ) { event.Skip(); } 49 49 virtual void OnLeftUp( wxMouseEvent& event ) { event.Skip(); } 50 50 virtual void OnMotion( wxMouseEvent& event ) { event.Skip(); } -1 51 virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); } 51 52 virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }52 -1 virtual void OnPaint( wxUpdateUIEvent& event ) { event.Skip(); }53 53 virtual void OnOpenClick( wxCommandEvent& event ) { event.Skip(); } 54 54 virtual void OnExportClick( wxCommandEvent& event ) { event.Skip(); } 55 55 virtual void OnPrefsClick( wxCommandEvent& event ) { event.Skip(); }