~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to src/toolbars/TranscriptionToolBar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-18 21:58:19 UTC
  • mfrom: (13.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080218215819-tmbcf1rx238r8gdv
Tags: 1.3.4-1.1ubuntu1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "TranscriptionToolBar.h"
31
31
 
32
32
#include "ControlToolBar.h"
 
33
#include "../AudacityApp.h"
33
34
#include "../AllThemeResources.h"
34
35
#include "../AudioIO.h"
35
36
#include "../Experimental.h"
74
75
   EVT_SLIDER(TTB_SensitivitySlider, TranscriptionToolBar::OnSensitivitySlider)
75
76
 
76
77
   EVT_CHOICE(TTB_KeyType, TranscriptionToolBar::SetKeyType)
 
78
   EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, TranscriptionToolBar::OnCaptureKey)
77
79
END_EVENT_TABLE()
78
80
   ;   //semicolon enforces  proper automatic indenting in emacs.
79
81
 
174
176
   mPlaySpeedSlider->Set(1.0);
175
177
   mPlaySpeedSlider->SetLabel(_("Playback Speed"));
176
178
   Add( mPlaySpeedSlider, 0, wxALIGN_CENTER );
 
179
   mPlaySpeedSlider->Connect(wxEVT_SET_FOCUS,
 
180
                 wxFocusEventHandler(TranscriptionToolBar::OnFocus),
 
181
                 NULL,
 
182
                 this);
 
183
   mPlaySpeedSlider->Connect(wxEVT_KILL_FOCUS,
 
184
                 wxFocusEventHandler(TranscriptionToolBar::OnFocus),
 
185
                 NULL,
 
186
                 this);
177
187
 
178
188
#ifdef EXPERIMENTAL_VOICE_DETECTION
179
189
   AddButton(bmpTnStartOn,     bmpTnStartOnDisabled,  TTB_StartOn,
237
247
   Add(2, -1);
238
248
}
239
249
 
 
250
void TranscriptionToolBar::OnFocus(wxFocusEvent &event)
 
251
{
 
252
   wxCommandEvent e(EVT_CAPTURE_KEYBOARD);
 
253
 
 
254
   if (event.GetEventType() == wxEVT_KILL_FOCUS) {
 
255
      e.SetEventType(EVT_RELEASE_KEYBOARD);
 
256
   }
 
257
   e.SetEventObject(this);
 
258
   GetParent()->GetEventHandler()->ProcessEvent(e);
 
259
 
 
260
   Refresh(false);
 
261
 
 
262
   event.Skip();
 
263
}
 
264
 
 
265
void TranscriptionToolBar::OnCaptureKey(wxCommandEvent &event)
 
266
{
 
267
   wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
 
268
   int keyCode = kevent->GetKeyCode();
 
269
 
 
270
   // Pass LEFT/RIGHT/UP/DOWN/PAGEUP/PAGEDOWN through for input/output sliders
 
271
   if (FindFocus() == mPlaySpeedSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
 
272
                                    || keyCode == WXK_UP || keyCode == WXK_DOWN
 
273
                                    || keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
 
274
      return;
 
275
   }
 
276
 
 
277
   event.Skip();
 
278
 
 
279
   return;
 
280
}
 
281
 
240
282
//This handles key-stroke events????
241
283
void TranscriptionToolBar::OnKeyEvent(wxKeyEvent & event)
242
284
{
308
350
 
309
351
void TranscriptionToolBar::OnPlaySpeed(wxCommandEvent & event)
310
352
{
 
353
   // Can't do anything without an active project
 
354
   AudacityProject * p = GetActiveProject();
 
355
   if (!p) {
 
356
      return;
 
357
   }
 
358
 
311
359
   // Pop up the button
312
360
   SetButton(false, mButtons[TTB_PlaySpeed]); 
313
361
 
314
362
   // If IO is busy, abort immediately
315
363
   if (gAudioIO->IsBusy()) {
316
 
      SetButton(false, mButtons[TTB_PlaySpeed]);
317
 
      return;
318
 
   }
319
 
 
320
 
   // Can't do anything without an active project
321
 
   AudacityProject * p = GetActiveProject();
322
 
   if (!p) {
323
 
      return;
 
364
      p->GetControlToolBar()->StopPlaying();
324
365
   }
325
366
 
326
367
   // Can't do anything without a time track
349
390
void TranscriptionToolBar::OnSpeedSlider(wxCommandEvent& event)
350
391
{
351
392
   mPlaySpeed = (mPlaySpeedSlider->Get()) * 100;
 
393
 
 
394
   // If IO is busy, abort immediately
 
395
   if (gAudioIO->IsBusy()) {
 
396
      OnPlaySpeed(event);
 
397
   }
352
398
}
353
399
 
354
400
void TranscriptionToolBar::OnStartOn(wxCommandEvent &event)