replaced X11-specific parts by platform independent code but still does not work properly

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1712 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-25 21:28:00 +00:00
parent 9d49857dd4
commit bd51ed60a6
3 changed files with 41 additions and 36 deletions

View File

@@ -1,5 +1,10 @@
2008-09-25 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/live_tool/live_tool.h:
* plugins/live_tool/live_tool.cpp:
replaced X11-specific parts by platform independent code but still
does not work properly
* src/gui/piano_roll.cpp:
play preview notes also while playing (closes #2089399)

View File

@@ -23,19 +23,13 @@
*/
#include <QtGui/QKeyEvent>
#include <QtGui/QLayout>
#include "live_tool.h"
#include "bb_track_container.h"
#include "engine.h"
#include "song.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
#include <QtGui/QKeyEvent>
#include <QtGui/QLayout>
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
@@ -119,6 +113,8 @@ liveToolView::liveToolView( tool * _tool ) :
parentWidget()->hide();
parentWidget()->layout()->setSizeConstraint( QLayout::SetFixedSize );
installEventFilter( this );
}
@@ -151,7 +147,21 @@ void liveToolView::keyPressEvent( QKeyEvent * _ke )
engine::getSong()->play();
}
break;
case Qt::Key_F1:
case Qt::Key_F2:
case Qt::Key_F3:
case Qt::Key_F4:
case Qt::Key_F5:
case Qt::Key_F6:
case Qt::Key_F7:
case Qt::Key_F8:
case Qt::Key_F9:
case Qt::Key_F10:
case Qt::Key_F11:
case Qt::Key_F12:
toggleInstrument( _ke->key() - Qt::Key_F1 );
_ke->accept();
break;
default:
_ke->ignore();
break;
@@ -161,36 +171,31 @@ void liveToolView::keyPressEvent( QKeyEvent * _ke )
bool liveToolView::eventFilter ( QObject * watched, QEvent * event )
{
if( event->type() == QEvent::KeyPress )
{
QKeyEvent * ke = static_cast<QKeyEvent *>( event );
keyPressEvent( ke );
return true;
}
return toolView::eventFilter( watched, event );
}
void liveToolView::mousePressEvent( QMouseEvent * _me )
{
// MDI window gets focus otherwise
setFocus();
_me->accept();
// somehow need to grab keyboard for also grabbing global shortcuts
}
#ifdef Q_WS_X11
bool liveToolView::x11Event( XEvent * _xe )
{
if( _xe->type == KeyPress )
{
unsigned keycode = _xe->xkey.keycode;
// F1 to F10
if( 67 <= keycode && keycode <= 76 )
{
toggleInstrument( keycode - 67 );
return( TRUE );
}
}
return( FALSE );
}
#endif
void liveToolView::toggleInstrument( int _n )
{
if( _n < engine::getBBTrackContainer()->tracks().count() )

View File

@@ -1,7 +1,7 @@
/*
* live_tool.h - declaration of class liveTool, for live performance
*
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,21 +30,16 @@
#include "tool.h"
class liveToolView : public toolView
{
public:
liveToolView( tool * _tool );
virtual ~liveToolView();
virtual bool eventFilter ( QObject * watched, QEvent * event );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void mousePressEvent( QMouseEvent * _me );
#ifdef Q_WS_X11
virtual bool x11Event( XEvent * _xe );
#endif
private:
void toggleInstrument( int _n );