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

Modified Files:
        ControlToolBar.cpp ControlToolBar.h 
Log Message:
Make control toolbar hook key events for SHIFT keys.

Index: ControlToolBar.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ControlToolBar.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ControlToolBar.h    16 Sep 2006 05:54:36 -0000      1.1
+++ ControlToolBar.h    22 Oct 2006 19:35:43 -0000      1.2
@@ -70,8 +70,8 @@
    void Populate();
    virtual void Repaint(wxDC *dc);
    virtual void EnableDisableButtons();
-   void OnShiftDown(wxKeyEvent & event);
-   void OnShiftUp(wxKeyEvent & event);
+   void OnKeyDown(wxKeyEvent & event);
+   void OnKeyUp(wxKeyEvent & event);
 
    void SetVUMeters(AudacityProject *p);
 

Index: ControlToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ControlToolBar.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ControlToolBar.cpp  1 Oct 2006 07:23:26 -0000       1.3
+++ ControlToolBar.cpp  22 Oct 2006 19:35:43 -0000      1.4
@@ -36,6 +36,7 @@
 #include <wx/wxprec.h>
 
 #ifndef WX_PRECOMP
+#include <wx/app.h>
 #include <wx/dc.h>
 #include <wx/event.h>
 #include <wx/image.h>
@@ -92,12 +93,31 @@
 
 ControlToolBar::~ControlToolBar()
 {
+   wxTheApp->Disconnect( wxEVT_KEY_DOWN,
+                         wxKeyEventHandler( ControlToolBar::OnKeyDown ),
+                         NULL,
+                         this );
+
+   wxTheApp->Disconnect( wxEVT_KEY_UP,
+                         wxKeyEventHandler( ControlToolBar::OnKeyUp ),
+                         NULL,
+                         this );
 }
 
 
 void ControlToolBar::Create(wxWindow * parent)
 {
    ToolBar::Create(parent);
+
+   wxTheApp->Connect( wxEVT_KEY_DOWN,
+                      wxKeyEventHandler( ControlToolBar::OnKeyDown ),
+                      NULL,
+                      this );
+
+   wxTheApp->Connect( wxEVT_KEY_UP,
+                      wxKeyEventHandler( ControlToolBar::OnKeyUp ),
+                      NULL,
+                      this );
 }
 
 // This is a convenience function that allows for button creation in
@@ -563,18 +583,26 @@
 }
 
 
-void ControlToolBar::OnShiftDown(wxKeyEvent & event)
+void ControlToolBar::OnKeyDown(wxKeyEvent & event)
 {
-   // Turn the "Play" button into a "Loop" button
-   if (!mPlay->IsDown())
-      mPlay->SetAlternate(true);
+   event.Skip();
+
+   if (event.GetKeyCode() == WXK_SHIFT ) {
+      // Turn the "Play" button into a "Loop" button
+      if (!mPlay->IsDown())
+         mPlay->SetAlternate(true);
+   }
 }
 
-void ControlToolBar::OnShiftUp(wxKeyEvent & event)
+void ControlToolBar::OnKeyUp(wxKeyEvent & event)
 {
-   // Turn the "Loop" button into a "Play" button
-   if (!mPlay->IsDown())
-      mPlay->SetAlternate(false);
+   event.Skip();
+
+   if (event.GetKeyCode() == WXK_SHIFT ) {
+      // Turn the "Loop" button into a "Play" button
+      if (!mPlay->IsDown())
+         mPlay->SetAlternate(false);
+   }
 }
 
 void ControlToolBar::OnPlay(wxCommandEvent &evt)


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to