Update of /cvsroot/audacity/audacity-src/src/toolbars
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv15064
Modified Files:
ToolManager.cpp ToolManager.h
Log Message:
Hide indicator when shift key pressed during toolbar drag
Index: ToolManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ToolManager.h 22 Oct 2006 09:54:26 -0000 1.5
+++ ToolManager.h 22 Oct 2006 19:47:16 -0000 1.6
@@ -66,10 +66,11 @@
ToolBar *Float( ToolBar *t, wxPoint & pos );
+ void OnKey( wxKeyEvent & event );
void OnMouse( wxMouseEvent & event );
void OnGrabber( GrabberEvent & event );
- void OnCreate( wxWindowCreateEvent & event );
+ void OnIndicatorCreate( wxWindowCreateEvent & event );
void OnIndicatorPaint( wxPaintEvent & event );
void ReadConfig();
Index: ToolManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ToolManager.cpp 22 Oct 2006 10:46:22 -0000 1.8
+++ ToolManager.cpp 22 Oct 2006 19:47:16 -0000 1.9
@@ -344,7 +344,7 @@
// Hook the creation event...only needed on GTK, but doesn't hurt for all
mIndicator->Connect( wxEVT_CREATE,
- wxWindowCreateEventHandler( ToolManager::OnCreate ),
+ wxWindowCreateEventHandler(
ToolManager::OnIndicatorCreate ),
NULL,
this );
@@ -406,7 +406,7 @@
// Remove our event handlers
mIndicator->Disconnect( wxEVT_CREATE,
- wxWindowCreateEventHandler( ToolManager::OnCreate ),
+ wxWindowCreateEventHandler(
ToolManager::OnIndicatorCreate ),
NULL,
this );
mIndicator->Disconnect( wxEVT_PAINT,
@@ -770,6 +770,17 @@
mParent->ReleaseMouse();
}
+ // Need to watch for the shift key
+ wxTheApp->Disconnect( wxEVT_KEY_DOWN,
+ wxKeyEventHandler( ToolManager::OnKey ),
+ NULL,
+ this );
+
+ wxTheApp->Disconnect( wxEVT_KEY_UP,
+ wxKeyEventHandler( ToolManager::OnKey ),
+ NULL,
+ this );
+
// Hide the indicator
mIndicator->Hide();
@@ -861,8 +872,11 @@
// Move it into position and put it on stage
mIndicator->SetShape( *mCurrent );
mIndicator->Move( dock->GetParent()->ClientToScreen( p ) );
- mIndicator->Show();
- mIndicator->Update();
+ if( !event.ShiftDown() )
+ {
+ mIndicator->Show();
+ mIndicator->Update();
+ }
// Remember for next go round
mBarPos = r;
@@ -891,6 +905,38 @@
}
//
+// Watch for shift key changes
+//
+void ToolManager::OnKey( wxKeyEvent & event )
+{
+ // Go ahead and set the event to propagate
+ event.Skip();
+
+ // Can't do anything if we're not dragging. This also prevents
+ // us from intercepting events that don't belong to us from the
+ // parent since we're Connect()ed to a couple.
+ if( !mDragWindow )
+ {
+ return;
+ }
+
+ if( event.GetKeyCode() == WXK_SHIFT )
+ {
+#if defined(__WXMAC__)
+ // Disable window animation
+ wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
+#endif
+
+ mIndicator->Show( event.GetEventType() == wxEVT_KEY_UP );
+
+#if defined(__WXMAC__)
+ // Disable window animation
+ wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
+#endif
+ }
+}
+
+//
// Handle Indicator paint events
//
// Really only needed for the Mac since SetBackgroundColour()
@@ -912,7 +958,7 @@
// Without this, the initial Indicator window will be a solid blue square
// until the next time it changes.
//
-void ToolManager::OnCreate( wxWindowCreateEvent & event )
+void ToolManager::OnIndicatorCreate( wxWindowCreateEvent & event )
{
#if defined(__WXGTK__)
mIndicator->SetShape( *mCurrent );
@@ -970,6 +1016,17 @@
mDragWindow = (ToolFrame *) mDragBar->GetParent();
}
+ // Need to watch for the shift key
+ wxTheApp->Connect( wxEVT_KEY_DOWN,
+ wxKeyEventHandler( ToolManager::OnKey ),
+ NULL,
+ this );
+
+ wxTheApp->Connect( wxEVT_KEY_UP,
+ wxKeyEventHandler( ToolManager::OnKey ),
+ NULL,
+ this );
+
// We want all mouse events from this point on
mParent->CaptureMouse();
}
-------------------------------------------------------------------------
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