Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv510

Modified Files:
        Menus.cpp 
Log Message:
New keyboard shortcut: Play/Stop and Select. 
Changes introduce a keyboard shortcut bound to "Shift-Return" that starts 
playback when stopped, 
and that does a "Stop and Select" when playing.


Index: Menus.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v
retrieving revision 1.345
retrieving revision 1.346
diff -u -d -r1.345 -r1.346
--- Menus.cpp   24 Sep 2007 05:06:56 -0000      1.345
+++ Menus.cpp   29 Sep 2007 19:24:07 -0000      1.346
@@ -770,6 +770,7 @@
    c->AddCommand(wxT("Pause"),       _("Pause\tP"),                    
FN(OnPause));
    c->AddCommand(wxT("Record"),      _("Record\tR"),                   
FN(OnRecord));
    
+   c->AddCommand(wxT("PlayStopSelect"),  _("Play/Stop and 
Select\tShift+Return"),    FN(OnPlayStopSelect));
    c->AddCommand(wxT("StopSelect"),  _("Stop and Select\tShift+A"),    
FN(OnStopSelect));
 
    c->AddCommand(wxT("PlayOneSec"),     _("Play One Second\t1"),       
FN(OnPlayOneSecond));
@@ -1377,6 +1378,34 @@
    GetControlToolBar()->OnRecord(evt);
 }
 
+// The code for "OnPlayStopSelect" is simply the code of "OnPlayStop" and 
"OnStopSelect" merged.
+void AudacityProject::OnPlayStopSelect()
+{
+   wxCommandEvent evt;
+   ControlToolBar *toolbar = GetControlToolBar();
+
+   //If busy, stop playing, make sure everything is unpaused.
+   if (gAudioIO->IsStreamActive(GetAudioIOToken())) {
+      toolbar->SetPlay(false);        //Pops
+      toolbar->SetStop(true);         //Pushes stop down
+//    toolbar->StopPlaying();
+      mViewInfo.sel0 = gAudioIO->GetStreamTime();
+      if( mViewInfo.sel1 < mViewInfo.sel0 ) {
+         mViewInfo.sel1 = mViewInfo.sel0;
+      }
+      GetControlToolBar()->OnStop(evt);
+      ModifyState();
+   }
+   else if (!gAudioIO->IsBusy()) {
+      //Otherwise, start playing (assuming audio I/O isn't busy)
+      toolbar->SetPlay(true);
+      toolbar->SetStop(false);
+
+      // Will automatically set mLastPlayMode
+      toolbar->PlayCurrentRegion(false);
+   }
+}
+
 void AudacityProject::OnStopSelect()
 {
    wxCommandEvent evt;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to