Permalink
Browse files

Added play/pause toggle (spacebar)

  • Loading branch information...
1 parent cd0eda4 commit 2cd058c0a7b5d72aa20e519a7467aece999dab0a @fieldOfView committed Mar 25, 2012
Showing with 27 additions and 7 deletions.
  1. +27 −7 src/DShowApp.cpp
View
@@ -110,15 +110,35 @@ void DShowApp::mouseDown( MouseEvent event )
void DShowApp::keyDown( KeyEvent event )
{
- if( event.getChar() == 'f' ) {
+ switch( event.getChar() ) {
+ case 'f':
setFullScreen( ! isFullScreen() );
- }
- else if( event.getChar() == 'o' ) {
- CloseGraph();
- fs::path moviePath = getOpenFilePath();
- if( ! moviePath.empty() ) {
- StartGraph( moviePath );
+ break;
+
+ case 'o':
+ {
+ CloseGraph();
+ fs::path moviePath = getOpenFilePath();
+ if( ! moviePath.empty() ) {
+ StartGraph( moviePath );
+ }
}
+ break;
+
+ case ' ':
+ if( g_mediaControl != NULL ) {
+ LONG msTimeout = 0;
+ OAFilterState pfs;
+
+ if( SUCCEEDED( g_mediaControl->GetState( msTimeout, &pfs ) ) ) {
+ if( pfs == State_Running )
+ g_mediaControl->Pause();
+ else
+ g_mediaControl->Run();
+ }
+ }
+ break;
+
}
}

0 comments on commit 2cd058c

Please sign in to comment.