InstrumentTrackView: added one-window-mode + global piano focus

Added a one-window-mode which allows to have only one instrument track
window open at a time. The content of this window is replaced each time
you open a different track.

Furthermore added global reception and forwarding of key events to the
piano widget of the top-most instrument track window. This for example
enables the user to play test sounds while tweaking some effects in a
different subwindow.
This commit is contained in:
Tobias Doerffel
2010-08-06 22:59:43 +02:00
parent 1320741feb
commit 93681760d2
10 changed files with 177 additions and 110 deletions

View File

@@ -2,7 +2,7 @@
* InstrumentTrack.h - declaration of class InstrumentTrack, a track + window
* which holds an instrument-plugin
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -41,6 +41,7 @@
class QLineEdit;
template<class T> class QQueue;
template<class T> class QStack;
class ArpeggiatorView;
class ChordCreatorView;
class EffectRackView;
@@ -259,6 +260,10 @@ public:
return castModel<InstrumentTrack>();
}
static InstrumentTrackWindow * topLevelInstrumentTrackWindow()
{
return s_windowStack.isEmpty() ? NULL : s_windowStack.top();
}
QMenu * midiMenu()
{
@@ -267,7 +272,7 @@ public:
void freeInstrumentTrackWindow();
static void cleanupWindowPool();
static void cleanupWindowCache();
protected:
@@ -288,7 +293,8 @@ private slots:
private:
InstrumentTrackWindow * m_window;
static QQueue<InstrumentTrackWindow *> s_windows;
static QQueue<InstrumentTrackWindow *> s_windowCache;
static QStack<InstrumentTrackWindow *> s_windowStack;
// widgets in track-settings-widget
trackLabelButton * m_tlb;
@@ -335,9 +341,11 @@ public:
return castModel<InstrumentTrack>();
}
void setInstrumentTrackView( InstrumentTrackView * _tv )
void setInstrumentTrackView( InstrumentTrackView * _tv );
PianoView * pianoView()
{
m_itv = _tv;
return m_pianoView;
}
static void dragEnterEventGeneric( QDragEnterEvent * _dee );

View File

@@ -1,7 +1,7 @@
/*
* PianoView.h - declaration of PianoView, an interactive piano/keyboard-widget
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -43,10 +43,13 @@ public:
static int getKeyFromKeyEvent( QKeyEvent * _ke );
protected:
virtual void modelChanged();
public:
virtual void keyPressEvent( QKeyEvent * ke );
virtual void keyReleaseEvent( QKeyEvent * ke );
protected:
virtual void modelChanged();
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void paintEvent( QPaintEvent * );
virtual void mousePressEvent( QMouseEvent * me );

View File

@@ -1,7 +1,7 @@
/*
* setup_dialog.h - dialog for setting up LMMS
*
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -115,6 +115,7 @@ private slots:
void toggleDisableChActInd( bool _disabled );
void toggleManualChPiano( bool _enabled );
void toggleOneInstrumentTrackWindow( bool _enabled );
void toggleMCLEnabled( bool _enabled );
void toggleMCLControlKey( bool _enabled );
@@ -170,6 +171,7 @@ private:
bool m_disableChActInd;
bool m_manualChPiano;
bool m_oneInstrumentTrackWindow;
typedef QMap<QString, AudioBackend::setupWidget *> AswMap;
typedef QMap<QString, MidiClient::setupWidget *> MswMap;